Skip to content

Commit 24df7a5

Browse files
committed
testsuite: improve flux resource eventlog -F test
Problem: The test for `flux resource eventlog -F` doesn't check that the command actually waited for the drain event. There is also a race between launching the command in the background and draining a rank where the resource.journal RPC could come after the drain RPC, thus the command doesn't actually have to follow the eventlog. Ensure that the RPC is established before moving on to drain a rank by waiting for output to appear. Check that the drain event is the final event in the output file.
1 parent 9029a38 commit 24df7a5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

t/t2355-resource-journal.t

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,21 @@ test_expect_success 'that event WAS posted to the KVS' '
119119
test $(grep resource-define kvs2 | wc -l) -eq 2
120120
'
121121
test_expect_success NO_CHAIN_LINT 'watch eventlog in the background waiting on drain' '
122-
flux resource eventlog -F --wait=drain >bgeventlog &
123-
echo $! >bgpid
122+
flux resource eventlog -HF --wait=drain >bgeventlog &
123+
echo $! >bgpid &&
124+
# ensure RPC is established before moving on
125+
waitfile.lua -vt 15 bgeventlog
124126
'
125127
test_expect_success NO_CHAIN_LINT 'drain rank 1' '
126128
flux resource drain 1
127129
'
128130
test_expect_success NO_CHAIN_LINT 'background watcher completed successfully' '
129131
wait $(cat bgpid)
130132
'
131-
133+
test_expect_success NO_CHAIN_LINT 'background watcher waited for drain event' '
134+
test_debug "cat bgeventlog" &&
135+
tail -1 bgeventlog | grep drain
136+
'
132137
test_expect_success 'run restartable flux instance, drain 0' '
133138
flux start --setattr=statedir=$(pwd) \
134139
sh -c "flux resource eventlog --wait=resource-define \

0 commit comments

Comments
 (0)