summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2020-05-20 09:48:16 -0400
committerPeter Hunt <pehunt@redhat.com>2020-05-20 10:07:54 -0400
commit92acb3676c53d26cbad71e079f96c32a29a148da (patch)
treeb8faf5ea7ab4d203251986d9f92f58524e0c30cc /test/e2e
parent4eee0d840f0af81560d89864ea64b95c9e70b18d (diff)
downloadpodman-92acb3676c53d26cbad71e079f96c32a29a148da.tar.gz
podman-92acb3676c53d26cbad71e079f96c32a29a148da.tar.bz2
podman-92acb3676c53d26cbad71e079f96c32a29a148da.zip
oci conmon: tell conmon to log container name
specifying `-n=ctr-name` tells conmon to log CONTAINER_NAME=name if the log driver is journald add this, and a test! also, refactor the args slice creation to not append() unnecessarily. Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/logs_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index 8417051f0..1ff53300a 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -173,6 +173,24 @@ var _ = Describe("Podman logs", func() {
Expect(string(out)).To(ContainSubstring("alpine"))
})
+ It("podman journald logs for container name", func() {
+ Skip("need to verify images have correct packages for journald")
+ containerName := "inside-journal"
+ logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-d", "--name", containerName, ALPINE, "sh", "-c", "echo podman; sleep 0.1; echo podman; sleep 0.1; echo podman"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc.ExitCode()).To(Equal(0))
+ cid := logc.OutputToString()
+
+ wait := podmanTest.Podman([]string{"wait", "-l"})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait.ExitCode()).To(BeZero())
+
+ cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_NAME", "-u", fmt.Sprintf("libpod-conmon-%s.scope", cid))
+ out, err := cmd.CombinedOutput()
+ Expect(err).To(BeNil())
+ Expect(string(out)).To(ContainSubstring(containerName))
+ })
+
It("podman journald logs for container", func() {
Skip("need to verify images have correct packages for journald")
logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})