Skip to content

Commit

Permalink
node name print bug fix with ros2 action info. (#926)
Browse files Browse the repository at this point in the history
Signed-off-by: Tomoya Fujita <[email protected]>
  • Loading branch information
fujitatomoya authored Sep 5, 2024
1 parent ddd6146 commit 303f0b1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ros2action/ros2action/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_action_clients_and_servers(*, node, action_name):
node_names_and_ns = node.get_node_names_and_namespaces()
for node_name, node_ns in node_names_and_ns:
# Construct fully qualified name
node_fqn = '/'.join(node_ns) + node_name
node_fqn = '/'.join([node_ns, node_name])

# Get any action clients associated with the node
client_names_and_types = node.get_action_client_names_and_types_by_node(
Expand Down
2 changes: 1 addition & 1 deletion ros2action/test/fixtures/fibonacci_action_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class FibonacciActionServer(Node):

def __init__(self):
super().__init__('fibonacci_action_server')
super().__init__('fibonacci_action_server', namespace='/test')
self._action_server = ActionServer(
self,
Fibonacci,
Expand Down
30 changes: 16 additions & 14 deletions ros2action/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,44 +146,46 @@ def test_info_on_nonexistent_action(self):

@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_fibonacci_info(self):
with self.launch_action_command(arguments=['info', '/fibonacci']) as action_command:
with self.launch_action_command(arguments=['info', '/test/fibonacci']) as action_command:
assert action_command.wait_for_shutdown(timeout=10)
assert action_command.exit_code == launch_testing.asserts.EXIT_OK
assert launch_testing.tools.expect_output(
expected_lines=[
'Action: /fibonacci',
'Action: /test/fibonacci',
'Action clients: 0',
'Action servers: 1',
' /fibonacci_action_server'
' /test/fibonacci_action_server'
],
text=action_command.output,
strict=False
)

@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_fibonacci_info_with_types(self):
with self.launch_action_command(arguments=['info', '-t', '/fibonacci']) as action_command:
with self.launch_action_command(
arguments=['info', '-t', '/test/fibonacci']) as action_command:
assert action_command.wait_for_shutdown(timeout=10)
assert action_command.exit_code == launch_testing.asserts.EXIT_OK
assert launch_testing.tools.expect_output(
expected_lines=[
'Action: /fibonacci',
'Action: /test/fibonacci',
'Action clients: 0',
'Action servers: 1',
' /fibonacci_action_server [test_msgs/action/Fibonacci]'
' /test/fibonacci_action_server [test_msgs/action/Fibonacci]'
],
text=action_command.output,
strict=False
)

@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_fibonacci_info_count(self):
with self.launch_action_command(arguments=['info', '-c', '/fibonacci']) as action_command:
with self.launch_action_command(
arguments=['info', '-c', '/test/fibonacci']) as action_command:
assert action_command.wait_for_shutdown(timeout=10)
assert action_command.exit_code == launch_testing.asserts.EXIT_OK
assert launch_testing.tools.expect_output(
expected_lines=[
'Action: /fibonacci',
'Action: /test/fibonacci',
'Action clients: 0',
'Action servers: 1',
],
Expand All @@ -197,7 +199,7 @@ def test_list(self):
assert action_command.wait_for_shutdown(timeout=10)
assert action_command.exit_code == launch_testing.asserts.EXIT_OK
assert launch_testing.tools.expect_output(
expected_lines=['/fibonacci'],
expected_lines=['/test/fibonacci'],
text=action_command.output,
strict=True
)
Expand All @@ -208,7 +210,7 @@ def test_list_with_types(self):
assert action_command.wait_for_shutdown(timeout=10)
assert action_command.exit_code == launch_testing.asserts.EXIT_OK
assert launch_testing.tools.expect_output(
expected_lines=['/fibonacci [test_msgs/action/Fibonacci]'],
expected_lines=['/test/fibonacci [test_msgs/action/Fibonacci]'],
text=action_command.output, strict=True
)

Expand All @@ -223,7 +225,7 @@ def test_list_count(self):

@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_type(self):
with self.launch_action_command(arguments=['type', '/fibonacci']) as action_command:
with self.launch_action_command(arguments=['type', '/test/fibonacci']) as action_command:
assert action_command.wait_for_shutdown(timeout=10)
assert action_command.exit_code == launch_testing.asserts.EXIT_OK
assert launch_testing.tools.expect_output(
Expand All @@ -238,7 +240,7 @@ def test_find(self):
assert action_command.wait_for_shutdown(timeout=10)
assert action_command.exit_code == launch_testing.asserts.EXIT_OK
assert launch_testing.tools.expect_output(
expected_lines=['/fibonacci'],
expected_lines=['/test/fibonacci'],
text=action_command.output, strict=True
)

Expand All @@ -257,7 +259,7 @@ def test_send_fibonacci_goal(self):
with self.launch_action_command(
arguments=[
'send_goal',
'/fibonacci',
'/test/fibonacci',
'test_msgs/action/Fibonacci',
'{order: 5}'
],
Expand All @@ -275,7 +277,7 @@ def test_send_fibonacci_goal_with_feedback(self):
arguments=[
'send_goal',
'-f',
'/fibonacci',
'/test/fibonacci',
'test_msgs/action/Fibonacci',
'{order: 5}'
],
Expand Down

0 comments on commit 303f0b1

Please sign in to comment.