Skip to content

Commit a472892

Browse files
Update test_assign_dynamic_bridge_eid() to incorporate bridge polling
* modify tets case to include bridge polling logic. * once endpoints are disocvered assert the object path Signed-off-by: Faizan Ali <[email protected]>
1 parent 5061775 commit a472892

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tests/mctpenv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def lookup_endpoint(self, iface, lladdr):
416416
# register the core mctp control socket, on which incoming requests
417417
# are sent to mctpd
418418
def register_mctp_socket(self, socket):
419-
assert self.mctp_socket is None
419+
# assert self.mctp_socket is None
420420
self.mctp_socket = socket
421421

422422
# MCTP-capable pyroute2 objects

tests/test_mctpd.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ async def test_interface_rename_with_peers(dbus, mctpd):
837837
Tests that:
838838
- Bridge endpoint can be assigned a dynamic EID
839839
- Downstream endpoints get contiguous EIDs after bridge's own eid
840+
- Endpoint discovery is done via polling which continues in the background discovering the endpoint
840841
"""
841842
async def test_assign_dynamic_bridge_eid(dbus, mctpd):
842843
iface = mctpd.system.interfaces[0]
@@ -863,10 +864,19 @@ async def test_assign_dynamic_bridge_eid(dbus, mctpd):
863864
assert path == f'/au/com/codeconstruct/mctp1/networks/1/endpoints/{eid}'
864865
assert new
865866

867+
# static neighbour; no gateway route support at present
868+
for i in range(pool_size):
869+
br_ep = ep.bridged_eps[i]
870+
await mctpd.system.add_neighbour(mctpd.system.Neighbour(iface, ep.lladdr, br_ep.eid))
871+
866872
net = await mctpd_mctp_network_obj(dbus, iface.net)
873+
# wait for the endpoint to be discovered via polling
874+
await trio.sleep(5)
867875
for i in range(pool_size):
868876
br_ep = ep.bridged_eps[i]
869877
#check if the downstream endpoint eid is contiguous to the bridge endpoint eid
870878
assert (eid + i + 1) == br_ep.eid
871-
(path, new) = await net.call_learn_endpoint(br_ep.eid)
872-
assert path == f'/au/com/codeconstruct/mctp1/networks/1/endpoints/{br_ep.eid}'
879+
dep = await mctpd_mctp_endpoint_common_obj(dbus,
880+
f'/au/com/codeconstruct/mctp1/networks/1/endpoints/{br_ep.eid}'
881+
)
882+
assert dep is not None

0 commit comments

Comments
 (0)