Skip to content

Commit

Permalink
topotests: improve test reliability
Browse files Browse the repository at this point in the history
Decrease the protocol timers, wait for peers to connect (and test it)
then finally wait a bit more for SAs to be propagated.

Signed-off-by: Rafael Zalamena <[email protected]>
  • Loading branch information
rzalamena committed Jan 10, 2025
1 parent 35c0c82 commit 762634e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/topotests/msdp_topo3/r1/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ router pim
msdp originator-id 10.254.254.1
msdp log sa-events
msdp peer 192.168.1.2 source 192.168.1.1
msdp timers 10 20 3
rp 192.168.1.1
!
1 change: 1 addition & 0 deletions tests/topotests/msdp_topo3/r2/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ router bgp 65200
router pim
msdp log sa-events
msdp peer 192.168.1.1 source 192.168.1.2
msdp timers 10 20 3
rp 192.168.1.2
!
25 changes: 24 additions & 1 deletion tests/topotests/msdp_topo3/test_msdp_topo3.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,29 @@ def expect_loopback_route(router, iptype, route, proto):
expect_loopback_route("r2", "ip", "10.254.254.1/32", "bgp")


def test_msdp_connect():
"Test that the MSDP peers have connected."
tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)

def msdp_is_connected(router, peer):
logger.info(f"waiting MSDP peer {peer} in router {router}")
expected = {peer: {"state": "established"}}
test_func = partial(
topotest.router_json_cmp,
tgen.gears[router],
"show ip msdp peer json",
expected
)
_, result = topotest.run_and_expect(test_func, None, count=40, wait=2)
assertmsg = '"{}" convergence failure'.format(router)
assert result is None, assertmsg

msdp_is_connected("r1", "192.168.1.2")
msdp_is_connected("r2", "192.168.1.1")


def test_sa_learn():
"""
Test that the learned SA uses the configured originator ID instead
Expand All @@ -147,7 +170,7 @@ def test_sa_learn():
}
}
)
_, result = topotest.run_and_expect(test_func, None, count=100, wait=1)
_, result = topotest.run_and_expect(test_func, None, count=80, wait=2)
assert result is None, 'r2 SA convergence failure'


Expand Down

0 comments on commit 762634e

Please sign in to comment.