diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-03-18 16:56:09 +0100 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-03-18 16:59:14 +0100 |
commit | 54641f5f761dff9f2392548f275e41953352796e (patch) | |
tree | feda805d300b1ed0f83b58c56ae7c6788a2199b7 /test | |
parent | 3853ef9b598b82115c1609957169614b26320a26 (diff) | |
download | podman-54641f5f761dff9f2392548f275e41953352796e.tar.gz podman-54641f5f761dff9f2392548f275e41953352796e.tar.bz2 podman-54641f5f761dff9f2392548f275e41953352796e.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>
Diffstat (limited to 'test')
-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" |