Fixing 'oransc-nonrtric-verify-bash' not exiting with error, If error occurs 26/12926/3
authorraviteja.karumuri <raviteja.karumuri@est.tech>
Thu, 23 May 2024 14:22:13 +0000 (15:22 +0100)
committerraviteja.karumuri <raviteja.karumuri@est.tech>
Fri, 24 May 2024 15:53:16 +0000 (16:53 +0100)
Issue-ID: NONRTRIC-1004
Change-Id: I3755bc1469bc94c6e9d5298638f79768a00029a0
Signed-off-by: Raviteja Karumuri <raviteja.karumuri@est.tech>
test/auto-test/Suite-Verify-jobs.sh
test/auto-test/verify-jobs-nonrtric.sh
test/common/testsuite_common.sh

index d53af8f..ef97938 100644 (file)
@@ -31,4 +31,6 @@ suite_setup
 
 ##########################################
 
-suite_complete
\ No newline at end of file
+suite_complete
+
+exit
index 7bee3fa..625eff4 100644 (file)
@@ -51,6 +51,7 @@ fi
 cd "$TEST_DIRECTORY"
 sudo chmod 775 "$TEST_SCRIPT"
 "$TEST_SCRIPT" remote-remove docker release --env-file ../common/test_env-oran-h-release.sh
+exit_val=$?
 
 # Remove docker-compose after tests are done
 if command -v docker-compose &> /dev/null; then
@@ -62,3 +63,5 @@ if command -v jq &> /dev/null; then
     echo "Removing jq..."
     sudo apt-get remove -y jq
 fi
+
+exit $exit_val
index 4117cdb..5728510 100644 (file)
@@ -94,8 +94,8 @@ suite_complete() {
 
     total=$((TCSUITE_PASS_CTR+TCSUITE_FAIL_CTR))
     if [ $TCSUITE_CTR -eq 0 ]; then
-               echo -e "\033[1mNo test cases seem to have executed. Check the script....\033[0m"
-       elif [ $total != $TCSUITE_CTR ]; then
+                   echo -e "\033[1mNo test cases seem to have executed. Check the script....\033[0m"
+         elif [ $total != $TCSUITE_CTR ]; then
         echo -e "\033[1mTotal number of test cases does not match the sum of passed and failed test cases. Check the script....\033[0m"
     fi
     echo "Number of test cases : " $TCSUITE_CTR
@@ -108,7 +108,13 @@ suite_complete() {
     echo "FAIL test cases"
     cat .tmp_tcsuite_fail
     echo ""
+    if [ $TCSUITE_FAIL_CTR -ne 0 ]; then
+      echo "###################################      Test suite completed with Tests FAIL     ##############################"
+      echo "#################################################################################################"
+    else
+      echo "###################################      Test suite completed      ##############################"
+      echo "#################################################################################################"
+    fi
 
-    echo "###################################      Test suite completed      ##############################"
-    echo "#################################################################################################"
+    exit $TCSUITE_FAIL_CTR
 }
\ No newline at end of file