diff --git a/tests/scripts/functional_tests/test_model.sh b/tests/scripts/functional_tests/test_model.sh index 304550f3..544aa17b 100755 --- a/tests/scripts/functional_tests/test_model.sh +++ b/tests/scripts/functional_tests/test_model.sh @@ -24,8 +24,8 @@ test_model() { # Use parse_config.py to parse the YAML file with test type and test model local _cases=$(python tests/scripts/functional_tests/parse_config.py --config $CONFIG_FILE --type $_type --model $_model) # Convert the parsed test cases to an array - IFS=' ' read -r -a _cases <<< "$_cases" - + IFS=' ' read -r -a _cases <<<"$_cases" + # Check if _cases is not an empty list if [ ${#_cases[@]} -eq 0 ]; then echo "No test cases found for model '$_model' with test type '$_type'. Exiting." @@ -59,6 +59,7 @@ test_model() { # serve echo "python run.py --config-path tests/functional_tests/test_cases/${_type}/${_model}/conf --config-name ${_case} action=run" run_command "python run.py --config-path tests/functional_tests/test_cases/${_type}/${_model}/conf --config-name ${_case} action=run" + if [ $? -ne 0 ]; then echo "Test failed on attempt $attempt_i for case $_case." exit 1 @@ -67,6 +68,7 @@ test_model() { # call echo "python tests/functional_tests/test_cases/${_type}/${_model}/test_call.py" run_command "python tests/functional_tests/test_cases/${_type}/${_model}/test_call.py" + if [ $? -ne 0 ]; then echo "Test failed on attempt $attempt_i for case $_case." exit 1 @@ -74,6 +76,7 @@ test_model() { #clear echo "python run.py --config-path tests/functional_tests/test_cases/${_type}/${_model}/conf --config-name ${_case} action=stop" run_command "python run.py --config-path tests/functional_tests/test_cases/${_type}/${_model}/conf --config-name ${_case} action=stop" + else run_command "python run.py --config-path tests/functional_tests/test_cases/${_type}/${_model}/conf --config-name ${_case} action=test" @@ -88,6 +91,7 @@ test_model() { exit 1 fi fi + # Ensure that pytest check is completed before deleting the folder sleep 10s done @@ -97,12 +101,21 @@ test_model() { # Parse command-line arguments while [[ "$#" -gt 0 ]]; do - case $1 in - --type) type="$2"; shift ;; - --model) model="$2"; shift ;; - *) echo "Unknown parameter passed: $1"; exit 1 ;; - esac + case $1 in + --type) + type="$2" + shift + ;; + --model) + model="$2" shift + ;; + *) + echo "Unknown parameter passed: $1" + exit 1 + ;; + esac + shift done # Validate that the required parameters --type and --model are provided