Skip to content
Snippets Groups Projects
Commit f289b799 authored by Joseph P. Donaghy's avatar Joseph P. Donaghy
Browse files

Refined test to only add a cluster, but with all available options.

parent e8014a2d
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/expect #!/usr/bin/expect
############################################################################ ############################################################################
# Purpose: Test of SLURM functionality # Purpose: Test of SLURM functionality
# sacctmgr add, list, and delete a cluster # sacctmgr add a cluster
# #
# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR # Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR
# "FAILURE: ..." otherwise with an explanation of the failure, OR # "FAILURE: ..." otherwise with an explanation of the failure, OR
...@@ -33,16 +33,28 @@ source ./globals ...@@ -33,16 +33,28 @@ source ./globals
set test_id "21.5" set test_id "21.5"
set exit_code 0 set exit_code 0
set amatches 0 set amatches 0
set lmatches 0 set lmatches 0
set dmatches 0 set dmatches 0
set not_support 0 set not_support 0
set add add set add add
set lis list set lis list
set del delete set del delete
set mod modify set mod modify
set nams Names
set nam Name
set fs Fairshare
set mc MaxCPUSecs
set mj MaxJobs
set mn MaxNodes
set mw MaxWall
set clu cluster set clu cluster
set tc1 tCluster1 set tc1 tCluster1
set fs1 2500
set mc1 1000000
set mj1 50
set mn1 300
set mw1 01:00:00
print_header $test_id print_header $test_id
...@@ -50,57 +62,52 @@ print_header $test_id ...@@ -50,57 +62,52 @@ print_header $test_id
# #
# Use sacctmgr to create a cluster # Use sacctmgr to create a cluster
# #
set sadd_pid [spawn $sacctmgr $add $clu $tc1] set sadd_pid [spawn $sacctmgr $add $clu $nams=$tc1 $fs=$fs1 $mc=$mc1 $mj=$mj1 $mn=$mn1 $mw=$mw1]
expect { expect {
-re "Adding Cluster" { -re "Adding Cluster" {
incr amatches incr amatches
exp_continue exp_continue
} }
-re "Name *= $tc1" { -re "$nam *= $tc1" {
incr amatches incr amatches
exp_continue exp_continue
} }
-re "Would you like to commit changes\\\? \\\(You have 30 seconds to decide\\\)" { -re "User Defaults" {
incr amatches incr amatches
exp_continue exp_continue
} }
-re "\\\(N\\\/y\\\):" { -re "$fs *= $fs1" {
incr amatches incr amatches
send "Y\r"
exp_continue exp_continue
} }
timeout { -re "$mc *= $mc1" {
send_user "\nFAILURE: sacctmgr add not responding\n" incr amatches
slow_kill $sadd_pid exp_continue
set exit_code 1
} }
eof { -re "$mj *= $mj1" {
wait incr amatches
exp_continue
} }
} -re "$mn *= $mn1" {
incr amatches
if {$amatches != 4} {
send_user "\nFAILURE: sacctmgr had a problem adding clusters\n"
set exit_code 1
}
#
# Use sacctmgr to list the addition of cluster
#
set slist_pid [spawn $sacctmgr $lis $clu $tc1]
expect {
-re "Name" {
incr lmatches
exp_continue exp_continue
} }
-re "$tc1" { -re "$mw *= $mw1" {
incr lmatches incr amatches
exp_continue
}
-re "Would you like to commit changes\\\? \\\(You have 30 seconds to decide\\\)" {
incr amatches
exp_continue
}
-re "\\\(N\\\/y\\\):" {
incr amatches
send "Y\r"
exp_continue exp_continue
send_user "\nFound $tc1 in database\n"
} }
timeout { timeout {
send_user "\nFAILURE: sacctmgr list not responding\n" send_user "\nFAILURE: sacctmgr add not responding\n"
slow_kill $slist_pid slow_kill $sadd_pid
set exit_code 1 set exit_code 1
} }
eof { eof {
...@@ -108,8 +115,8 @@ expect { ...@@ -108,8 +115,8 @@ expect {
} }
} }
if {$lmatches != 2} { if {$amatches != 10} {
send_user "\nFAILURE: sacctmgr had a problem listing clusters\n" send_user "\nFAILURE: sacctmgr had a problem adding clusters\n"
set exit_code 1 set exit_code 1
} }
......
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