@@ -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_
151149set output [run_command_output -fail "$scontrol show job $job_id"]
152150subtest {[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]} {
169165set output [run_command_output -fail "$scontrol show job $job_id"]
170166subtest {[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