summaryrefslogtreecommitdiff
path: root/test/e2e/logs_test.go
diff options
context:
space:
mode:
authorcdoern <cdoern@redhat.com>2021-07-06 14:53:56 -0400
committercdoern <cdoern@redhat.com>2021-07-22 10:56:56 -0400
commit0f708efd8be843e06dd8a0ac68101a875a82c90e (patch)
treea1869f32538963daa6c4702115a82174ccf4eb85 /test/e2e/logs_test.go
parent4fb4614cf14a362c047b17612488fbdc0dc8e253 (diff)
downloadpodman-0f708efd8be843e06dd8a0ac68101a875a82c90e.tar.gz
podman-0f708efd8be843e06dd8a0ac68101a875a82c90e.tar.bz2
podman-0f708efd8be843e06dd8a0ac68101a875a82c90e.zip
Implemented --until flag for libpod's container logs
compat containers/logs was missing actual usage of until query param. This led me to implement the until param for libpod's container logs as well. Added e2e tests. Signed-off-by: cdoern <cdoern@redhat.com>
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()