mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 14:01:57 -09:00
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:
@@ -68,8 +68,7 @@ class TestIptables(infra.basetest.BRTest):
|
|||||||
# A ping to 127.0.0.2 is expected to fail, because our rule is
|
# A ping to 127.0.0.2 is expected to fail, because our rule is
|
||||||
# supposed to drop it.
|
# supposed to drop it.
|
||||||
ping_test_cmd = ping_cmd_prefix + "127.0.0.2"
|
ping_test_cmd = ping_cmd_prefix + "127.0.0.2"
|
||||||
_, exit_code = self.emulator.run(ping_test_cmd)
|
self.assertRunNotOk(ping_test_cmd)
|
||||||
self.assertNotEqual(exit_code, 0)
|
|
||||||
|
|
||||||
# Save the current rules to test the init script later.
|
# Save the current rules to test the init script later.
|
||||||
self.assertRunOk("/etc/init.d/S35iptables save")
|
self.assertRunOk("/etc/init.d/S35iptables save")
|
||||||
@@ -85,8 +84,7 @@ class TestIptables(infra.basetest.BRTest):
|
|||||||
self.assertRunOk("/etc/init.d/S35iptables start")
|
self.assertRunOk("/etc/init.d/S35iptables start")
|
||||||
|
|
||||||
# Ping to 127.0.0.2 is expected to fail again.
|
# Ping to 127.0.0.2 is expected to fail again.
|
||||||
_, exit_code = self.emulator.run(ping_test_cmd)
|
self.assertRunNotOk(ping_test_cmd)
|
||||||
self.assertNotEqual(exit_code, 0)
|
|
||||||
|
|
||||||
# And flush the rules again.
|
# And flush the rules again.
|
||||||
self.assertRunOk("/etc/init.d/S35iptables stop")
|
self.assertRunOk("/etc/init.d/S35iptables stop")
|
||||||
|
|||||||
Reference in New Issue
Block a user