From 75ae191b5f8bbe7fc971283922bb6b356a5e0c4d Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Thu, 18 Jun 2026 14:48:04 +0200 Subject: [PATCH] support/testing: test_iptables.py: use assertRunNotOk() Use the helper to simplify the test. Signed-off-by: Peter Korsgaard --- support/testing/tests/package/test_iptables.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/support/testing/tests/package/test_iptables.py b/support/testing/tests/package/test_iptables.py index 6e4db0ac06..72f2dd71a4 100644 --- a/support/testing/tests/package/test_iptables.py +++ b/support/testing/tests/package/test_iptables.py @@ -68,8 +68,7 @@ class TestIptables(infra.basetest.BRTest): # A ping to 127.0.0.2 is expected to fail, because our rule is # supposed to drop it. ping_test_cmd = ping_cmd_prefix + "127.0.0.2" - _, exit_code = self.emulator.run(ping_test_cmd) - self.assertNotEqual(exit_code, 0) + self.assertRunNotOk(ping_test_cmd) # Save the current rules to test the init script later. self.assertRunOk("/etc/init.d/S35iptables save") @@ -85,8 +84,7 @@ class TestIptables(infra.basetest.BRTest): self.assertRunOk("/etc/init.d/S35iptables start") # Ping to 127.0.0.2 is expected to fail again. - _, exit_code = self.emulator.run(ping_test_cmd) - self.assertNotEqual(exit_code, 0) + self.assertRunNotOk(ping_test_cmd) # And flush the rules again. self.assertRunOk("/etc/init.d/S35iptables stop")