diff options
Diffstat (limited to 'test/apiv2/test-apiv2')
-rwxr-xr-x | test/apiv2/test-apiv2 | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2 index 1af76b4be..7a3518df2 100755 --- a/test/apiv2/test-apiv2 +++ b/test/apiv2/test-apiv2 @@ -207,13 +207,21 @@ function t() { fi cat $WORKDIR/curl.headers.out >>$LOG 2>/dev/null || true - output=$(< $WORKDIR/curl.result.out) - # Log results. If JSON, filter through jq for readability - if egrep -qi '^Content-Type: application/json' $WORKDIR/curl.headers.out; then - jq . <<<"$output" >>$LOG - else + # Log results, if text. If JSON, filter through jq for readability. + content_type=$(sed -ne 's/^Content-Type:[ ]\+//pi' <$WORKDIR/curl.headers.out) + + if [[ $content_type =~ /octet ]]; then + output="[$(file --brief $WORKDIR/curl.result.out)]" echo "$output" >>$LOG + else + output=$(< $WORKDIR/curl.result.out) + + if [[ $content_type =~ application/json ]]; then + jq . <<<"$output" >>$LOG + else + echo "$output" >>$LOG + fi fi # Test return code @@ -232,6 +240,7 @@ function t() { return fi + local i for i; do case "$i" in # Exact match on json field @@ -270,7 +279,7 @@ function start_service() { die "Cannot start service on non-localhost ($HOST)" fi - $PODMAN_BIN --root $WORKDIR system service --timeout 15 tcp:127.0.0.1:$PORT \ + $PODMAN_BIN --root $WORKDIR system service --time 15 tcp:127.0.0.1:$PORT \ &> $WORKDIR/server.log & service_pid=$! |