Skip to content

fix(test_cli_remapping): use EnableRmwIsolation for zenoh router#588

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

fix(test_cli_remapping): use EnableRmwIsolation for zenoh router#588
ahcorde merged 1 commit intoros2:rollingfrom
YuanYuYuan:fix/cli-remapping-rmw-isolation

Conversation

@YuanYuYuan
Copy link
Copy Markdown
Contributor

@YuanYuYuan YuanYuYuan commented Mar 26, 2026

Summary

test_cli_remapping fails in the Rci__nightly-zenoh_ubuntu_noble_amd64 CI because its nodes cannot discover each other — the test uses add_launch_test without RMW isolation, so there is no shared network for cross-process node discovery.

Key Changes

  • Add EnableRmwIsolation() as the first launch action so the isolated network is set up before any subprocesses are spawned
  • Replace env=dict(os.environ) (snapshot taken before isolation runs) with additional_env={'PYTHONUNBUFFERED': '1'} so each subprocess inherits the live environment at spawn time and joins the isolated network
  • Add launch_testing_ros and rmw_test_fixture_implementation as test dependencies in package.xml

Breaking Changes

None

Deep Dive

EnableRmwIsolation calls rmw_test_isolation_start(), which starts an in-process Zenoh router on a random port and then 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.

The original code does env=dict(os.environ) before the launch description executes, so the snapshot is taken before EnableRmwIsolation.execute() runs and ZENOH_CONFIG_OVERRIDE is not yet set. The subprocesses receive a frozen copy of the environment that predates isolation and therefore never connect to the in-process router. Replacing it with additional_env causes the subprocess to inherit the live os.environ at the time it is actually spawned, after isolation has started.

Closes ros2/rmw_zenoh#932

@YuanYuYuan YuanYuYuan force-pushed the fix/cli-remapping-rmw-isolation branch from 2343e40 to 2cd740f Compare March 26, 2026 18:00
test_cli_remapping uses add_launch_test without rmw isolation, so the
test executables have no router to connect to when using rmw_zenoh_cpp.

Add EnableRmwIsolation() as the first launch action so an in-process
router is started before any nodes.  Remove the os.environ snapshot
(env=dict(os.environ)) and replace it with additional_env so that the
ZENOH_CONFIG_OVERRIDE set by isolation is inherited by the processes.

Signed-off-by: yuanyuyuan <az6980522@gmail.com>
@YuanYuYuan YuanYuYuan force-pushed the fix/cli-remapping-rmw-isolation branch from 2cd740f to 6d989d1 Compare March 26, 2026 18:05
@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Mar 26, 2026

Pulls: #588
Gist: https://gist.githubusercontent.com/ahcorde/b2759eb67f8c8d5859c69fd9be51e223/raw/acad7d5a51bc7b5205e2ca58a2c76c92577c8524/ros2.repos
BUILD args: --packages-above-and-dependencies test_cli_remapping
TEST args: --packages-above test_cli_remapping
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18676

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

@ahcorde ahcorde merged commit cc976b5 into ros2:rolling Mar 27, 2026
2 of 3 checks passed
@cottsay
Copy link
Copy Markdown
Member

cottsay commented Apr 13, 2026

@Mergifyio backport kilted

@mergify
Copy link
Copy Markdown

mergify bot commented Apr 13, 2026

backport kilted

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Apr 13, 2026
test_cli_remapping uses add_launch_test without rmw isolation, so the
test executables have no router to connect to when using rmw_zenoh_cpp.

Add EnableRmwIsolation() as the first launch action so an in-process
router is started before any nodes.  Remove the os.environ snapshot
(env=dict(os.environ)) and replace it with additional_env so that the
ZENOH_CONFIG_OVERRIDE set by isolation is inherited by the processes.

Signed-off-by: yuanyuyuan <az6980522@gmail.com>
(cherry picked from commit cc976b5)
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