From cfbc4aaeb50b5fb12ec9363328bb08fc459a1067 Mon Sep 17 00:00:00 2001
From: Ed Santiago <santiago@redhat.com>
Date: Thu, 15 Sep 2022 16:18:46 -0600
Subject: Cleanup: fix problems reported by shell lint

Followup to #15616, which is not usable as it is (way, way, way
too much noise) but actually found a few real nits that should
be fixed.

Signed-off-by: Ed Santiago <santiago@redhat.com>
---
 test/apiv2/test-apiv2 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'test/apiv2')

diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2
index b762cff9e..8132e6432 100755
--- a/test/apiv2/test-apiv2
+++ b/test/apiv2/test-apiv2
@@ -272,8 +272,8 @@ function t() {
             esac
         done
         if [[ -z "$curl_args" ]]; then
-            curl_args=(-d $(jsonify ${post_args[@]}))
-            testname="$testname [${curl_args[@]}]"
+            curl_args=(-d $(jsonify ${post_args[*]}))
+            testname="$testname [${curl_args[*]}]"
         fi
     fi
 
@@ -336,7 +336,7 @@ function t() {
 
     # Any error from curl is instant bad news, from which we can't recover
     if [[ $rc -ne 0 ]]; then
-        die "curl failure ($rc) on $url - cannot continue"
+        die "curl failure ($rc) on $url - cannot continue. args=${curl_args[*]}"
     fi
 
     # Show returned headers (without trailing ^M or empty lines) in log file.
@@ -384,7 +384,7 @@ function t() {
 
     # Special case: if response code does not match, dump the response body
     # and skip all further subtests.
-    if [[ $actual_code != $expected_code ]]; then
+    if [[ "$actual_code" != "$expected_code" ]]; then
         echo -e "#  response: $output"
         for i; do
             _show_ok skip "$testname: $i # skip - wrong return code"
@@ -671,11 +671,11 @@ echo -e "collected ${#tests_to_run[@]} items\n"
 
 start_service
 
-for i in ${tests_to_run[@]}; do
+for i in "${tests_to_run[@]}"; do
     TEST_CONTEXT="[$(basename $i .at)]"
 
     # Clear output from 'podman' helper
-    >| $WORKDIR/output.log
+    truncate --size=0 $WORKDIR/output.log
 
     source $i
 done
-- 
cgit v1.2.3-54-g00ecf