aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-06-24 05:47:10 -0400
committerGitHub <noreply@github.com>2021-06-24 05:47:10 -0400
commitda33fc45b6628c1ac1a16e49790be2b4fbf502a5 (patch)
treed353296c94d74bd2dc3d445ad46de4c6df769037 /test
parent63626e9b583da3929e8ed1020deed97c14bd2206 (diff)
parentf2dff41dbc95812b4fa9f36279e6daf6999e4452 (diff)
downloadpodman-da33fc45b6628c1ac1a16e49790be2b4fbf502a5.tar.gz
podman-da33fc45b6628c1ac1a16e49790be2b4fbf502a5.tar.bz2
podman-da33fc45b6628c1ac1a16e49790be2b4fbf502a5.zip
Merge pull request #10583 from rhatdan/log
Support log_tag defaults from containers.conf
Diffstat (limited to 'test')
-rw-r--r--test/e2e/config/containers-journald.conf4
-rw-r--r--test/e2e/containers_conf_test.go30
2 files changed, 28 insertions, 6 deletions
diff --git a/test/e2e/config/containers-journald.conf b/test/e2e/config/containers-journald.conf
new file mode 100644
index 000000000..463f9a9fa
--- /dev/null
+++ b/test/e2e/config/containers-journald.conf
@@ -0,0 +1,4 @@
+[containers]
+
+log_driver="journald"
+log_tag="{{.ImageName}}"
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index a354de3b2..054454798 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -167,16 +167,34 @@ var _ = Describe("Podman run", func() {
verifyNSHandling("/proc/self/ns/cgroup", "--cgroupns")
})
+ It("using journald for container with container log_tag", func() {
+ SkipIfInContainer("journalctl inside a container doesn't work correctly")
+ os.Setenv("CONTAINERS_CONF", "config/containers-journald.conf")
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
+ logc := podmanTest.Podman([]string{"run", "-d", 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", cid})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait.ExitCode()).To(Equal(0))
+
+ cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_TAG", fmt.Sprintf("CONTAINER_ID_FULL=%s", cid))
+ out, err := cmd.CombinedOutput()
+ Expect(err).To(BeNil())
+ Expect(string(out)).To(ContainSubstring("alpine"))
+ })
+
It("podman containers.conf additionalvolumes", func() {
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
tempdir, err = CreateTempDirInTempDir()
- if err != nil {
- os.Exit(1)
- }
+ Expect(err).To(BeNil())
+
err := ioutil.WriteFile(conffile, []byte(fmt.Sprintf("[containers]\nvolumes=[\"%s:%s:Z\",]\n", tempdir, tempdir)), 0755)
- if err != nil {
- os.Exit(1)
- }
+ Expect(err).To(BeNil())
os.Setenv("CONTAINERS_CONF", conffile)
if IsRemote() {