Skip to content

Commit

Permalink
Merge pull request containers#13593 from Luap99/compose-flakev2
Browse files Browse the repository at this point in the history
fix compose test error in retry logic
  • Loading branch information
openshift-merge-robot authored Mar 22, 2022
2 parents 5cb827f + c25213c commit c840f64
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/compose/slirp4netns_opts/tests.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# -*- bash -*-

output="$(cat $OUTFILE)"
expected="teststring"

# Reading from the nc socket is flaky because docker-compose only starts
# the containers. We cannot know at this point if the container did already
# send the message. Give the container 5 seconds time to send the message
# to prevent flakes.
local _timeout=5
while [ $_timeout -gt 0 ]; do
container_timeout=5
while [ $container_timeout -gt 0 ]; do
output="$(< $OUTFILE)"
if [ -n "$output" ]; then
break
fi
sleep 1
_timeout=$(($_timeout - 1))
output="$(cat $OUTFILE)"
container_timeout=$(($container_timeout - 1))
done

is "$output" "$expected" "$testname : nc received teststring"

0 comments on commit c840f64

Please sign in to comment.