Skip to content

test: add regression test for KEEP_ALL QoS with transient-local caching#3152

Open
tonynajjar wants to merge 2 commits into
ros2:rollingfrom
botsandus:keep-all-events-executor-test
Open

test: add regression test for KEEP_ALL QoS with transient-local caching#3152
tonynajjar wants to merge 2 commits into
ros2:rollingfrom
botsandus:keep-all-events-executor-test

Conversation

@tonynajjar
Copy link
Copy Markdown
Contributor

Description

Add a regression test for EventsExecutor that verifies transient-local cached messages are correctly delivered to subscribers using KEEP_ALL history QoS.

This test covers the scenario where a publisher with transient_local + reliable + depth=1 publishes before the subscriber exists, and the subscriber (with KEEP_ALL + transient_local + reliable QoS) joins later using EventsExecutor. The DDS cache should deliver the message to the late-joining subscriber.

This pattern is exercised in production by rosbag2's adapt_request_to_offers, which creates KEEP_ALL subscriptions when the publisher has depth=1 (e.g. /tf_static).

The test catches a bug in rmw_cyclonedds_cpp where rmw_subscription_set_on_new_message_callback clips the unread count to depth via std::min(unread_count, depth). For KEEP_ALL, depth is reported as 0, so the callback fires with 0 events and the executor never processes the cached messages. See ros2/rmw_cyclonedds#584

Fixes # (issue)

Is this user-facing behavior change?

No — test-only change.

Did you use Generative AI?

Yes — GitHub Copilot (Claude Opus 4.6) was used to write the regression test.

Additional Information

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>
Signed-off-by: Tony Najjar <tony.najjar@dexory.com>
@tonynajjar
Copy link
Copy Markdown
Contributor Author

tonynajjar commented May 18, 2026

@jmachowinski 👋 could you run CI on this PR to confirm that this test currently fails? The fix is here: ros2/rmw_cyclonedds#584 - after the first CI fail, is there a way to run CI with a specific commit of rmw_cyclonedds so we can confirm that it passes? If not then I'll just have to trust my local setup experimentation and merge the rmw_cyclonedds fix - then we run CI again to confirm that it passes

Copy link
Copy Markdown
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with green CI.

// This test publishes before the subscriber exists (transient-local caching),
// then subscribes with KEEP_ALL + transient-local via EventsExecutor and
// verifies the cached message is delivered.
TEST_F(TestEventsExecutor, keep_all_transient_local_receives_cached_message)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(i think) although this test only runs on the default rnw implementation (or rmw implementation in user's configuration), nightly CI matrix (ci.ros2.org) does run per-RMW jobs to catch this failure.

@fujitatomoya
Copy link
Copy Markdown
Collaborator

Pulls: #3152, ros2/rmw_cyclonedds#584
Gist: https://gist.githubusercontent.com/fujitatomoya/ce19012021d50f085f751938b11facc8/raw/e1e1d22d20dbc7d82ad9b0d44fea5d927e8006de/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp rmw_cyclonedds_cpp
TEST args: --packages-above rclcpp rmw_cyclonedds_cpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19303

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@tonynajjar
Copy link
Copy Markdown
Contributor Author

tonynajjar commented May 18, 2026

Thanks @fujitatomoya. And one more detail, this was tested on Kilted and I know some work has been put since then on the EventsExecutor so there is a chance that we don't get a CI failure - but let's see

@fujitatomoya
Copy link
Copy Markdown
Collaborator

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@mjcarroll
Copy link
Copy Markdown
Member

CC: @skyegalaxy for expanding this to cover the CBGExecutor as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants