Skip to content

Commit

Permalink
Add delay when retrying tests involving the CLI daemon (#459)
Browse files Browse the repository at this point in the history
This is to give time for discovery to happen between the daemon node and the test fixture nodes.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron authored Feb 27, 2020
1 parent c3bf21d commit 09b1528
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 59 deletions.
16 changes: 8 additions & 8 deletions ros2action/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_info_on_nonexistent_action(self):
strict=False
)

@launch_testing.markers.retry_on_failure(times=5)
@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:
assert action_command.wait_for_shutdown(timeout=10)
Expand All @@ -151,7 +151,7 @@ def test_fibonacci_info(self):
strict=False
)

@launch_testing.markers.retry_on_failure(times=5)
@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:
assert action_command.wait_for_shutdown(timeout=10)
Expand All @@ -167,7 +167,7 @@ def test_fibonacci_info_with_types(self):
strict=False
)

@launch_testing.markers.retry_on_failure(times=5)
@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:
assert action_command.wait_for_shutdown(timeout=10)
Expand All @@ -182,7 +182,7 @@ def test_fibonacci_info_count(self):
strict=False
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list(self):
with self.launch_action_command(arguments=['list']) as action_command:
assert action_command.wait_for_shutdown(timeout=10)
Expand All @@ -193,7 +193,7 @@ def test_list(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_with_types(self):
with self.launch_action_command(arguments=['list', '-t']) as action_command:
assert action_command.wait_for_shutdown(timeout=10)
Expand All @@ -203,7 +203,7 @@ def test_list_with_types(self):
text=action_command.output, strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_count(self):
with self.launch_action_command(arguments=['list', '-c']) as action_command:
assert action_command.wait_for_shutdown(timeout=10)
Expand All @@ -212,7 +212,7 @@ def test_list_count(self):
assert len(command_output_lines) == 1
assert int(command_output_lines[0]) == 1

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_send_fibonacci_goal(self):
with self.launch_action_command(
arguments=[
Expand All @@ -229,7 +229,7 @@ def test_send_fibonacci_goal(self):
text=action_command.output, strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_send_fibonacci_goal_with_feedback(self):
with self.launch_action_command(
arguments=[
Expand Down
30 changes: 15 additions & 15 deletions ros2lifecycle/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def launch_lifecycle_command(self, arguments):
yield lifecycle_command
cls.launch_lifecycle_command = launch_lifecycle_command

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_lifecycle_node_transitions(self):
with self.launch_lifecycle_command(
arguments=['list', 'test_lifecycle_node']
Expand All @@ -198,7 +198,7 @@ def test_list_lifecycle_node_transitions(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_all_lifecycle_node_transitions(self):
with self.launch_lifecycle_command(
arguments=['list', 'test_lifecycle_node', '-a']
Expand All @@ -211,7 +211,7 @@ def test_list_all_lifecycle_node_transitions(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_all_lifecycle_hidden_node_transitions_without_hidden_flag(self):
with self.launch_lifecycle_command(
arguments=['list', '_hidden_test_lifecycle_node', '-a']
Expand All @@ -224,7 +224,7 @@ def test_list_all_lifecycle_hidden_node_transitions_without_hidden_flag(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_all_lifecycle_hidden_node_transitions_with_hidden_flag(self):
with self.launch_lifecycle_command(
arguments=['list', '--include-hidden-nodes', '_hidden_test_lifecycle_node', '-a']
Expand All @@ -237,7 +237,7 @@ def test_list_all_lifecycle_hidden_node_transitions_with_hidden_flag(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_lifecycle_nodes(self):
with self.launch_lifecycle_command(arguments=['nodes']) as lifecycle_command:
assert lifecycle_command.wait_for_shutdown(timeout=20)
Expand All @@ -248,7 +248,7 @@ def test_list_lifecycle_nodes(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_all_lifecycle_nodes(self):
with self.launch_lifecycle_command(arguments=['nodes', '-a']) as lifecycle_command:
assert lifecycle_command.wait_for_shutdown(timeout=20)
Expand All @@ -262,7 +262,7 @@ def test_list_all_lifecycle_nodes(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_count_lifecycle_nodes(self):
with self.launch_lifecycle_command(arguments=['nodes', '-c']) as lifecycle_command:
assert lifecycle_command.wait_for_shutdown(timeout=20)
Expand All @@ -271,7 +271,7 @@ def test_count_lifecycle_nodes(self):
assert len(output_lines) == 1
assert int(output_lines[0]) == 1

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_count_all_lifecycle_nodes(self):
with self.launch_lifecycle_command(arguments=['nodes', '-a', '-c']) as lifecycle_command:
assert lifecycle_command.wait_for_shutdown(timeout=20)
Expand All @@ -280,7 +280,7 @@ def test_count_all_lifecycle_nodes(self):
assert len(output_lines) == 1
assert int(output_lines[0]) == 2

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_set_lifecycle_node_invalid_transition(self):
with self.launch_lifecycle_command(
arguments=['set', '/test_lifecycle_node', 'noop']
Expand All @@ -297,7 +297,7 @@ def test_set_lifecycle_node_invalid_transition(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_set_nonexistent_lifecycle_node_state(self):
with self.launch_lifecycle_command(
arguments=['set', '/nonexistent_test_lifecycle_node', 'configure']
Expand All @@ -310,7 +310,7 @@ def test_set_nonexistent_lifecycle_node_state(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_set_hidden_lifecycle_node_transition(self):
with self.launch_lifecycle_command(
arguments=['set', '/_hidden_test_lifecycle_node', 'configure']
Expand All @@ -323,7 +323,7 @@ def test_set_hidden_lifecycle_node_transition(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_get_nonexistent_lifecycle_node_state(self):
with self.launch_lifecycle_command(
arguments=['get', '/nonexistent_test_lifecycle_node']
Expand All @@ -336,7 +336,7 @@ def test_get_nonexistent_lifecycle_node_state(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_get_hidden_lifecycle_node_state(self):
with self.launch_lifecycle_command(
arguments=['get', '/_hidden_test_lifecycle_node']
Expand All @@ -360,7 +360,7 @@ def test_get_hidden_lifecycle_node_state(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_get_lifecycle_node_state(self):
with self.launch_lifecycle_command(
arguments=['get', '/test_lifecycle_node']
Expand All @@ -373,7 +373,7 @@ def test_get_lifecycle_node_state(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_node_lifecycle(self):
lifecycle = [
('unconfigured [1]', 'configure'),
Expand Down
14 changes: 7 additions & 7 deletions ros2node/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def launch_node_command(self, arguments):
yield node_command
cls.launch_node_command = launch_node_command

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_nodes(self):
with self.launch_node_command(arguments=['list']) as node_command:
assert node_command.wait_for_shutdown(timeout=10)
Expand All @@ -118,7 +118,7 @@ def test_list_nodes(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_all_nodes(self):
with self.launch_node_command(arguments=['list', '-a']) as node_command:
assert node_command.wait_for_shutdown(timeout=10)
Expand All @@ -132,7 +132,7 @@ def test_list_all_nodes(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_node_count(self):
with self.launch_node_command(arguments=['list', '-c']) as node_command:
assert node_command.wait_for_shutdown(timeout=10)
Expand All @@ -142,7 +142,7 @@ def test_list_node_count(self):
# Fixture nodes that are not hidden plus launch_ros node.
assert int(output_lines[0]) == 2

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_all_nodes_count(self):
with self.launch_node_command(arguments=['list', '-c', '-a']) as node_command:
assert node_command.wait_for_shutdown(timeout=10)
Expand All @@ -152,7 +152,7 @@ def test_list_all_nodes_count(self):
# All fixture nodes plus launch_ros and ros2cli daemon nodes.
assert int(output_lines[0]) == 4

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_info_node(self):
with self.launch_node_command(arguments=['info', '/complex_node']) as node_command:
assert node_command.wait_for_shutdown(timeout=10)
Expand Down Expand Up @@ -182,7 +182,7 @@ def test_info_node(self):
text=node_command.output, strict=False
), 'Output does not match:\n' + node_command.output

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_info_hidden_node_no_hidden_flag(self):
with self.launch_node_command(arguments=['info', '/_hidden_complex_node']) as node_command:
assert node_command.wait_for_shutdown(timeout=10)
Expand All @@ -192,7 +192,7 @@ def test_info_hidden_node_no_hidden_flag(self):
text=node_command.output, strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_info_hidden_node_hidden_flag(self):
with self.launch_node_command(
arguments=['info', '/_hidden_complex_node', '--include-hidden']
Expand Down
20 changes: 10 additions & 10 deletions ros2service/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def launch_service_command(self, arguments):
yield service_command
cls.launch_service_command = launch_service_command

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_services(self):
with self.launch_service_command(arguments=['list']) as service_command:
assert service_command.wait_for_shutdown(timeout=10)
Expand All @@ -146,7 +146,7 @@ def test_list_services(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_hidden(self):
with self.launch_service_command(
arguments=['--include-hidden-services', 'list']
Expand All @@ -168,7 +168,7 @@ def test_list_hidden(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_with_types(self):
with self.launch_service_command(arguments=['list', '-t']) as service_command:
assert service_command.wait_for_shutdown(timeout=10)
Expand All @@ -185,7 +185,7 @@ def test_list_with_types(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_list_count(self):
with self.launch_service_command(arguments=['list', '-c']) as service_command:
assert service_command.wait_for_shutdown(timeout=10)
Expand All @@ -194,7 +194,7 @@ def test_list_count(self):
assert len(output_lines) == 1
assert int(output_lines[0]) == 7 + 6 # cope with launch_ros internal node.

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_find(self):
with self.launch_service_command(
arguments=['find', 'test_msgs/srv/BasicTypes']
Expand All @@ -207,7 +207,7 @@ def test_find(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_find_hidden(self):
with self.launch_service_command(
arguments=['find', '--include-hidden-services', 'test_msgs/srv/BasicTypes']
Expand All @@ -220,7 +220,7 @@ def test_find_hidden(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_find_count(self):
with self.launch_service_command(
arguments=['find', '-c', 'test_msgs/srv/BasicTypes']
Expand Down Expand Up @@ -259,7 +259,7 @@ def test_type_on_not_a_service(self):
assert service_command.exit_code == 1
assert service_command.output == ''

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_call_no_args(self):
with self.launch_service_command(
arguments=['call', '/my_ns/echo', 'test_msgs/srv/BasicTypes']
Expand All @@ -272,7 +272,7 @@ def test_call_no_args(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_call(self):
with self.launch_service_command(
arguments=[
Expand All @@ -295,7 +295,7 @@ def test_call(self):
strict=True
)

@launch_testing.markers.retry_on_failure(times=5)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_repeated_call(self):
with self.launch_service_command(
arguments=[
Expand Down
Loading

0 comments on commit 09b1528

Please sign in to comment.