From cd1a957828fbb86f19cff3edde430445c54fa800 Mon Sep 17 00:00:00 2001 From: Norberto Arrieta Date: Mon, 21 Oct 2024 15:43:04 -0700 Subject: [PATCH] Update IS_ONLINE when trying socket connection [Agent Persist Firewall test] (#3247) * Update IS_ONLINE when trying socket connection [Agent Persist Firewall test] --------- Co-authored-by: narrieta@microsoft --- .../tests/scripts/agent_persist_firewall-access_wireserver | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests_e2e/tests/scripts/agent_persist_firewall-access_wireserver b/tests_e2e/tests/scripts/agent_persist_firewall-access_wireserver index 18dd91a43c..425d6ba612 100755 --- a/tests_e2e/tests/scripts/agent_persist_firewall-access_wireserver +++ b/tests_e2e/tests/scripts/agent_persist_firewall-access_wireserver @@ -39,8 +39,7 @@ function ping_localhost function socket_connection { - output=$(python3 /home/"$TEST_USER"/bin/agent_persist_firewall-check_connectivity.py 2>&1) - echo $output + python3 /home/"$TEST_USER"/bin/agent_persist_firewall-check_connectivity.py 2>&1 && echo 0 || echo 1 } # Check more, sleep less @@ -77,7 +76,7 @@ if [ "$IS_ONLINE" -eq 1 ]; then echo "Ping to localhost succeeded" fi echo "Running socket connection to wireserver:53 option" - socket_connection + IS_ONLINE=$(socket_connection) fi if [ "$IS_ONLINE" -eq 1 ]; then # We will never be able to get online. Kill script. @@ -91,7 +90,7 @@ echo "Trying to contact Wireserver as $USER to see if accessible" echo "" echo "Firewall configuration before accessing Wireserver:" -if command -v iptables; then +if sudo which iptables > /dev/null ; then sudo iptables -t security -L -nxv -w else sudo nft list table walinuxagent