Skip to content

Commit

Permalink
Merge pull request #16523 from LabNConsulting/chopps/fix-mgmt-rpc-test
Browse files Browse the repository at this point in the history
tests: wait for test client to connect before running test
  • Loading branch information
donaldsharp authored Aug 7, 2024
2 parents 0e1088c + 2ee9f4d commit d36ff6d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/topotests/mgmt_rpc/test_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import threading

import pytest
from lib.common_config import retry
from lib.topogen import Topogen
from lib.topotest import json_cmp

Expand All @@ -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")

Expand All @@ -63,6 +72,10 @@ def run_testc():
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()
Expand Down

0 comments on commit d36ff6d

Please sign in to comment.