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

Use the helper to simplify the test.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
(cherry picked from commit f3942975c4)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
Peter Korsgaard
2026-06-18 14:48:03 +02:00
committed by Thomas Perale
parent a76f24d70b
commit 2016f425e2

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