summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2024-08-07 13:27:39 -0400
committerGitHub <noreply@github.com>2024-08-07 13:27:39 -0400
commitd36ff6df2be1f2dcc78a442fc7bc7badc25865e9 (patch)
treeed046e48054a3b8cafe322dc3c146b1762b90d9c
parent0e1088c761a6066f6549e1cf2f0f5c0b0412a4f2 (diff)
parent2ee9f4d11fad259b3226e386375c2edf072ba28a (diff)
Merge pull request #16523 from LabNConsulting/chopps/fix-mgmt-rpc-test
tests: wait for test client to connect before running test
-rw-r--r--tests/topotests/mgmt_rpc/test_rpc.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/topotests/mgmt_rpc/test_rpc.py b/tests/topotests/mgmt_rpc/test_rpc.py
index 839db97379..4d073fd0c9 100644
--- a/tests/topotests/mgmt_rpc/test_rpc.py
+++ b/tests/topotests/mgmt_rpc/test_rpc.py
@@ -14,6 +14,7 @@ import os
import threading
import pytest
+from lib.common_config import retry
from lib.topogen import Topogen
from lib.topotest import json_cmp
@@ -40,12 +41,20 @@ def tgen(request):
tgen.stop_topology()
+# Verify the backend test client has connected
+@retry(retry_timeout=10)
+def check_client_connect(r1):
+ out = r1.vtysh_cmd("show mgmt backend-adapter all")
+ assert "mgmtd-testc" in out
+
+
def test_backend_rpc(tgen):
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
+ # Run the backend test client which registers to handle the `clear ip rip` command.
be_client_path = "/usr/lib/frr/mgmtd_testc"
rc, _, _ = r1.net.cmd_status(be_client_path + " --help")
@@ -63,6 +72,10 @@ def test_backend_rpc(tgen):
t = threading.Thread(target=run_testc)
t.start()
+ # We need to wait for mgmtd_testc to connect before issuing the command.
+ res = check_client_connect(r1)
+ assert res is None
+
r1.vtysh_cmd("clear ip rip vrf testname")
t.join()