diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-07-24 05:56:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-24 05:56:18 -0400 |
commit | d956500743829297b43a22e447017fe6319caed5 (patch) | |
tree | d457ce733c4050e4ebec1af156fc97516cec1e8a /test/e2e/logs_test.go | |
parent | c44c298ae7b5ce1da2aeff5b920de65767966007 (diff) | |
parent | 0f708efd8be843e06dd8a0ac68101a875a82c90e (diff) | |
download | podman-d956500743829297b43a22e447017fe6319caed5.tar.gz podman-d956500743829297b43a22e447017fe6319caed5.tar.bz2 podman-d956500743829297b43a22e447017fe6319caed5.zip |
Merge pull request #10996 from cdoern/untilLog
Implemented --until flag for Libpod's Container Logs
Diffstat (limited to 'test/e2e/logs_test.go')
-rw-r--r-- | test/e2e/logs_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index 507fab461..0a973b802 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -5,6 +5,7 @@ import ( "os" "os/exec" "strings" + "time" . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" @@ -135,6 +136,34 @@ var _ = Describe("Podman logs", func() { Expect(len(results.OutputToStringArray())).To(Equal(3)) }) + It("until duration 10m: "+log, func() { + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + results := podmanTest.Podman([]string{"logs", "--until", "10m", cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(0)) + }) + + It("until time NOW: "+log, func() { + + logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + cid := logc.OutputToString() + + now := time.Now() + now = now.Add(time.Minute * 1) + nowS := now.Format(time.RFC3339) + results := podmanTest.Podman([]string{"logs", "--until", nowS, cid}) + results.WaitWithDefaultTimeout() + Expect(results).To(Exit(0)) + Expect(len(results.OutputToStringArray())).To(Equal(3)) + }) + It("latest and container name should fail: "+log, func() { results := podmanTest.Podman([]string{"logs", "-l", "foobar"}) results.WaitWithDefaultTimeout() |