diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-28 09:02:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-28 09:02:14 -0400 |
commit | 7a748f028ccd175418b07c90ce05281eba899d2f (patch) | |
tree | e7fb174e509f722f76df53bc332f846e2ef0eb52 /test/system/035-logs.bats | |
parent | f2ffb96eb317012e94258a242f6dc907acd22c40 (diff) | |
parent | 86083c580b101ba1fa580c574c66bcb25be20d7f (diff) | |
download | podman-7a748f028ccd175418b07c90ce05281eba899d2f.tar.gz podman-7a748f028ccd175418b07c90ce05281eba899d2f.tar.bz2 podman-7a748f028ccd175418b07c90ce05281eba899d2f.zip |
Merge pull request #11762 from edsantiago/bats
System tests: speed up. They've gotten too slow.
Diffstat (limited to 'test/system/035-logs.bats')
-rw-r--r-- | test/system/035-logs.bats | 31 |
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 } |