fix(test_cli_remapping): use EnableRmwIsolation for zenoh router (backport #588)#590
Open
mergify[bot] wants to merge 1 commit intokiltedfrom
Open
fix(test_cli_remapping): use EnableRmwIsolation for zenoh router (backport #588)#590mergify[bot] wants to merge 1 commit intokiltedfrom
mergify[bot] wants to merge 1 commit intokiltedfrom
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_cli_remappingfails in theRci__nightly-zenoh_ubuntu_noble_amd64CI because its nodes cannot discover each other — the test usesadd_launch_testwithout RMW isolation, so there is no shared network for cross-process node discovery.Key Changes
EnableRmwIsolation()as the first launch action so the isolated network is set up before any subprocesses are spawnedenv=dict(os.environ)(snapshot taken before isolation runs) withadditional_env={'PYTHONUNBUFFERED': '1'}so each subprocess inherits the live environment at spawn time and joins the isolated networklaunch_testing_rosandrmw_test_fixture_implementationas test dependencies inpackage.xmlBreaking Changes
None
Deep Dive
EnableRmwIsolationcallsrmw_test_isolation_start(), which starts an in-process Zenoh router on a random port and then setsZENOH_CONFIG_OVERRIDE=connect/endpoints=[tcp/127.0.0.1:<port>]in the current process environment (line 136–139). Any subprocess that inheritsos.environwill 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 beforeEnableRmwIsolation.execute()runs andZENOH_CONFIG_OVERRIDEis 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 withadditional_envcauses the subprocess to inherit the liveos.environat the time it is actually spawned, after isolation has started.Closes ros2/rmw_zenoh#932
This is an automatic backport of pull request #588 done by [Mergify](https://mergify.com).