Skip to content

fix(test_ros2cli_daemon): add RMW isolation fixture for zenoh router#1216

Merged
ahcorde merged 1 commit intoros2:rollingfrom
YuanYuYuan:fix/daemon-rmw-isolation
Mar 27, 2026
Merged

fix(test_ros2cli_daemon): add RMW isolation fixture for zenoh router#1216
ahcorde merged 1 commit intoros2:rollingfrom
YuanYuYuan:fix/daemon-rmw-isolation

Conversation

@YuanYuYuan
Copy link
Copy Markdown
Contributor

@YuanYuYuan YuanYuYuan commented Mar 26, 2026

Summary

test_ros2cli_daemon fails in the Rci__nightly-zenoh_ubuntu_noble_amd64 CI because the ROS 2 CLI daemon and the test node cannot discover each other — no isolated network is set up for the test, so cross-process node discovery fails.

Key Changes

  • Add an autouse session-scoped fixture rmw_isolation that calls rmw_test_isolation_start() / rmw_test_isolation_stop() around the entire test session, before spawn_daemon() is called
  • Import is wrapped in try/except ImportError so the fixture is a no-op on non-Zenoh RMW implementations where the package is absent
  • Add rmw_test_fixture_implementation as a test dependency in package.xml

Breaking Changes

None

Deep Dive

rmw_test_isolation_start() starts an in-process Zenoh router on a random port and sets ZENOH_CONFIG_OVERRIDE=connect/endpoints=[tcp/127.0.0.1:<port>] in the current process environment (line 136–139). Any subprocess that inherits os.environ will have rmw_zenoh_cpp connect to that router and share the same discovery graph.

spawn_daemon() calls subprocess.Popen() with no explicit env=, so the daemon naturally inherits os.environ. Starting isolation before spawn_daemon() is therefore sufficient — the daemon picks up the router endpoint from the environment and connects to the same network as the test node.

Closes ros2/rmw_zenoh#932

test_ros2cli_daemon.py spawns a daemon subprocess with no explicit env=,
so the daemon inherits os.environ.  When running with rmw_zenoh_cpp, the
daemon and the test node cannot discover each other without a router.

Add an autouse session fixture that calls rmw_test_isolation_start() when
available; this starts an in-process router and sets ZENOH_CONFIG_OVERRIDE
so the daemon inherits the connection endpoint.

Signed-off-by: yuanyuyuan <az6980522@gmail.com>
@YuanYuYuan YuanYuYuan force-pushed the fix/daemon-rmw-isolation branch from 1388f81 to 24d6090 Compare March 26, 2026 18:00
@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Mar 26, 2026

Pulls: #1216
Gist: https://gist.githubusercontent.com/ahcorde/adf3f6086e76282f6f8441a0b75b1924/raw/115e8a25aea37facf76d16d452b968bc617a652c/ros2.repos
BUILD args: --packages-above-and-dependencies ros2cli
TEST args: --packages-above ros2cli
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18677

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde ahcorde merged commit 8cf4749 into ros2:rolling Mar 27, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🧑‍🌾 ros2cli tests failing in rolling zenoh because zennoh router isn't working

3 participants