summaryrefslogtreecommitdiff
path: root/test/system/035-logs.bats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-14 21:33:40 +0200
committerGitHub <noreply@github.com>2022-09-14 21:33:40 +0200
commit9b6cb7e80f98df9725686d849ae9a5ca69858f4d (patch)
tree42ae57763f8f73f3a31cc64506ae3175d2c4b7da /test/system/035-logs.bats
parent5d1144062a534b9ec504ee2866cc90ecea16358d (diff)
parentd4a62ff9324b57f620a4cb03c8dcdae3a6540cb0 (diff)
downloadpodman-9b6cb7e80f98df9725686d849ae9a5ca69858f4d.tar.gz
podman-9b6cb7e80f98df9725686d849ae9a5ca69858f4d.tar.bz2
podman-9b6cb7e80f98df9725686d849ae9a5ca69858f4d.zip
Merge pull request #15794 from edsantiago/bats_races
System tests: fix three races
Diffstat (limited to 'test/system/035-logs.bats')
-rw-r--r--test/system/035-logs.bats23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats
index 6b8d5fbc5..6e84e10fc 100644
--- a/test/system/035-logs.bats
+++ b/test/system/035-logs.bats
@@ -36,13 +36,28 @@ function _log_test_tail() {
run_podman run -d --log-driver=$driver $IMAGE sh -c "echo test1; echo test2"
cid="$output"
- run_podman logs --tail 1 $cid
- is "$output" "test2" "logs should only show last line"
+ run_podman wait $cid
+ run_podman logs --tail 1 --timestamps $cid
+ log1="$output"
+ assert "$log1" =~ "^[0-9-]+T[0-9:.]+([\+-][0-9:]+|Z) test2" \
+ "logs should only show last line"
+
+ # Sigh. I hate doing this, but podman-remote --timestamp only has 1-second
+ # resolution (regular podman has sub-second). For the timestamps-differ
+ # check below, we need to force a different second.
+ if is_remote; then
+ sleep 2
+ fi
run_podman restart $cid
+ run_podman wait $cid
+
+ run_podman logs -t --tail 1 $cid
+ log2="$output"
+ assert "$log2" =~ "^[0-9-]+T[0-9:.]+([\+-][0-9:]+|Z) test2" \
+ "logs, after restart, shows only last line"
- run_podman logs --tail 1 $cid
- is "$output" "test2" "logs should only show last line after restart"
+ assert "$log2" != "$log1" "log timestamps should differ"
run_podman rm $cid
}