diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-06-01 15:24:32 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-06-01 16:49:10 +0200 |
commit | 78d1f5d7d62b79f36b5910935acd195d723efb48 (patch) | |
tree | b8385f945bf7f809a62d7b3127db735b67537636 | |
parent | 70ce77e8d0aab41918b54b2547c902a5463cf798 (diff) | |
download | podman-78d1f5d7d62b79f36b5910935acd195d723efb48.tar.gz podman-78d1f5d7d62b79f36b5910935acd195d723efb48.tar.bz2 podman-78d1f5d7d62b79f36b5910935acd195d723efb48.zip |
fix "tail 800 lines: journald" flake
The test calls podman run -d followed by podman logs. There is no
guarantee the the container or conmon has written all its output.
Adding an extra podman wait should fix this.
Do not remove the -d to not print 1000 unnecessary lines in the logs.
Fixes #14362
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r-- | test/e2e/logs_test.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index 4e6dcb8af..0d24a7e17 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -102,12 +102,12 @@ var _ = Describe("Podman logs", func() { It("tail 99 lines: "+log, func() { skipIfJournaldInContainer() - logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + name := "test1" + logc := podmanTest.Podman([]string{"run", "--name", name, "--log-driver", log, ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) logc.WaitWithDefaultTimeout() Expect(logc).To(Exit(0)) - cid := logc.OutputToString() - results := podmanTest.Podman([]string{"logs", "--tail", "99", cid}) + results := podmanTest.Podman([]string{"logs", "--tail", "99", name}) results.WaitWithDefaultTimeout() Expect(results).To(Exit(0)) Expect(results.OutputToStringArray()).To(HaveLen(3)) @@ -116,11 +116,17 @@ var _ = Describe("Podman logs", func() { It("tail 800 lines: "+log, func() { skipIfJournaldInContainer() + // this uses -d so that we do not have 1000 unnecessary lines printed in every test log logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "i=1; while [ \"$i\" -ne 1000 ]; do echo \"line $i\"; i=$((i + 1)); done"}) logc.WaitWithDefaultTimeout() Expect(logc).To(Exit(0)) cid := logc.OutputToString() + // make sure we wait for the container to finish writing its output + wait := podmanTest.Podman([]string{"wait", cid}) + wait.WaitWithDefaultTimeout() + Expect(wait).To(Exit(0)) + results := podmanTest.Podman([]string{"logs", "--tail", "800", cid}) results.WaitWithDefaultTimeout() Expect(results).To(Exit(0)) |