Skip to content

Commit 4575335

Browse files
committed
Testsuite - Improve test21.23 avoiding arbitrary sleeps
This makes the test faster in faster systems, and safer in busy ones.
1 parent ae2d9cf commit 4575335

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

‎testsuite/expect/test21.23‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,11 @@ if {$matches != 1} {
135135
fail "salloc failed to use desired wckey"
136136
}
137137

138-
if {$accounting_storage_type eq "accounting_storage/slurmdbd"} {
139-
sleep 5
138+
set output ""
139+
wait_for -subtest {[regexp "$wk" $output]} {
140+
set output [run_command_output -fail "$sacct -p -j $job_id --format=wckey"]
140141
}
141142

142-
set output [run_command_output -fail "$sacct -p -j $job_id --format=wckey"]
143-
subtest {[regexp "$wk" $output]} "Verify WCKey in sacct"
144-
145143
#
146144
# Spawn a job via sbatch using this wckey
147145
#
@@ -151,13 +149,11 @@ set job_id [submit_job -fail "-N1 --account=$ta --wckey=$wk --output=none $file_
151149
set output [run_command_output -fail "$scontrol show job $job_id"]
152150
subtest {[regexp "WCKey=$wk" $output]} "Verify WCKey in scontrol"
153151

154-
if {$accounting_storage_type eq "accounting_storage/slurmdbd"} {
155-
sleep 5
152+
set output ""
153+
wait_for -subtest {[regexp "$wk" $output]} {
154+
set output [run_command_output -fail "$sacct -p -j $job_id --format=wckey"]
156155
}
157156

158-
set output [run_command_output -fail "$sacct -p -j $job_id --format=wckey"]
159-
subtest {[regexp "$wk" $output]} "Verify WCKey in sacct"
160-
161157
#
162158
# Spawn a job via srun using this wckey
163159
#
@@ -169,13 +165,11 @@ if {![regexp "launching StepId=($number)\\.$re_word_str" $output - job_id]} {
169165
set output [run_command_output -fail "$scontrol show job $job_id"]
170166
subtest {[regexp "WCKey=$wk" $output]} "Verify WCKey in scontrol"
171167

172-
if {$accounting_storage_type eq "accounting_storage/slurmdbd"} {
173-
sleep 5
168+
set output ""
169+
wait_for -subtest {[regexp "$wk" $output]} {
170+
set output [run_command_output -fail "$sacct -p -j $job_id --format=wckey"]
174171
}
175172

176-
set output [run_command_output -fail "$sacct -p -j $job_id --format=wckey"]
177-
subtest {[regexp "$wk" $output]} "Verify WCKey in sacct"
178-
179173
#
180174
# Add more test WCKeys the user
181175
#

0 commit comments

Comments
 (0)