From 022fe15d5153ea87f42206585d251e09d432c849 Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Thu, 4 Sep 2025 17:00:55 +0900 Subject: [PATCH 1/8] Enable RMW isolation for ros2doctor.test_report. Signed-off-by: Tomoya Fujita --- ros2doctor/test/test_report.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ros2doctor/test/test_report.py b/ros2doctor/test/test_report.py index b3e7052db..7cc0f8e98 100644 --- a/ros2doctor/test/test_report.py +++ b/ros2doctor/test/test_report.py @@ -24,6 +24,7 @@ from launch import LaunchDescription from launch import LaunchService from launch.actions import ExecuteProcess +from launch.actions import SetEnvironmentVariable from launch_ros.actions import Node @@ -32,6 +33,7 @@ import launch_testing.asserts import launch_testing.markers import launch_testing.tools +from launch_testing_ros.actions import EnableRmwIsolation import launch_testing_ros.tools import pytest @@ -55,21 +57,22 @@ def generate_test_description(rmw_implementation: str) -> Tuple[LaunchDescriptio path_to_fixtures = os.path.join(os.path.dirname(__file__), 'fixtures') additional_env = get_rmw_additional_env(rmw_implementation) additional_env['PYTHONUNBUFFERED'] = '1' + set_env_actions = [SetEnvironmentVariable(k, v) for k, v in additional_env.items()] return LaunchDescription([ ExecuteProcess( cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ + *set_env_actions, + EnableRmwIsolation(), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', - additional_env=additional_env, on_exit=[ Node( executable=sys.executable, arguments=[os.path.join(path_to_fixtures, 'report_node.py')], - additional_env=additional_env ), launch_testing.actions.ReadyToTest() ] @@ -100,11 +103,8 @@ def launch_doctor_command( self, arguments ) -> Generator[launch_testing.tools.process.ProcessProxy, None, None]: - additional_env = get_rmw_additional_env(rmw_implementation) - additional_env['PYTHONUNBUFFERED'] = '1' doctor_command_action = ExecuteProcess( cmd=['ros2', 'doctor', *arguments], - additional_env=additional_env, name='ros2doctor-cli', output='screen' ) From 3247d58ce31f59de3de84394ddf48d9c17a6bf5a Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Thu, 4 Sep 2025 18:43:12 +0900 Subject: [PATCH 2/8] ResetEnvironment on shutdown is missing. Signed-off-by: Tomoya Fujita --- ros2doctor/test/test_report.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ros2doctor/test/test_report.py b/ros2doctor/test/test_report.py index 7cc0f8e98..0ff79b3b3 100644 --- a/ros2doctor/test/test_report.py +++ b/ros2doctor/test/test_report.py @@ -24,7 +24,10 @@ from launch import LaunchDescription from launch import LaunchService from launch.actions import ExecuteProcess +from launch.actions import RegisterEventHandler +from launch.actions import ResetEnvironment from launch.actions import SetEnvironmentVariable +from launch.event_handlers import OnShutdown from launch_ros.actions import Node @@ -64,6 +67,7 @@ def generate_test_description(rmw_implementation: str) -> Tuple[LaunchDescriptio cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ + RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), ExecuteProcess( @@ -130,11 +134,6 @@ def test_check(self) -> None: @launch_testing.markers.retry_on_failure(times=5, delay=1) def test_report(self) -> None: - # TODO(@fujitatomoya): rmw_zenoh_cpp is instable to find the endpoints, it does not - # matter if DaemonNode or DirectNode is used. For now, skip the test for rmw_zenoh_cpp. - if self.rmw_implementation == 'rmw_zenoh_cpp': - raise unittest.SkipTest() - for argument in ['-r', '--report']: with self.launch_doctor_command( arguments=[argument] From d9a3a50443f2ed8267707c7af4685bd7fe09a031 Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Thu, 4 Sep 2025 18:34:05 +0900 Subject: [PATCH 3/8] Clean up isolated ros2 daemon process when tests complete. Signed-off-by: Tomoya Fujita --- ros2service/test/test_cli.py | 12 +++++++++++- ros2service/test/test_echo.py | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ros2service/test/test_cli.py b/ros2service/test/test_cli.py index d6343fe0e..30f5aa8a2 100644 --- a/ros2service/test/test_cli.py +++ b/ros2service/test/test_cli.py @@ -81,9 +81,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2service/test/test_echo.py b/ros2service/test/test_echo.py index c26d20b27..8eb3e181c 100644 --- a/ros2service/test/test_echo.py +++ b/ros2service/test/test_echo.py @@ -105,9 +105,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', From f1ea7549deadb7843c5ec0f2519943e2c77658cb Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Thu, 4 Sep 2025 22:03:22 +0900 Subject: [PATCH 4/8] Clean up isolated ros2 daemon process for ros2topic. Signed-off-by: Tomoya Fujita --- ros2topic/test/test_bw_delay_hz.py | 12 ++++++++++++ ros2topic/test/test_cli.py | 12 +++++++++++- ros2topic/test/test_echo_pub.py | 12 ++++++++++++ ros2topic/test/test_use_sim_time.py | 12 ++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/ros2topic/test/test_bw_delay_hz.py b/ros2topic/test/test_bw_delay_hz.py index 021624eda..2afa3234a 100644 --- a/ros2topic/test/test_bw_delay_hz.py +++ b/ros2topic/test/test_bw_delay_hz.py @@ -20,6 +20,9 @@ from launch import LaunchDescription from launch.actions import ExecuteProcess +from launch.actions import RegisterEventHandler +from launch.actions import ResetEnvironment +from launch.event_handlers import OnShutdown import launch_testing import launch_testing.actions @@ -63,6 +66,15 @@ def generate_test_description(): name='daemon-stop', on_exit=[ EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2topic/test/test_cli.py b/ros2topic/test/test_cli.py index add581bee..1db77cd84 100644 --- a/ros2topic/test/test_cli.py +++ b/ros2topic/test/test_cli.py @@ -121,9 +121,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2topic/test/test_echo_pub.py b/ros2topic/test/test_echo_pub.py index 2129885ab..12404c56b 100644 --- a/ros2topic/test/test_echo_pub.py +++ b/ros2topic/test/test_echo_pub.py @@ -20,6 +20,9 @@ from launch import LaunchDescription from launch.actions import ExecuteProcess +from launch.actions import RegisterEventHandler +from launch.actions import ResetEnvironment +from launch.event_handlers import OnShutdown import launch_testing import launch_testing.actions @@ -67,6 +70,15 @@ def generate_test_description(): name='daemon-stop', on_exit=[ EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2topic/test/test_use_sim_time.py b/ros2topic/test/test_use_sim_time.py index c0a226dd8..287fe5313 100644 --- a/ros2topic/test/test_use_sim_time.py +++ b/ros2topic/test/test_use_sim_time.py @@ -20,6 +20,9 @@ from launch import LaunchDescription from launch.actions import ExecuteProcess +from launch.actions import RegisterEventHandler +from launch.actions import ResetEnvironment +from launch.event_handlers import OnShutdown import launch_testing import launch_testing.actions @@ -61,6 +64,15 @@ def generate_test_description(): name='daemon-stop', on_exit=[ EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', From b325b62bff17e0e3bb5873f3925b553e6d149a63 Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Thu, 4 Sep 2025 22:08:22 +0900 Subject: [PATCH 5/8] Clean up isolated ros2 daemon process for ros2action. Signed-off-by: Tomoya Fujita --- ros2action/test/test_cli.py | 12 +++++++++++- ros2action/test/test_echo.py | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ros2action/test/test_cli.py b/ros2action/test/test_cli.py index 522fe2bc4..a44cdd5c3 100644 --- a/ros2action/test/test_cli.py +++ b/ros2action/test/test_cli.py @@ -63,9 +63,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2action/test/test_echo.py b/ros2action/test/test_echo.py index 0162d753a..23bc21ae3 100644 --- a/ros2action/test/test_echo.py +++ b/ros2action/test/test_echo.py @@ -233,9 +233,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', From 5e77650dfb4def8c2801f3de44d1e657f89a0547 Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Thu, 4 Sep 2025 22:12:48 +0900 Subject: [PATCH 6/8] Clean up isolated ros2 daemon process for ros2doctor. Signed-off-by: Tomoya Fujita --- ros2doctor/test/test_environment_report.py | 15 +++++++++++++++ ros2doctor/test/test_qos_compatibility.py | 12 +++++++++++- ros2doctor/test/test_report.py | 12 +++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/ros2doctor/test/test_environment_report.py b/ros2doctor/test/test_environment_report.py index cb9d66f45..501b614a3 100644 --- a/ros2doctor/test/test_environment_report.py +++ b/ros2doctor/test/test_environment_report.py @@ -22,7 +22,11 @@ from launch import LaunchDescription from launch import LaunchService from launch.actions import ExecuteProcess +from launch.actions import RegisterEventHandler +from launch.actions import ResetEnvironment from launch.actions import SetEnvironmentVariable +from launch.event_handlers import OnShutdown + import launch_testing import launch_testing.actions import launch_testing.asserts @@ -63,6 +67,17 @@ def generate_test_description(rmw_implementation: str) -> tuple[LaunchDescriptio on_exit=[ *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2doctor/test/test_qos_compatibility.py b/ros2doctor/test/test_qos_compatibility.py index c8059f20c..3772fcb76 100644 --- a/ros2doctor/test/test_qos_compatibility.py +++ b/ros2doctor/test/test_qos_compatibility.py @@ -91,9 +91,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2doctor/test/test_report.py b/ros2doctor/test/test_report.py index 0ff79b3b3..92bfda0ca 100644 --- a/ros2doctor/test/test_report.py +++ b/ros2doctor/test/test_report.py @@ -67,9 +67,19 @@ def generate_test_description(rmw_implementation: str) -> Tuple[LaunchDescriptio cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', From 40f564593b36a39e02ad0be425c3798b27f27491 Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Thu, 4 Sep 2025 22:16:17 +0900 Subject: [PATCH 7/8] Clean up isolated ros2 daemon process for ros2lifecycle and ros2node. Signed-off-by: Tomoya Fujita --- ros2lifecycle/test/test_cli.py | 12 +++++++++++- ros2node/test/test_cli.py | 12 +++++++++++- ros2node/test/test_cli_duplicate_node_names.py | 12 +++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ros2lifecycle/test/test_cli.py b/ros2lifecycle/test/test_cli.py index 988d96958..bcb4a341e 100644 --- a/ros2lifecycle/test/test_cli.py +++ b/ros2lifecycle/test/test_cli.py @@ -136,9 +136,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2node/test/test_cli.py b/ros2node/test/test_cli.py index a540dede0..bb226ede3 100644 --- a/ros2node/test/test_cli.py +++ b/ros2node/test/test_cli.py @@ -64,9 +64,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2node/test/test_cli_duplicate_node_names.py b/ros2node/test/test_cli_duplicate_node_names.py index 40d09b53f..7b3b7a4d7 100644 --- a/ros2node/test/test_cli_duplicate_node_names.py +++ b/ros2node/test/test_cli_duplicate_node_names.py @@ -63,9 +63,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', From f63ddcb147018d4f02c45ce653f2b59cff35a6a3 Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Thu, 4 Sep 2025 22:19:19 +0900 Subject: [PATCH 8/8] Clean up isolated ros2 daemon process for ros2param. Signed-off-by: Tomoya Fujita --- ros2param/test/test_verb_dump.py | 12 +++++++++++- ros2param/test/test_verb_list.py | 12 +++++++++++- ros2param/test/test_verb_load.py | 12 +++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ros2param/test/test_verb_dump.py b/ros2param/test/test_verb_dump.py index 8b3834543..0e7c60471 100644 --- a/ros2param/test/test_verb_dump.py +++ b/ros2param/test/test_verb_dump.py @@ -108,9 +108,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2param/test/test_verb_list.py b/ros2param/test/test_verb_list.py index 9a4d46667..7d853399d 100644 --- a/ros2param/test/test_verb_list.py +++ b/ros2param/test/test_verb_list.py @@ -78,9 +78,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start', diff --git a/ros2param/test/test_verb_load.py b/ros2param/test/test_verb_load.py index ed3b90f29..d11fd7c4a 100644 --- a/ros2param/test/test_verb_load.py +++ b/ros2param/test/test_verb_load.py @@ -128,9 +128,19 @@ def generate_test_description(rmw_implementation): cmd=['ros2', 'daemon', 'stop'], name='daemon-stop', on_exit=[ - RegisterEventHandler(OnShutdown(on_shutdown=ResetEnvironment())), *set_env_actions, EnableRmwIsolation(), + RegisterEventHandler(OnShutdown(on_shutdown=[ + # Stop daemon in isolated environment with proper ROS_DOMAIN_ID + ExecuteProcess( + cmd=['ros2', 'daemon', 'stop'], + name='daemon-stop-isolated', + # Use the same isolated environment + additional_env=dict(additional_env), + ), + # This must be done after stopping the daemon in the isolated environment + ResetEnvironment(), + ])), ExecuteProcess( cmd=['ros2', 'daemon', 'start'], name='daemon-start',