diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-03-18 16:56:09 +0100 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2022-03-30 15:36:04 -0400 |
commit | f131c0b240bb313e5a906e0d69b0eb6a5f35cbcf (patch) | |
tree | a0fd4e4c90b02dadf6308fbf5606c58c4a4dcc18 | |
parent | b33a4671db9422145a3c0578756441634d42d6f8 (diff) | |
download | podman-f131c0b240bb313e5a906e0d69b0eb6a5f35cbcf.tar.gz podman-f131c0b240bb313e5a906e0d69b0eb6a5f35cbcf.tar.bz2 podman-f131c0b240bb313e5a906e0d69b0eb6a5f35cbcf.zip |
fix compose test flake
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.
This happened rarely with compose v1 but it looks like it will happen a
lot more with compose v2.
Example failure log:
https://storage.googleapis.com/cirrus-ci-6707778565701632-fcae48/artifacts/containers/podman/6567556239589376/html/compose_v2-podman-fedora-35-rootless-host.log.html
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r-- | test/compose/slirp4netns_opts/tests.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/compose/slirp4netns_opts/tests.sh b/test/compose/slirp4netns_opts/tests.sh index 1efce45c4..cfa84e1e4 100644 --- a/test/compose/slirp4netns_opts/tests.sh +++ b/test/compose/slirp4netns_opts/tests.sh @@ -3,4 +3,18 @@ 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 + if [ -n "$output" ]; then + break + fi + sleep 1 + _timeout=$(($_timeout - 1)) + output="$(cat $OUTFILE)" +done + is "$output" "$expected" "$testname : nc received teststring" |