summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorXueyuan Chen <x.chen-47@student.tudelft.nl>2022-02-26 23:07:25 +0100
committerXueyuan Chen <X.Chen-47@student.tudelft.nl>2022-03-01 00:18:39 +0100
commit40c6192e9e3da7f2f3f54365c89b4b837ed74fd8 (patch)
treeb3e4505fbcac2d9e9f2ec99bf4401d56483f7546 /test/e2e
parentc39dffe83db9fa3cfa6897b971956821f1bbcce2 (diff)
downloadpodman-40c6192e9e3da7f2f3f54365c89b4b837ed74fd8.tar.gz
podman-40c6192e9e3da7f2f3f54365c89b4b837ed74fd8.tar.bz2
podman-40c6192e9e3da7f2f3f54365c89b4b837ed74fd8.zip
Add the names flag for pod logs
Fixes containers#13261 Signed-off-by: Xueyuan Chen <X.Chen-47@student.tudelft.nl>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/logs_test.go33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index 7c0fcc8ee..cb795438d 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -37,7 +37,9 @@ var _ = Describe("Podman logs", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
- podmanTest.SeedImages()
+ if err := podmanTest.SeedImages(); err != nil {
+ os.Exit(1)
+ }
})
AfterEach(func() {
@@ -412,4 +414,33 @@ var _ = Describe("Podman logs", func() {
logs.WaitWithDefaultTimeout()
Expect(logs).To(Not(Exit(0)))
})
+
+ It("podman pod logs with container names", func() {
+ SkipIfRemote("Remote can only process one container at a time")
+ SkipIfInContainer("journalctl inside a container doesn't work correctly")
+ 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", "--name", containerName1, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log1"})
+ log1.WaitWithDefaultTimeout()
+ Expect(log1).To(Exit(0))
+
+ log2 := podmanTest.Podman([]string{"run", "--name", containerName2, "-d", "--pod", podName, BB, "/bin/sh", "-c", "echo log2"})
+ log2.WaitWithDefaultTimeout()
+ Expect(log2).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"pod", "logs", "--names", podName})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+
+ output := results.OutputToStringArray()
+ Expect(output).To(HaveLen(2))
+ Expect(output).To(ContainElement(ContainSubstring(containerName1)))
+ Expect(output).To(ContainElement(ContainSubstring(containerName2)))
+ })
})