diff --git a/.github/workflows/pdr_plugin_ci_workflow.yml b/.github/workflows/pdr_plugin_ci_workflow.yml index aa037d9f6..a2e4e1ef7 100644 --- a/.github/workflows/pdr_plugin_ci_workflow.yml +++ b/.github/workflows/pdr_plugin_ci_workflow.yml @@ -26,7 +26,7 @@ jobs: pip install -r $PDRPATH/requirements.txt pip install pylint pip install pytest-cov - + - name: Run PyLint run: pylint --rcfile=$PDRPATH/.pylintrc $PDRPATH @@ -41,8 +41,7 @@ jobs: echo "Test exclusion list REST API methods" sleep 10 pytest -s $PDRPATH/tests/exclude_list_rest_api_tests.py --cov=$PDRPATH - echo "Terminating standalone PDR process" - pkill -9 -f isolation_algo.py 2>/dev/null || true + sudo bash $PDRPATH/.pytest/terminate_pdr_standalone_pytest.sh - name: Run full simulation test timeout-minutes: 10 @@ -50,5 +49,4 @@ jobs: sudo bash $PDRPATH/.pytest/run_pdr_standalone_pytest.sh echo "Starting simulated test" python $PDRPATH/tests/simulation_telemetry.py - echo "Terminating standalone PDR process" - pkill -9 -f isolation_algo.py 2>/dev/null || true + sudo bash $PDRPATH/.pytest/terminate_pdr_standalone_pytest.sh diff --git a/plugins/pdr_deterministic_plugin/.pytest/run_pdr_standalone_pytest.sh b/plugins/pdr_deterministic_plugin/.pytest/run_pdr_standalone_pytest.sh index a875cfc75..e461532e8 100644 --- a/plugins/pdr_deterministic_plugin/.pytest/run_pdr_standalone_pytest.sh +++ b/plugins/pdr_deterministic_plugin/.pytest/run_pdr_standalone_pytest.sh @@ -28,9 +28,11 @@ else echo -e '\n[Common]\nTEST_MODE=True\n' >> "$CONFIG_FILE" fi -"Terminating standalone PDR process" -pkill -9 -f isolation_algo.py 2>/dev/null || true -sleep 10 - +bash $PLUGIN_DIR/.pytest/terminate_pdr_standalone_pytest.sh echo "Starting standalone PDR process" python $PLUGIN_DIR/ufm_sim_web_service/isolation_algo.py >/dev/null 2>&1 & +sleep 10 +if ! pgrep -x isolation_algo.py> /dev/null; then + echo "Failed to start standalone PDR process" + exit 1 +fi diff --git a/plugins/pdr_deterministic_plugin/.pytest/terminate_pdr_standalone_pytest.sh b/plugins/pdr_deterministic_plugin/.pytest/terminate_pdr_standalone_pytest.sh new file mode 100644 index 000000000..d49c04239 --- /dev/null +++ b/plugins/pdr_deterministic_plugin/.pytest/terminate_pdr_standalone_pytest.sh @@ -0,0 +1,9 @@ +#!/bin/bash -x + +echo "Terminating standalone PDR process" +ps -ef | grep isolation_algo.py | grep -v grep | awk '{print $2}' | xargs kill -9 $1 >/dev/null 2>/dev/null +sleep 10 +if pgrep -x isolation_algo.py> /dev/null; then + echo "Failed to terminate standalone PDR process" + exit 1 +fi