support/testing: test_iptables.py: use assertRunNotOk()

Use the helper to simplify the test.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Peter Korsgaard
2026-06-18 14:48:04 +02:00
parent f3942975c4
commit 75ae191b5f

View File

@@ -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")