Skip to content

Commit bffbd3f

Browse files
committed
Reduce flakiness in ros2bag record tests via fixing their expectations
- Replace waiting for the `/rosout` topic on waiting for the rosbag2 internal `/events/write_split`. Rationale: The `/rosout` topic may not be enabled on the CI. - Replace expectation for the `Listening for topics...` on `Recording...` which is appearing at the very end of the Recorder::record(). Rationale: It was possible a race condition when test was sending the SIGINT while we haven't yet finished call for Recorder::record(). Signed-off-by: Michael Orlov <[email protected]>
1 parent 55dc41c commit bffbd3f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

ros2bag/test/test_record.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,10 @@ class TestRecord(unittest.TestCase):
5353

5454
def test_output(self, record_all_process, proc_output):
5555
proc_output.assertWaitFor(
56-
'Listening for topics...',
57-
process=record_all_process
58-
)
59-
proc_output.assertWaitFor(
60-
"Subscribed to topic '/rosout'",
56+
"Subscribed to topic '/events/write_split'",
6157
process=record_all_process
6258
)
59+
proc_output.assertWaitFor('Recording...', process=record_all_process)
6360

6461

6562
@launch_testing.post_shutdown_test()

ros2bag/test/test_record_qos_profiles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_qos_simple(self):
8484
output_path = Path(self.tmpdir.name) / 'ros2bag_test_basic'
8585
arguments = ['record', '-a', '--qos-profile-overrides-path', profile_path.as_posix(),
8686
'--output', output_path.as_posix()]
87-
expected_output = 'Listening for topics...'
87+
expected_output = 'Recording...'
8888
with self.launch_bag_command(arguments=arguments) as bag_command:
8989
bag_command.wait_for_output(
9090
condition=lambda output: expected_output in output,
@@ -99,7 +99,7 @@ def test_incomplete_qos_profile(self):
9999
output_path = Path(self.tmpdir.name) / 'ros2bag_test_incomplete'
100100
arguments = ['record', '-a', '--qos-profile-overrides-path', profile_path.as_posix(),
101101
'--output', output_path.as_posix()]
102-
expected_output = 'Listening for topics...'
102+
expected_output = 'Recording...'
103103
with self.launch_bag_command(arguments=arguments) as bag_command:
104104
bag_command.wait_for_output(
105105
condition=lambda output: expected_output in output,

0 commit comments

Comments
 (0)