Skip to content

Commit d36ff6d

Browse files
authored
Merge pull request #16523 from LabNConsulting/chopps/fix-mgmt-rpc-test
tests: wait for test client to connect before running test
2 parents 0e1088c + 2ee9f4d commit d36ff6d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/topotests/mgmt_rpc/test_rpc.py

+13
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import threading
1515

1616
import pytest
17+
from lib.common_config import retry
1718
from lib.topogen import Topogen
1819
from lib.topotest import json_cmp
1920

@@ -40,12 +41,20 @@ def tgen(request):
4041
tgen.stop_topology()
4142

4243

44+
# Verify the backend test client has connected
45+
@retry(retry_timeout=10)
46+
def check_client_connect(r1):
47+
out = r1.vtysh_cmd("show mgmt backend-adapter all")
48+
assert "mgmtd-testc" in out
49+
50+
4351
def test_backend_rpc(tgen):
4452
if tgen.routers_have_failure():
4553
pytest.skip(tgen.errors)
4654

4755
r1 = tgen.gears["r1"]
4856

57+
# Run the backend test client which registers to handle the `clear ip rip` command.
4958
be_client_path = "/usr/lib/frr/mgmtd_testc"
5059
rc, _, _ = r1.net.cmd_status(be_client_path + " --help")
5160

@@ -63,6 +72,10 @@ def run_testc():
6372
t = threading.Thread(target=run_testc)
6473
t.start()
6574

75+
# We need to wait for mgmtd_testc to connect before issuing the command.
76+
res = check_client_connect(r1)
77+
assert res is None
78+
6679
r1.vtysh_cmd("clear ip rip vrf testname")
6780

6881
t.join()

0 commit comments

Comments
 (0)