Commit fc9df1558e for frr
commit fc9df1558ef5b50d0eb65121dc5730fb149d77a1
Author: Lincoln Thurlow <lincoln@isi.edu>
Date: Tue Dec 1 09:58:59 2026 -0800
tests: check PCEP messages in flight at shutdown
The pathd PCEP steering topotest does not check what happens to
PCInitiates that pathd is still processing when it shuts down.
This commit adds a last test that has the mock PCE send PCInitiates
and ends once they are sent, so the module teardown races their
processing. The memory leak check reports anything they leak.
Signed-off-by: Lincoln Thurlow <lincoln@isi.edu>
diff --git a/tests/topotests/pathd_pcep_steering_topo1/test_pathd_pcep_steering_topo1.py b/tests/topotests/pathd_pcep_steering_topo1/test_pathd_pcep_steering_topo1.py
index 65893e85c8..2bdd63da77 100644
--- a/tests/topotests/pathd_pcep_steering_topo1/test_pathd_pcep_steering_topo1.py
+++ b/tests/topotests/pathd_pcep_steering_topo1/test_pathd_pcep_steering_topo1.py
@@ -707,6 +707,32 @@ def test_steering_route_withdrawn_on_policy_delete():
assert result is None, "steering route not withdrawn: {}".format(result)
+def test_inflight_shutdown():
+ "Leave PCInitiates in flight for the module teardown to race"
+
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # Deliberately no waiting: the module teardown races these
+ # in-flight creations, and the teardown memory check is the
+ # detector for anything they leak.
+ logger.info("firing in-flight PCInitiates and ending immediately")
+ for i in range(5):
+ pce_command("add {},{},inflight-{},475{}".format(ENDPOINT, LABEL, i, i))
+
+ # Wait only until the mock has put them on the wire, not until pathd
+ # installs them, so the teardown still races their processing.
+ def check_sent():
+ sent = len(re.findall(r"ADD-SENT .*name=inflight-", mock_pce_log_text()))
+ if sent < 5:
+ return "mock PCE sent {} of 5 in-flight PCInitiates".format(sent)
+ return None
+
+ _, result = topotest.run_and_expect(check_sent, None, count=40, wait=0.25)
+ assert result is None, result
+
+
def test_memory_leak():
"Run the memory leak test and report results."