support/testing: test_iproute2.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:03 +02:00
parent cb791850ad
commit f3942975c4

View File

@@ -46,8 +46,7 @@ class TestIpRoute2(infra.basetest.BRTest):
for addr in addrs:
self.assertRunOk(f"{ping_cmd} {addr}")
# ...but the IP outside is supposed to fail.
_, ret = self.emulator.run(f"{ping_cmd} 127.1.2.3")
self.assertNotEqual(ret, 0)
self.assertRunNotOk(f"{ping_cmd} 127.1.2.3")
# We add a prohibited route.
self.assertRunOk("ip route add prohibit 127.0.1.0/24")
@@ -57,8 +56,7 @@ class TestIpRoute2(infra.basetest.BRTest):
# ...while the other IPs expected to fail.
addrs = ["127.0.1.2", "127.1.2.3"]
for addr in addrs:
_, ret = self.emulator.run(f"{ping_cmd} {addr}")
self.assertNotEqual(ret, 0)
self.assertRunNotOk(f"{ping_cmd} {addr}")
# We should be able to see our prohibited route.
out, ret = self.emulator.run("ip route list")