mirror of
https://github.com/containers/podman.git
synced 2025-10-17 19:24:04 +08:00
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>
This commit is contained in:
@ -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"})
|
||||
|
Reference in New Issue
Block a user