Skip to content

Commit

Permalink
Temp: full simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
vg12345 committed May 19, 2024
1 parent 8f090e7 commit f159e1a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/pdr_plugin_ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ jobs:

- name: Run single plugin instance on background as standalone
run: |
sudo bash plugins/pdr_deterministic_plugin/.pytest/run_simulation_pytest.sh
source run_simulation_pytest.sh
start_simulation_server_pytest
start_pdr_standalone_pytest
kill_simulation_server_pytest
- name: Test exclude list with pytest
run: pytest plugins/pdr_deterministic_plugin/tests/exclude_list_tests.py #--doctest-modules --junitxml=junit/exclude_list_tests_results.xml --cov=com --cov-report=xml --cov-report=html
# - name: Test exclude list with pytest
# run: pytest plugins/pdr_deterministic_plugin/tests/exclude_list_tests.py #--doctest-modules --junitxml=junit/exclude_list_tests_results.xml --cov=com --cov-report=xml --cov-report=html

- name: Kill plugin process
run: |
pkill -9 -f isolation_algo.py 2>/dev/null || true
sleep 10
# - name: Kill plugin process
# run: |
# pkill -9 -f isolation_algo.py 2>/dev/null || true
# sleep 10
43 changes: 26 additions & 17 deletions plugins/pdr_deterministic_plugin/.pytest/run_simulation_pytest.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
#!/bin/bash -x

sudo -s
PLUGIN_DIR="plugins/pdr_deterministic_plugin"
pip install -r $PLUGIN_DIR/requirements.txt
cp -r utils $PLUGIN_DIR/tests
cp -r utils $PLUGIN_DIR/ufm_sim_web_service

CONFIG_FILE="/config/pdr_deterministic.conf"
mkdir -p /config
cp -f $PLUGIN_DIR/build/config/pdr_deterministic.conf "$CONFIG_FILE"
sed -i -e 's/\nTEST_MODE=True\n//g' "$CONFIG_FILE"
echo -e '\n[Common]\nTEST_MODE=True\n' >> "$CONFIG_FILE"
sed -i -e 's/DRY_RUN=False/DRY_RUN=True/g' "$CONFIG_FILE"
sed -i -e 's/INTERVAL=300/INTERVAL=10/g' "$CONFIG_FILE"
sed -i -e 's/CONFIGURED_TEMP_CHECK=False/CONFIGURED_TEMP_CHECK=True/g' "$CONFIG_FILE"
sed -i -e 's/DEISOLATE_CONSIDER_TIME=5/DEISOLATE_CONSIDER_TIME=1/g' "$CONFIG_FILE"
start_simulation_server_pytest() {
cp -r utils $PLUGIN_DIR/tests
CONFIG_FILE="/config/pdr_deterministic.conf"
mkdir -p /config
cp -f $PLUGIN_DIR/build/config/pdr_deterministic.conf "$CONFIG_FILE"
sed -i -e 's/\nTEST_MODE=True\n//g' "$CONFIG_FILE"
echo -e '\n[Common]\nTEST_MODE=True\n' >> "$CONFIG_FILE"
sed -i -e 's/DRY_RUN=False/DRY_RUN=True/g' "$CONFIG_FILE"
sed -i -e 's/INTERVAL=300/INTERVAL=10/g' "$CONFIG_FILE"
sed -i -e 's/CONFIGURED_TEMP_CHECK=False/CONFIGURED_TEMP_CHECK=True/g' "$CONFIG_FILE"
sed -i -e 's/DEISOLATE_CONSIDER_TIME=5/DEISOLATE_CONSIDER_TIME=1/g' "$CONFIG_FILE"

echo "Starting 'isolation_algo.py'"
python $PLUGIN_DIR/ufm_sim_web_service/isolation_algo.py &
echo "Starting 'simulation_telemetry.py'"
python $PLUGIN_DIR/tests/simulation_telemetry.py
echo "Terminating 'isolation_algo.py'"
pkill -9 -f isolation_algo.py 2>/dev/null || true
echo "Starting 'isolation_algo.py'"
python $PLUGIN_DIR/ufm_sim_web_service/isolation_algo.py &
}

start_pdr_standalone_pytest() {
cp -r utils $PLUGIN_DIR/ufm_sim_web_service
echo "Starting 'simulation_telemetry.py'"
python $PLUGIN_DIR/tests/simulation_telemetry.py
}

kill_simulation_server_pytest() {
echo "Terminating 'isolation_algo.py'"
pkill -9 -f isolation_algo.py 2>/dev/null || true
}

0 comments on commit f159e1a

Please sign in to comment.