Skip to content
Snippets Groups Projects
Commit 6d388cbf authored by Morris Jette's avatar Morris Jette
Browse files

Add test for invalid Munge credential

parent 4c214c29
No related branches found
No related tags found
No related merge requests found
......@@ -207,6 +207,7 @@ EXTRA_DIST = \
test7.14.prog2.c \
test7.15 \
test7.15.prog.c \
test7.16 \
test8.1 \
test8.2 \
test8.3 \
......
......@@ -520,6 +520,7 @@ EXTRA_DIST = \
test7.14.prog2.c \
test7.15 \
test7.15.prog.c \
test7.16 \
test8.1 \
test8.2 \
test8.3 \
......
......@@ -321,6 +321,8 @@ test7.13 Verify the correct setting of a job's ExitCode
test7.14 Verify the ability to modify the Derived Exit Code/String fields
of a job record in the database
test7.15 Verify signal mask of tasks have no ignored signals.
test7.16 Verify that auth/munge credential is properly validated.
test8.# Test of Blue Gene specific functionality.
=================================================
......
#!/usr/bin/expect
############################################################################
# Purpose: Test of SLURM functionality
# Verify that auth/munge credential is properly validated.
#
# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR
# "FAILURE: ..." otherwise with an explanation of the failure, OR
# anything else indicates a failure mode that must be investigated.
############################################################################
# Copyright (C) 2012 SchedMD LLC.
# Written by Morris Jette <jette@schedmd.com>
#
# This file is part of SLURM, a resource management program.
# For details, see <http://www.schedmd.com/slurmdocs/>.
# Please also read the included file: DISCLAIMER.
#
# SLURM is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with SLURM; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
############################################################################
source ./globals
set test_id "7.16"
set exit_code 0
print_header $test_id
#
# Check if we have auth/munge configured
#
log_user 0
set auth_munge 0
spawn $scontrol show config
expect {
-re "AuthType *= auth/munge" {
set auth_munge 1
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
log_user 1
if {$auth_munge == 0} {
send_user "\nWARNING: not running auth/munge, test is not applicable\n"
exit $exit_code
}
#
# Try to get allocation with bad credential
#
set env(SLURM_MUNGE_AUTH_FAIL_TEST) 1
set job_id 0
set salloc_pid [spawn $salloc -N1 $bin_bash]
expect {
-re "Granted job allocation ($number)" {
set job_id $expect_out(1,string)
send "exit\r"
exp_continue
}
-re "error" {
send_user "\nError is expected, no worries.\n"
exp_continue
}
timeout {
send_user "\nFAILURE: salloc not responding\n"
if {$job_id != 0} {
cancel_job $job_id
}
slow_kill [expr 0 - $salloc_pid]
exit 1
}
eof {
wait
}
}
if {$job_id != 0} {
send_user "\FAILURE: allocation grated with bad Munge credential\n"
exit $exit_code
}
if { $exit_code == 0 } {
send_user "\nSUCCESS\n"
}
exit $exit_code
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment