mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00
Merge pull request #14443 from Luap99/tail-logs-flake
fix "tail 800 lines: journald" flake
This commit is contained in:
@ -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))
|
||||
|
Reference in New Issue
Block a user