summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-14 09:14:51 -0400
committerGitHub <noreply@github.com>2021-04-14 09:14:51 -0400
commit96ad84fd5a7648b55556043dc4d251e9c6be1819 (patch)
tree21e8b08086df87fdca14e76a87f62b15eca80f4e
parentdefb29b72c5f0b7047f6a82c06ba24629643565a (diff)
parent31e31aa9dd59668d3dee1569111ac0a793c68a61 (diff)
downloadpodman-96ad84fd5a7648b55556043dc4d251e9c6be1819.tar.gz
podman-96ad84fd5a7648b55556043dc4d251e9c6be1819.tar.bz2
podman-96ad84fd5a7648b55556043dc4d251e9c6be1819.zip
Merge pull request #10017 from edsantiago/compose_test_flakes_again
compose test: try to get useful data from flakes
-rwxr-xr-xcontrib/cirrus/logformatter10
-rwxr-xr-xtest/compose/test-compose23
2 files changed, 23 insertions, 10 deletions
diff --git a/contrib/cirrus/logformatter b/contrib/cirrus/logformatter
index 3fa0e5618..5156f9f8a 100755
--- a/contrib/cirrus/logformatter
+++ b/contrib/cirrus/logformatter
@@ -243,11 +243,17 @@ END_HTML
$cirrus_task = $1;
}
- # BATS handling (used also for apiv2 tests, which emit TAP output)
- if ($line =~ /^1\.\.(\d+)$/ || $line =~ m!/test-apiv2!) {
+ # BATS handling. This will recognize num_tests both at start and end
+ if ($line =~ /^1\.\.(\d+)$/) {
$looks_like_bats = 1;
$bats_count{expected_total} = $1;
}
+ # Since the number of tests can't always be predicted, recognize
+ # some leading text strings that indicate BATS output to come.
+ elsif ($line =~ /^TAP\s+version\s/ || $line =~ m!/test-apiv2!) {
+ $looks_like_bats = 1;
+ $bats_count{expected_total} = -1; # Expect to be overridden at end!
+ }
if ($looks_like_bats) {
my $css;
diff --git a/test/compose/test-compose b/test/compose/test-compose
index 7693041ac..abb957b43 100755
--- a/test/compose/test-compose
+++ b/test/compose/test-compose
@@ -163,18 +163,21 @@ function test_port() {
local op="$2" # '=' or '~'
local expect="$3" # what to expect from curl output
- local actual=$(curl --retry 3 --retry-all-errors -s http://127.0.0.1:$port/)
- # The test is flaking with an empty result. The curl retry doesn't solve this.
- # If the result is empty sleep one second and try again.
- if [[ "$actual" == "" ]]; then
+ # -s -S means "silent, but show errors"
+ local actual=$(curl --retry 3 --retry-all-errors -s -S http://127.0.0.1:$port/)
+ local curl_rc=$?
+
+ # FIXME 2021-04-13: test is flaking, curl succeeds but returns empty result.
+ # Could it be that the container is not actually ready? Wait, and retry.
+ if [[ $curl_rc -eq 0 && -z "$actual" ]]; then
sleep 1
- local actual=$(curl --retry 3 --retry-all-errors -s http://127.0.0.1:$port/)
+ echo "# Retrying curl:"
+ actual=$(curl --retry 3 --retry-all-errors -s -S http://127.0.0.1:$port/)
+ curl_rc=$?
fi
- local curl_rc=$?
+
if [ $curl_rc -ne 0 ]; then
_show_ok 0 "$testname - curl failed with status $curl_rc"
-### docker-compose down >>$logfile 2>&1
-### exit 1
fi
case "$op" in
@@ -285,6 +288,10 @@ fi
# Too hard to precompute the number of tests; just spit it out at the end.
n_tests=0
+
+# We aren't really TAP 13; this helps logformatter recognize our output as BATS
+echo "TAP version 13"
+
for t in ${tests_to_run[@]}; do
testdir="$(dirname $t)"
testname="$(basename $testdir)"