Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
cyber-pioneer committed Jan 22, 2025
1 parent 3b4e708 commit 3f00d5d
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions tests/scripts/functional_tests/test_model.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand All @@ -67,13 +68,15 @@ 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
fi
#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"
Expand All @@ -88,6 +91,7 @@ test_model() {
exit 1
fi
fi

# Ensure that pytest check is completed before deleting the folder
sleep 10s
done
Expand All @@ -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
Expand Down

0 comments on commit 3f00d5d

Please sign in to comment.