summaryrefslogtreecommitdiff
path: root/test/system
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/system
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/system')
-rw-r--r--test/system/035-logs.bats49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats
index ccf83df14..32282c8e1 100644
--- a/test/system/035-logs.bats
+++ b/test/system/035-logs.bats
@@ -24,6 +24,9 @@ load helpers
# test --since with Unix timestamps
run_podman logs --since 1000 $cid
+ # test --until with Unix timestamps
+ run_podman logs --until 1000 $cid
+
run_podman rm $cid
}
@@ -125,4 +128,50 @@ $s_after"
_log_test_since journald
}
+function _log_test_until() {
+ local driver=$1
+
+ s_before="before_$(random_string)_${driver}"
+ s_after="after_$(random_string)_${driver}"
+
+ before=$(date --iso-8601=seconds)
+ sleep 5
+ run_podman run --log-driver=$driver -d --name test $IMAGE sh -c \
+ "echo $s_before; trap 'echo $s_after; exit' SIGTERM; while :; do sleep 1; done"
+
+ # sleep a second to make sure the date is after the first echo
+ sleep 1
+ run_podman stop test
+ # sleep for 20 seconds to get the proper after time
+ sleep 20
+
+ run_podman logs test
+ is "$output" \
+ "$s_before
+$s_after"
+
+ run_podman logs --until $before test
+ is "$output" \
+ ""
+
+ after=$(date --iso-8601=seconds)
+
+ run_podman logs --until $after test
+ is "$output" \
+ "$s_before
+$s_after"
+ run_podman rm -f test
+}
+
+@test "podman logs - until k8s-file" {
+ _log_test_until k8s-file
+}
+
+@test "podman logs - until journald" {
+ # We can't use journald on RHEL as rootless: rhbz#1895105
+ skip_if_journald_unavailable
+
+ _log_test_until journald
+}
+
# vim: filetype=sh