summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJake Correnti <jcorrenti13@gmail.com>2022-09-14 19:08:05 -0400
committerJake Correnti <jcorrenti13@gmail.com>2022-09-29 08:56:02 -0400
commit6f821f03d9e3f7a2e361177d2b301b16b2ea4866 (patch)
treea7be37e7ee131b865bd5204d06dc5377b1ce7ed1 /test
parent4e14fa05c9e6ce2ad927e953057294ae05748b37 (diff)
downloadpodman-6f821f03d9e3f7a2e361177d2b301b16b2ea4866.tar.gz
podman-6f821f03d9e3f7a2e361177d2b301b16b2ea4866.tar.bz2
podman-6f821f03d9e3f7a2e361177d2b301b16b2ea4866.zip
`podman pod logs -l` no longer panics
Fixed issue where executing the command `podman pod logs -l` would panic because it was indexing into an empty arguments array. Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/logs_test.go73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index c680cae2a..93ef54c3a 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -391,6 +391,78 @@ var _ = Describe("Podman logs", func() {
// see comment above
Expect(string(logs.Out.Contents())).To(Equal(content))
})
+
+ It("podman pod logs -l with newer container created: "+log, func() {
+ skipIfJournaldInContainer()
+
+ podName := "testPod"
+ containerName1 := "container1"
+ containerName2 := "container2"
+ containerName3 := "container3"
+
+ testPod := podmanTest.Podman([]string{"pod", "create", fmt.Sprintf("--name=%s", podName)})
+ testPod.WaitWithDefaultTimeout()
+ Expect(testPod).To(Exit(0))
+
+ log1 := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName1, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log1"})
+ log1.WaitWithDefaultTimeout()
+ Expect(log1).To(Exit(0))
+
+ log2 := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName2, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log2"})
+ log2.WaitWithDefaultTimeout()
+ Expect(log2).To(Exit(0))
+
+ ctr := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName3, "-d", BB, "date"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"pod", "logs", "-l"})
+ results.WaitWithDefaultTimeout()
+ if IsRemote() {
+ Expect(results).To(Exit(125))
+ } else {
+ Expect(results).To(Exit(0))
+ podOutput := results.OutputToString()
+
+ results = podmanTest.Podman([]string{"logs", "-l"})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ ctrOutput := results.OutputToString()
+
+ Expect(podOutput).ToNot(Equal(ctrOutput))
+ }
+ })
+
+ It("podman pod logs -l: "+log, func() {
+ skipIfJournaldInContainer()
+
+ podName := "testPod"
+ containerName1 := "container1"
+ containerName2 := "container2"
+
+ testPod := podmanTest.Podman([]string{"pod", "create", fmt.Sprintf("--name=%s", podName)})
+ testPod.WaitWithDefaultTimeout()
+ Expect(testPod).To(Exit(0))
+
+ log1 := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName1, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log1"})
+ log1.WaitWithDefaultTimeout()
+ Expect(log1).To(Exit(0))
+
+ log2 := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", containerName2, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log2"})
+ log2.WaitWithDefaultTimeout()
+ Expect(log2).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"pod", "logs", "-l"})
+ results.WaitWithDefaultTimeout()
+ if IsRemote() {
+ Expect(results).To(Exit(125))
+ } else {
+ Expect(results).To(Exit(0))
+ output := results.OutputToString()
+ Expect(output).To(ContainSubstring("log1"))
+ Expect(output).To(ContainSubstring("log2"))
+ }
+ })
}
It("using journald for container with container tag", func() {
@@ -490,4 +562,5 @@ var _ = Describe("Podman logs", func() {
Expect(output[0]).To(MatchRegexp(`\x1b\[3[0-9a-z ]+\x1b\[0m`))
Expect(output[1]).To(MatchRegexp(`\x1b\[3[0-9a-z ]+\x1b\[0m`))
})
+
})