summaryrefslogtreecommitdiff
path: root/test/e2e/logs_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-24 05:56:18 -0400
committerGitHub <noreply@github.com>2021-07-24 05:56:18 -0400
commitd956500743829297b43a22e447017fe6319caed5 (patch)
treed457ce733c4050e4ebec1af156fc97516cec1e8a /test/e2e/logs_test.go
parentc44c298ae7b5ce1da2aeff5b920de65767966007 (diff)
parent0f708efd8be843e06dd8a0ac68101a875a82c90e (diff)
downloadpodman-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.go29
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()