diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-06-03 18:06:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-03 18:06:58 -0400 |
commit | 8c0e033f27562b3c228a370b4c2e324f4bb0590b (patch) | |
tree | 71d60af5e0f0571db1521bfd3c722dd219862f44 /test/e2e | |
parent | 81f228b20a1d634821d2ff4b009f351366641847 (diff) | |
parent | 2414586662b905e1d3c0cf21f3cc26e628e15bdd (diff) | |
download | podman-8c0e033f27562b3c228a370b4c2e324f4bb0590b.tar.gz podman-8c0e033f27562b3c228a370b4c2e324f4bb0590b.tar.bz2 podman-8c0e033f27562b3c228a370b4c2e324f4bb0590b.zip |
Merge pull request #14477 from Luap99/partial-logs
podman logs k8s-file: do not reassemble partial log lines
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/logs_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index 0d24a7e17..14dd6b6b8 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -8,6 +8,7 @@ import ( "time" . "github.com/containers/podman/v4/test/utils" + "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" @@ -370,6 +371,26 @@ var _ = Describe("Podman logs", func() { Expect(results.OutputToString()).To(Equal("stdout")) Expect(results.ErrorToString()).To(Equal("stderr")) }) + + It("podman logs partial log lines: "+log, func() { + skipIfJournaldInContainer() + + cname := "log-test" + content := stringid.GenerateNonCryptoID() + // use printf to print no extra newline + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", cname, ALPINE, "printf", content}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + // Important: do not use OutputToString(), this will remove the trailing newline from the output. + // However this test must make sure that there is no such extra newline. + Expect(string(logc.Out.Contents())).To(Equal(content)) + + logs := podmanTest.Podman([]string{"logs", cname}) + logs.WaitWithDefaultTimeout() + Expect(logs).To(Exit(0)) + // see comment above + Expect(string(logs.Out.Contents())).To(Equal(content)) + }) } It("using journald for container with container tag", func() { |