Skip to content

Expect event callbacks only for handlers that were created - #3461

Merged
ahcorde merged 1 commit into
ros2:rollingfrom
benaliabderrahmane:fix/test-event-callbacks-per-handler
Dec 2, 2026
Merged

ahcorde merged 1 commit into
ros2:rollingfrom
benaliabderrahmane:fix/test-event-callbacks-per-handler

Conversation

@benaliabderrahmane

@benaliabderrahmane benaliabderrahmane commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

disable_enable_event_callbacks (test_subscription) and disable_enable_subscription_event_callbacks (test_generic_pubsub), added in #2985, expect deadline and liveliness callbacks to run. rclcpp creates no handler for an event type the RMW doesn't support (bind_event_callbacks catches it and warns), so on such an RMW the count stays 0 and the test fails although enable/disable works. Expected counts now come from the handlers that exist; skip only if neither exists. This also drops the rmw_zenoh skip in test_generic_pubsub, since test_subscription runs the same body on Zenoh without one and passes.

The tests was added because I'm trying to make a new rmw (rmw_unix_socket_cpp) that doesn't support deadline pass the nightly tests, without adding a new if along the zenoh condition

Is this user-facing behavior change?

No (test only).

Did you use Generative AI?

Yes, Claude Code and I reviewed and tested it
.

Additional Information

Both tests pass with the change on Fast DDS, Cyclone DDS, rmw_zenoh_cpp (the generic one now runs instead of skipping) and rmw_unix_socket_cpp (0 deadline, 1 liveliness callback), tested on Lyrical (rclcpp 32.0.3, same test bodies as rolling).

Why not rmw_event_type_is_supported: rmw_zenoh answers "unsupported" but still creates the handlers, so its callbacks do run.

disable_enable_event_callbacks and its generic pubsub twin expect the
deadline and liveliness callbacks to run. rclcpp creates no handler for an
event type the RMW doesn't support (it only warns), so on such an RMW the
count stays at 0 and the test fails although enabling and disabling work.
Derive the expected counts from the handlers that exist and skip only when
there are none.

This drops the rmw_zenoh skip in test_generic_pubsub as well: test_subscription
runs the same body on rmw_zenoh_cpp without a skip and passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012EJmdSvyUzRoZmYQKqLnjQ
Signed-off-by: Abderahmane Benali <46283596+benaliabderrahmane@users.noreply.github.com>
@benaliabderrahmane
benaliabderrahmane force-pushed the fix/test-event-callbacks-per-handler branch from 5ffe1e6 to 98b6fa8 Compare December 1, 2026 15:47
@benaliabderrahmane
benaliabderrahmane marked this pull request as ready for review December 1, 2026 15:48
@jmachowinski

Copy link
Copy Markdown
Collaborator

Pulls: #3461
Gist: https://gist.githubusercontent.com/jmachowinski/19ff37309c7dc311bce4e206d130baad/raw/be182cb6389a45e09b4dbee4525f704efb582da9/ros2.repos
BUILD args:
TEST args:
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/21424

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

@ahcorde
ahcorde merged commit 06702a1 into ros2:rolling Dec 2, 2026
2 of 3 checks passed
@ahcorde

ahcorde commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

https://github.com/Mergifyio backport lyrical

@mergify

mergify Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

backport lyrical

✅ Backports have been created

Details

ahcorde pushed a commit that referenced this pull request Dec 2, 2026
…3465)

disable_enable_event_callbacks and its generic pubsub twin expect the
deadline and liveliness callbacks to run. rclcpp creates no handler for an
event type the RMW doesn't support (it only warns), so on such an RMW the
count stays at 0 and the test fails although enabling and disabling work.
Derive the expected counts from the handlers that exist and skip only when
there are none.

This drops the rmw_zenoh skip in test_generic_pubsub as well: test_subscription
runs the same body on rmw_zenoh_cpp without a skip and passes.

Claude-Session: https://claude.ai/code/session_012EJmdSvyUzRoZmYQKqLnjQ



(cherry picked from commit 06702a1)

Signed-off-by: Abderahmane Benali <46283596+benaliabderrahmane@users.noreply.github.com>
Co-authored-by: Abderahmane BENALI <46283596+benaliabderrahmane@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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