Skip to content

Commit

Permalink
t/t2000-wreck: fix race condition in attach -n test
Browse files Browse the repository at this point in the history
Problem: test for `flux-wreck attach --no-follow` has a race
condition, since there is no synchronization between when task
output makes it to kvs, and the run of `attach --no-follow`.
We still want to ensure that attach can print output that has
already made it to the kvs, so we don't want to accept only
partial output as a sign of success.

Fix: retry the `attach --no-follow` in a loop until all data has
made it into kvs.

Fixes #1459
  • Loading branch information
grondo committed Apr 13, 2018
1 parent eb92f7b commit c9d222e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions t/t2000-wreck.t
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,24 @@ test_expect_success 'flux-wreck: attach --label-io' '
test_expect_success 'wreck: attach --no-follow works' '
flux wreckrun -d -l -n4 sh -c "echo before; sleep 30; echo after" &&
test_when_finished flux wreck kill $(last_job_id) &&
run_timeout 5 flux wreck attach --no-follow $(last_job_id) >output.attach-n &&
cat >expected.attach-n <<-EOF &&
before
before
before
before
EOF
test_cmp expected.attach-n output.attach-n
i=0 &&
while test $i -lt 3; do
run_timeout 5 \
flux wreck attach --no-follow $(last_job_id) >output.attach-n
test_cmp expected.attach-n output.attach-n
rc=$?
if test $rc = 0; then break; fi
# retry
i=$((i+1))
sleep 0.1
done &&
test $rc -eq 0
'
test_expect_success 'wreck: dumplog works' '
test_must_fail flux wreckrun --input=bad.file hostname &&
Expand Down

0 comments on commit c9d222e

Please sign in to comment.