Skip to content

Commit

Permalink
tests: Add a noprefixroute test
Browse files Browse the repository at this point in the history
Add a simple test case to ensure that the noprefixroute
code stays working in the future.

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Dec 6, 2023
1 parent 8a57484 commit 0d5c547
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,23 @@ def test_zebra_system_recursion():
assert result is None, "Kernel route is missing from zebra"


def test_zebra_noprefix_connected():
"Test that a noprefixroute created does not create a connected route"

tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)

router = tgen.gears["r1"]
router.run("ip addr add 192.168.44.1/24 dev r1-eth1 noprefixroute")
expected = "% Network not in table"
test_func = partial(
topotest.router_output_cmp, router, "show ip route 192.168.44.0/24", expected
)
result, diff = topotest.run_and_expect(test_func, "", count=20, wait=1)
assert result, "Connected Route should not have been added"


if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))

0 comments on commit 0d5c547

Please sign in to comment.