diff options
author | Kir Kolyshkin <kolyshkin@gmail.com> | 2022-01-04 17:07:14 -0800 |
---|---|---|
committer | Kir Kolyshkin <kolyshkin@gmail.com> | 2022-01-04 17:45:34 -0800 |
commit | 79c5b73ed78b3ccfd0e790b5b5195e55f790226b (patch) | |
tree | aa17df86740a5c203fa848afe89faa1fd047533c /test/e2e | |
parent | cf7fc36953dab023227bebb209a179de8827096a (diff) | |
download | podman-79c5b73ed78b3ccfd0e790b5b5195e55f790226b.tar.gz podman-79c5b73ed78b3ccfd0e790b5b5195e55f790226b.tar.bz2 podman-79c5b73ed78b3ccfd0e790b5b5195e55f790226b.zip |
test/e2e/pod_initcontainers: fix a flake
Commit 3c3fa6fac4d0f8e8 added a few test cases for the init containers.
The "podman ensure always init containers always run" implicitly assumes
that restarting a pod will take more than 1 second. When this assumption
is not met (because computers are fast!), we get a flake.
The fix (without using sleep) is to print nanoseconds in date output.
This format option (%N) is not supported by date in Alpine Linux, so
switch to Fedora.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/pod_initcontainers_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/e2e/pod_initcontainers_test.go b/test/e2e/pod_initcontainers_test.go index 11e7ca400..e73f28a7a 100644 --- a/test/e2e/pod_initcontainers_test.go +++ b/test/e2e/pod_initcontainers_test.go @@ -135,7 +135,7 @@ var _ = Describe("Podman init containers", func() { filename := filepath.Join("/dev/shm", RandomString(12)) // Write the date to a file - session := podmanTest.Podman([]string{"create", "--init-ctr", "always", "--pod", "new:foobar", ALPINE, "bin/sh", "-c", fmt.Sprintf("date > %s", filename)}) + session := podmanTest.Podman([]string{"create", "--init-ctr", "always", "--pod", "new:foobar", fedoraMinimal, "bin/sh", "-c", "date +%T.%N > " + filename}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) verify := podmanTest.Podman([]string{"create", "--pod", "foobar", "-t", ALPINE, "top"}) |