summaryrefslogtreecommitdiff
path: root/test/system/035-logs.bats
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2021-09-27 11:36:31 -0600
committerMatthew Heon <matthew.heon@pm.me>2021-09-29 16:39:29 -0400
commitddc2b9bbef9480f7e9e1f2d12ec4c9d46d52ffaa (patch)
tree8af350a6077d51d754d1749dfd9ed87e5c9025b9 /test/system/035-logs.bats
parentb3af5a92cc710724471285fe3aa06205323a3c24 (diff)
downloadpodman-ddc2b9bbef9480f7e9e1f2d12ec4c9d46d52ffaa.tar.gz
podman-ddc2b9bbef9480f7e9e1f2d12ec4c9d46d52ffaa.tar.bz2
podman-ddc2b9bbef9480f7e9e1f2d12ec4c9d46d52ffaa.zip
System tests: speed up. They've gotten too slow.
- logs: remove unnecessary sleeps. This saves ~25s. Unfortunately, journald seems to have some sort of lag, so we need to keep retrying until we get the 'after' string. - ps: add placeholder test for once buildah 3544 is fixed - cp: bulk-kill containers when finished, instead of one by one. This is a big change and only saves about 8s per run, but hey. - mount,pause,healthcheck: 'podman stop -t 0' before rm'ing containers. Easy 50s. Have I mentioned, lately, that 'podman rm -f' needs a '-t 0' flag? - play: same, and also 'podman pod stop'. Seems to shave ~20s. - socket-activation: UGH! Buggy and useless tests! They were running "sleep 90" containers for no reason whatsoever. I assume the intention was to run them with "-d", so that's what I've done here. Also fixed some language. 180 seconds! (Unrelated: cleanup in 070-build, use $IMAGE, not alpine) Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/035-logs.bats')
-rw-r--r--test/system/035-logs.bats31
1 files changed, 19 insertions, 12 deletions
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats
index a04d2ac74..76ce12b81 100644
--- a/test/system/035-logs.bats
+++ b/test/system/035-logs.bats
@@ -135,31 +135,38 @@ function _log_test_until() {
s_after="after_$(random_string)_${driver}"
before=$(date --iso-8601=seconds)
- sleep 5
+ sleep 1
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 wait test
- run_podman logs test
- is "$output" \
- "$s_before
+ # Sigh. Stupid journald has a lag. Wait a few seconds for it to catch up.
+ retries=20
+ s_both="$s_before
$s_after"
+ while [[ $retries -gt 0 ]]; do
+ run_podman logs test
+ if [[ "$output" = "$s_both" ]]; then
+ break
+ fi
+ retries=$((retries - 1))
+ sleep 0.1
+ done
+ if [[ $retries -eq 0 ]]; then
+ die "Timed out waiting for before&after in podman logs: $output"
+ fi
run_podman logs --until $before test
- is "$output" \
- ""
+ is "$output" "" "podman logs --until before"
- after=$(date --iso-8601=seconds)
+ after=$(date --date='+1 second' --iso-8601=seconds)
run_podman logs --until $after test
- is "$output" \
- "$s_before
-$s_after"
+ is "$output" "$s_both" "podman logs --until after"
run_podman rm -f test
}