Skip to content

Commit

Permalink
Temp: output
Browse files Browse the repository at this point in the history
  • Loading branch information
vg12345 committed May 19, 2024
1 parent 8ca0621 commit aa908f7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pdr_plugin_ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
sudo bash plugins/pdr_deterministic_plugin/.pytest/run_pdr_standalone_pytest.sh 2>/dev/null
echo "Starting simulated test"
python plugins/pdr_deterministic_plugin/tests/simulation_telemetry.py
echo "Starting standalone PDR process"
python plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_algo.py &
echo "Terminating standalone PDR process"
pkill -9 -f isolation_algo.py 2>/dev/null || true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ 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 standalone PDR process"
python $PLUGIN_DIR/ufm_sim_web_service/isolation_algo.py &
#echo "Starting standalone PDR process"
#python $PLUGIN_DIR/ufm_sim_web_service/isolation_algo.py &
10 changes: 5 additions & 5 deletions plugins/pdr_deterministic_plugin/tests/simulation_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,15 @@ def initialize_simulated_counters(endpoint_obj: dict):

def assert_equal(message, left_expr, right_expr, test_name="positive"):
if left_expr == right_expr:
sys.stdout.write(f" - {test_name} test: {message} -- PASS")
print(f" - {test_name} test: {message} -- PASS")
else:
sys.stdout.write(f" - {test_name} test: {message} -- FAIL (expected: {right_expr}, actual: {left_expr})")
print(f" - {test_name} test: {message} -- FAIL (expected: {right_expr}, actual: {left_expr})")

def validate_simulation_data():
positive_test_port_indexes = set([x[1] for x in POSITIVE_DATA_TEST])
negative_test_port_indexes = set([x[1] for x in NEGATIVE_DATA_TEST])
if not positive_test_port_indexes.isdisjoint(negative_test_port_indexes):
sys.stdout.write("ERROR: same port can't participate in both positive and negative tests")
print("ERROR: same port can't participate in both positive and negative tests")
return False

return True
Expand All @@ -308,7 +308,7 @@ def check_logs(config):
lines=log_file.readlines()
break
if len(lines) == 0:
sys.stdout.write("Could not find log file in " + str(location_logs_can_be))
print("Could not find log file in " + str(location_logs_can_be))
return 1
# if a you want to add more tests, please add more guids and test on other indices.

Expand Down Expand Up @@ -388,7 +388,7 @@ def main():

port = args.endpoint_port
url = f'http://0.0.0.0:{port}{args.url_suffix}'
sys.stdout.write(f'---Starting endpoint {url}')
print(f'---Starting endpoint {url}')
start_server(port,args.changes_intervals,args.run_forever)
if not args.run_forever:
return check_logs(config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def main():
run_api(app=app, port_number=int(plugin_port))

except Exception as ex:
sys.stdout.write(f'Failed to run the app: {str(ex)}')
print(f'Failed to run the app: {str(ex)}')


#optional second phase
Expand Down

0 comments on commit aa908f7

Please sign in to comment.