ci(ros_integration_tests): restart XRCE-DDS Agent between tests

Restart the Micro-XRCE-DDS Agent before each integration test so DDS
graph state from a previous PX4 instance does not leak into the next
test.

The MicroXRCEAgent is started once per session, but PX4 reboots between
tests. The Agent retains writer entries from the previous PX4, so when
the new PX4 reconnects, count_publishers() in px4-ros2-interface-lib's
waitForFMU returns >0 immediately against a stale entry. Phase 1
(discovery) returns instantly, then Phase 2 (heartbeat) times out
waiting for a message on a subscription matched to a dead writer.

This is why ModesTest.denyArming (first test) passes while every later
ModesTest fails with "timeout while waiting for FMU heartbeat".

Adds an optional pre_test_hook on test_runner.Tester so ROS-specific
lifecycle stays out of the shared test_runner. The workflow stops
starting the Agent externally; ros_test_runner.py owns the lifecycle.

Refs #27328

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche
2026-05-13 09:50:38 -07:00
parent 78a28b0e47
commit 6baef6ba88
3 changed files with 30 additions and 3 deletions
+4 -1
View File
@@ -121,7 +121,10 @@ jobs:
shell: bash
run: |
. /opt/px4_ws/install/setup.bash
/opt/Micro-XRCE-DDS-Agent/build/MicroXRCEAgent udp4 localhost -p 8888 -v 0 &
# The Agent is started (and restarted between tests) by ros_test_runner.py
# so DDS graph state from a previous PX4 instance does not leak into the
# next test. Make the Agent binary discoverable on PATH.
export PATH="/opt/Micro-XRCE-DDS-Agent/build:$PATH"
test/ros_test_runner.py --verbose --model iris --force-color
timeout-minutes: 45