diff --git a/testsuite/expect/globals b/testsuite/expect/globals index 0493f7f8b5cfa2f8c3ff399fa9706ed7f883cc59..85b20c9b0757c848770dc8f2770414dae4dd20e2 100755 --- a/testsuite/expect/globals +++ b/testsuite/expect/globals @@ -822,6 +822,39 @@ proc test_account_storage { } { return $account_storage } +################################################################ +# +# Proc: test_using_slurmdbd +# +# Purpose: Since there is a lag at which the slurmdbd processes a job start +# we need to wait a bit to make sure the data has been set before proceeding. +# This is based upon +# the value of AccountingStorageType in the slurm.conf. +# +# Returns 1 if the system is running with slurmdbd, 0 otherwise +# +################################################################ + +proc test_using_slurmdbd { } { + global scontrol + + log_user 0 + set account_storage 0 + spawn $scontrol show config + expect { + -re "(accounting_storage/slurmdbd)" { + set account_storage 1 + exp_continue + } + eof { + wait + } + } + log_user 1 + + return $account_storage +} + ################################################################ # # Proc: priority_type diff --git a/testsuite/expect/test12.4 b/testsuite/expect/test12.4 index efc4c6eee7bb06506ada648cc2d6b3c7c06a3c8d..56f6a6e247ddf51dc797c409b115d0f4b69a8832 100755 --- a/testsuite/expect/test12.4 +++ b/testsuite/expect/test12.4 @@ -51,6 +51,9 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } { send_user "\nWARNING: This test can't be run without being an Accounting administrator.\nUse sacctmgr mod user \$USER_NAME set admin=admin.\n" exit 0 } + +set using_slurmdbd [test_using_slurmdbd] + set cluster [get_cluster_name] # # Identify the user and his current default account @@ -185,6 +188,12 @@ if {$job_id == 0} { set exit_code 1 } } + +if {$using_slurmdbd} { + sleep 30 +} + + ################################################################ # # Proc: sacct_job @@ -198,11 +207,12 @@ if {$job_id == 0} { ################################################################ proc sacct_job { soption job_id} { - global sacct + global sacct using_slurmdbd set debug 0 set exit_code 0 set matches 0 set not_support 0 + send_user "sacct -$soption -p -j $job_id\n" if { $soption == "-brief" || $soption == "b" } { diff --git a/testsuite/expect/test21.23 b/testsuite/expect/test21.23 index b8fd364ad6ca85e86c7c1cb3c07ee2761da36e3a..8cc5f50d45d1b552bc027661115df0654a783171 100755 --- a/testsuite/expect/test21.23 +++ b/testsuite/expect/test21.23 @@ -38,6 +38,7 @@ set file_in "test.$test_id.input" set test_acct "test_acct" set wk 21test set timeout 60 + print_header $test_id # @@ -57,6 +58,8 @@ if { [string compare [check_accounting_admin_level] "Administrator"] } { exit 0 } +set using_slurmdbd [test_using_slurmdbd] + set cn [get_cluster_name] # @@ -161,6 +164,10 @@ expect { } } +if {$using_slurmdbd} { + sleep 30 +} + spawn $sacct -j $job_id --fields=wckey expect { -re "$wk" { @@ -221,6 +228,10 @@ if {$job_id == 0} { wait } } + if {$using_slurmdbd} { + sleep 30 + } + spawn $sacct -j $job_id --fields=wckey expect { -re "$wk" { @@ -278,6 +289,11 @@ if {$job_id == 0} { wait } } + + if {$using_slurmdbd} { + sleep 30 + } + spawn $sacct -j $job_id --fields=wckey expect { -re "$wk" {