Cherry Maintenance Doc updates
[sim/a1-interface.git] / near-rt-ric-simulator / test / common / test_common.sh
index b142ce8..a45a6ff 100755 (executable)
@@ -19,6 +19,9 @@
 
 # Function to execute curl and compare + print result
 
+# Note: Env var PORT must be set to the intended port number
+# Notre Env var HTTPX must be set to either 'http' or 'https'
+
 #args: <http-operation> <url> <response-code> [file]
 #Expects the env $RESULT to contain the expected RESULT.
 #If json, the RESULT shall begin with 'json:'.
@@ -29,11 +32,11 @@ do_curl() {
         echo "Exiting test script....."
         exit 1
     fi
-    curlstr="curl -X "$1" -sw %{http_code} localhost:"${PORT}${2}" -H accept:*/*"
+    curlstr="curl -X "$1" -skw %{http_code} $HTTPX://localhost:"${PORT}${2}" -H accept:*/*"
     if [ $# -gt 3 ]; then
         curlstr=$curlstr" -H Content-Type:application/json --data-binary @"$4
     fi
-    echo "  CMD:"$curlstr
+    echo "  CMD (${BASH_LINENO[0]}):"$curlstr
     res=$($curlstr)
     status=${res:${#res}-3}
     body=${res:0:${#res}-3}
@@ -50,7 +53,6 @@ do_curl() {
         elif [[ "$RESULT" == "json:"* ]]; then
             result=${RESULT:5:${#RESULT}} #Remove 'json:' from the result string
             res=$(python ../common/compare_json.py "$result" "$body")
-            echo $res
             if [ $res -eq 0 ]; then
                 echo "  Expected json body :"$result
                 echo "  Body as expected"