Skip to content
Snippets Groups Projects
Commit 70b9655e authored by Albert Gil's avatar Albert Gil
Browse files

Testsuite - Improve tets3.2 replacing spawn/expect with run_command


Bug 10810

Signed-off-by: default avatarScott Jackson <scottmo@schedmd.com>
parent 362d63f5
No related branches found
No related tags found
No related merge requests found
...@@ -76,35 +76,8 @@ proc check_part_down { part_name } { ...@@ -76,35 +76,8 @@ proc check_part_down { part_name } {
# #
# Identify a partition and its state # Identify a partition and its state
# #
spawn $scontrol show part set part_name [default_partition]
expect { set part_old_state [get_partition_param $part_name "State"]
-re "PartitionName=($re_word_str)" {
if {[string compare $part_name ""] == 0} {
set part_name $expect_out(1,string)
}
exp_continue
}
timeout {
fail "scontrol not responding"
}
eof {
wait
}
}
spawn $scontrol show part $part_name
expect {
-re "State=($re_word_str) " {
set part_old_state $expect_out(1,string)
exp_continue
}
timeout {
fail "scontrol not responding"
}
eof {
wait
}
}
# #
# Validate current partition information # Validate current partition information
...@@ -137,32 +110,8 @@ if {$job_runnable == 0} { ...@@ -137,32 +110,8 @@ if {$job_runnable == 0} {
# #
# Change that partition's state # Change that partition's state
# #
spawn $scontrol update PartitionName=$part_name State=$part_new_state run_command -fail "$scontrol update PartitionName=$part_name State=$part_new_state"
expect { set read_state [get_partition_param $part_name "State"]
timeout {
fail "scontrol not responding"
}
eof {
wait
}
}
#
# Validate partition's new state
#
spawn $scontrol show partition $part_name
expect {
-re "State=($re_word_str) " {
set read_state $expect_out(1,string)
exp_continue
}
timeout {
fail "scontrol not responding"
}
eof {
wait
}
}
subtest {[string compare $read_state $part_new_state] == 0} "scontrol should be able to change the partition state" subtest {[string compare $read_state $part_new_state] == 0} "scontrol should be able to change the partition state"
# #
...@@ -175,37 +124,6 @@ if {$job_runnable == 1} { ...@@ -175,37 +124,6 @@ if {$job_runnable == 1} {
# #
# Return that partition's state to its old value # Return that partition's state to its old value
# #
spawn $scontrol update PartitionName=$part_name State=$part_old_state run_command -fail "$scontrol update PartitionName=$part_name State=$part_old_state"
expect { set read_state [get_partition_param $part_name "State"]
-re "slurm_update error: Invalid user id" {
exp_continue
}
-re "slurm_update error:" {
log_error "scontrol update error"
exp_continue
}
timeout {
fail "scontrol not responding"
}
eof {
wait
}
}
#
# Record that partition's state
#
spawn $scontrol show partition $part_name
expect {
-re "State=($re_word_str) " {
set read_state $expect_out(1,string)
exp_continue
}
timeout {
fail "scontrol not responding"
}
eof {
wait
}
}
subtest {[string compare $read_state $part_old_state] == 0} "scontrol should be able to change the partition state" subtest {[string compare $read_state $part_old_state] == 0} "scontrol should be able to change the partition state"
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