summaryrefslogtreecommitdiff
path: root/test/apiv2/test-apiv2
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-13 09:33:57 -0400
committerGitHub <noreply@github.com>2020-10-13 09:33:57 -0400
commit7ad631b819d991559ba20e4728a6803a2546158f (patch)
treec953e7f8a9b746fbb1484d69e6d908494e081f9c /test/apiv2/test-apiv2
parentd161f4225a120e113ffbc7fafb216dc7f14357d3 (diff)
parent2a6a3f333bd5c5968e34596c1c6ed93181a5da10 (diff)
downloadpodman-7ad631b819d991559ba20e4728a6803a2546158f.tar.gz
podman-7ad631b819d991559ba20e4728a6803a2546158f.tar.bz2
podman-7ad631b819d991559ba20e4728a6803a2546158f.zip
Merge pull request #8000 from edsantiago/fix_apiv2_tests_again
APIv2 tests: try again to fix them
Diffstat (limited to 'test/apiv2/test-apiv2')
-rwxr-xr-xtest/apiv2/test-apiv219
1 files changed, 19 insertions, 0 deletions
diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2
index e9b5f245c..78325eb24 100755
--- a/test/apiv2/test-apiv2
+++ b/test/apiv2/test-apiv2
@@ -111,6 +111,14 @@ function _show_ok() {
_bump $testcounter_file
count=$(<$testcounter_file)
+
+ # "skip" is a special case of "ok". Assume that our caller has included
+ # the magical '# skip - reason" comment string.
+ if [[ $ok == "skip" ]]; then
+ # colon-plus: replace green with yellow, but only if green is non-null
+ green="${green:+\e[33m}"
+ ok=1
+ fi
if [ $ok -eq 1 ]; then
echo -e "${green}ok $count ${TEST_CONTEXT} $testname${reset}"
echo "ok $count ${TEST_CONTEXT} $testname" >>$LOG
@@ -241,6 +249,17 @@ function t() {
fi
local i
+
+ # Special case: if response code does not match, dump the response body
+ # and skip all further subtests.
+ if [[ $actual_code != $expected_code ]]; then
+ echo -e "# response: $output"
+ for i; do
+ _show_ok skip "$testname: $i # skip - wrong return code"
+ done
+ return
+ fi
+
for i; do
if expr "$i" : "[^=~]\+=.*" >/dev/null; then
# Exact match on json field