Attempt to get stdout&stderr for CSIT tests - contd 70/129370/1
authorJohnKeeney <john.keeney@est.tech>
Wed, 25 May 2022 17:38:12 +0000 (18:38 +0100)
committerJohnKeeney <john.keeney@est.tech>
Wed, 25 May 2022 17:38:31 +0000 (18:38 +0100)
Issue-ID: CCSDK-3675
Change-Id: I6d0df063518b5441112b6afb2ba1f80da4668000
Signed-off-by: JohnKeeney <john.keeney@est.tech>
csit/scripts/healthcheck/data/preparePmsData.sh

index c21747f..69dc92d 100755 (executable)
@@ -48,11 +48,15 @@ checkRes (){
   fi
 }
 checkReturnContains(){
+#arg 1 max time, seconds
+#arg 2 command
+#arg 3 value (regex)
+#arg 4 description
     for ((i=0; i<$1; i++)); do
-        res=$($2)
-        expect=$3
-        echo "Check \"$4\"             Expected to contain: \"$expect\"                Received \"$res\""
-        if [[ "$res" =~ "$expect" ]]; then
+        resin=$($2)
+        exp=$3
+        echo "Check \"$4\"             Expected to contain: \"$exp\"           Received \"$resin\""
+        if [[ $resin =~ $exp ]]; then
             echo -e "$4 is as expected!\n"
             break;
         else
@@ -102,11 +106,11 @@ checkRes
 echo -e "\n"
 
 echo "check $ric1_id sync status:"
-checkReturnContains 60 "curl -skw %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/rics/ric?ric_id=$ric1_id" "\"state\": \"AVAILABLE\"" "$ric1_id status"
+checkReturnContains 90 "curl -skw %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/rics/ric?ric_id=$ric1_id" "\"state\"\s*:\s*\"AVAILABLE\"" "$ric1_id status"
 echo -e "\n"
 
 echo "check $ric2_id sync status:"
-checkReturnContains 60 "curl -skw %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/rics/ric?ric_id=$ric2_id" "\"state\": \"AVAILABLE\"" "$ric2_id status"
+checkReturnContains 30 "curl -skw %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/rics/ric?ric_id=$ric2_id" "\"state\"\s*:\s*\"AVAILABLE\"" "$ric2_id status"
 echo -e "\n"
 
 for i in {1..300}; do