From 2ea5ef3aedd32dd43badf8eb2f5c58a248276e8b Mon Sep 17 00:00:00 2001 From: Luke Craig Date: Wed, 5 Nov 2025 11:54:29 -0500 Subject: [PATCH 1/3] add net_external test --- .../patches/tests/net_external.yaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/unit_tests/test_target/patches/tests/net_external.yaml diff --git a/tests/unit_tests/test_target/patches/tests/net_external.yaml b/tests/unit_tests/test_target/patches/tests/net_external.yaml new file mode 100644 index 000000000..cd1b7b1ea --- /dev/null +++ b/tests/unit_tests/test_target/patches/tests/net_external.yaml @@ -0,0 +1,32 @@ +core: + network: true + +plugins: + verifier: + conditions: + net_external: + type: file_contains + file: console.log + string: "/tests/net_external.sh PASS" + + +static_files: + /tests/net_external.sh: + type: inline_file + contents: | + #!/igloo/utils/sh + set -ex + + /igloo/utils/busybox ip addr add 10.0.2.15/24 dev eth0 + /igloo/utils/busybox ip route add default via 10.0.2.2 + + /igloo/utils/busybox ping -c 8.8.8.8 + + if [ $? -ne 0 ]; then + echo "FAILED to ping external IP" + exit 1 + else + echo "PASSED ping to external IP" + exit 0 + fi + mode: 73 \ No newline at end of file From f219d008c1eb5dad99afe966ec2cb069f9b48283 Mon Sep 17 00:00:00 2001 From: Luke Craig Date: Wed, 5 Nov 2025 11:54:37 -0500 Subject: [PATCH 2/3] add net external test to base config --- tests/unit_tests/test_target/base_config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit_tests/test_target/base_config.yaml b/tests/unit_tests/test_target/base_config.yaml index 40d2e68c9..2d9d823b3 100644 --- a/tests/unit_tests/test_target/base_config.yaml +++ b/tests/unit_tests/test_target/base_config.yaml @@ -45,6 +45,7 @@ patches: - ./patches/tests/syscalls_logger.yaml - ./patches/tests/lifeguard.yaml - ./patches/tests/nvram.yaml + - ./patches/tests/net_external.yaml # - ./patches/tests/uboot_env_cmp.yaml From 7626faf6451faa23c41237c7b9f364cb98ac10d3 Mon Sep 17 00:00:00 2001 From: Luke Craig Date: Wed, 5 Nov 2025 12:37:58 -0500 Subject: [PATCH 3/3] fixup --- .../patches/tests/net_external.yaml | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/unit_tests/test_target/patches/tests/net_external.yaml b/tests/unit_tests/test_target/patches/tests/net_external.yaml index cd1b7b1ea..fa240390a 100644 --- a/tests/unit_tests/test_target/patches/tests/net_external.yaml +++ b/tests/unit_tests/test_target/patches/tests/net_external.yaml @@ -7,20 +7,39 @@ plugins: net_external: type: file_contains file: console.log - string: "/tests/net_external.sh PASS" + string: "/tests/zzznet_external.sh PASS" static_files: - /tests/net_external.sh: + #zzz here to ensure it runs last + /tests/zzznet_external.sh: type: inline_file contents: | #!/igloo/utils/sh set -ex + /igloo/utils/busybox sleep 5 + + /igloo/utils/busybox ip addr flush dev eth0 + /igloo/utils/busybox ip route flush table main + + /igloo/utils/busybox ip link set eth0 down + /igloo/utils/busybox ip link set eth0 up + + # If iptables is available, reset firewall rules completely + if /igloo/utils/busybox which iptables >/dev/null 2>&1; then + /igloo/utils/busybox iptables -F + /igloo/utils/busybox iptables -X + /igloo/utils/busybox iptables -t nat -F + /igloo/utils/busybox iptables -t nat -X + /igloo/utils/busybox iptables -P INPUT ACCEPT + /igloo/utils/busybox iptables -P FORWARD ACCEPT + /igloo/utils/busybox iptables -P OUTPUT ACCEPT + fi /igloo/utils/busybox ip addr add 10.0.2.15/24 dev eth0 /igloo/utils/busybox ip route add default via 10.0.2.2 - /igloo/utils/busybox ping -c 8.8.8.8 + /igloo/utils/busybox ping -c 3 8.8.8.8 if [ $? -ne 0 ]; then echo "FAILED to ping external IP"