diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-06-01 12:20:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-01 12:20:17 -0400 |
commit | f5389dbb44d8d83c3af08b3b183c8e7805c99d88 (patch) | |
tree | df076ca93a2dbed1200720f44de5236c1629d464 | |
parent | 2039445763f418720b08983b40949480e8754f9a (diff) | |
parent | 78d1f5d7d62b79f36b5910935acd195d723efb48 (diff) | |
download | podman-f5389dbb44d8d83c3af08b3b183c8e7805c99d88.tar.gz podman-f5389dbb44d8d83c3af08b3b183c8e7805c99d88.tar.bz2 podman-f5389dbb44d8d83c3af08b3b183c8e7805c99d88.zip |
Merge pull request #14443 from Luap99/tail-logs-flake
fix "tail 800 lines: journald" flake
-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)) |