summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorgcalin <caling@protonmail.com>2022-03-04 19:04:58 +0100
committergcalin <caling@protonmail.com>2022-03-29 17:29:13 +0200
commitc185d8c0d6774e90f64f4c6a84270c20a9325944 (patch)
treed6500e6d9d740cb9a60772b86cc01b4b00a33c38 /test
parent0eff4b70d0429c0dd1d95bc0a15f679cef351cb5 (diff)
downloadpodman-c185d8c0d6774e90f64f4c6a84270c20a9325944.tar.gz
podman-c185d8c0d6774e90f64f4c6a84270c20a9325944.tar.bz2
podman-c185d8c0d6774e90f64f4c6a84270c20a9325944.zip
Add option for pod logs to display different colors per container.
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com> Signed-off-by: gcalin <caling@protonmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/logs_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index cb795438d..934a306ce 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -443,4 +443,27 @@ var _ = Describe("Podman logs", func() {
Expect(output).To(ContainElement(ContainSubstring(containerName1)))
Expect(output).To(ContainElement(ContainSubstring(containerName2)))
})
+ It("podman pod logs with different colors", 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", "--color", podName})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ output := results.OutputToStringArray()
+ Expect(output).To(HaveLen(2))
+ Expect(output[0]).To(MatchRegexp(`\x1b\[3[0-9a-z ]+\x1b\[0m`))
+ Expect(output[1]).To(MatchRegexp(`\x1b\[3[0-9a-z ]+\x1b\[0m`))
+ })
})