Skip to content

Fix wrench transformer namespace test flake - #2492

Merged
christophfroehlich merged 1 commit into
ros-controls:masterfrom
dlanov:fix-wrench-transformer-graph-flake
Jul 29, 2026
Merged

Fix wrench transformer namespace test flake#2492
christophfroehlich merged 1 commit into
ros-controls:masterfrom
dlanov:fix-wrench-transformer-graph-flake

Conversation

@dlanov

@dlanov dlanov commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix the flaky wrench transformer namespace tests by replacing timing-sensitive, one-shot ROS graph checks with bounded polling.

Changes

  • Add a test helper that waits for a publisher on an exact topic using the ROS graph API.
  • Update the root-namespace and custom-namespace tests to use bounded polling.
  • Preserve the existing topic-name assertions.
  • Keep the change limited to test code; no production behavior is modified.

Testing

  • colcon build --symlink-install --packages-up-to force_torque_sensor_broadcaster --cmake-args -DBUILD_TESTING=ON

  • colcon test --packages-select force_torque_sensor_broadcaster --event-handlers console_cohesion+

  • colcon test-result --verbose

  • Repeated both namespace tests 100 times:

    • TestWrenchTransformer.NamespaceNormalizationRootNamespace
    • TestWrenchTransformer.NamespaceNormalizationCustomNamespace
  • pre-commit run --files force_torque_sensor_broadcaster/test/test_wrench_transformer.cpp

  • git diff --check

Results:

  • 35 package tests
  • 0 errors
  • 0 failures
  • 0 skipped
  • 100 repeated namespace-test iterations passed
  • All applicable pre-commit checks passed

Closes #2487

AI assistance

Claude Code assisted with analyzing and preparing the narrowly scoped test change. I manually reviewed the complete diff and verified the build, package tests, repeated stress tests, formatting, lint, and whitespace-check results.

Signed-off-by: Dennis Lanov <dennis.lanov@gmail.com>
{
for (int attempts = 0; attempts < max_attempts; ++attempts)
{
if (check_publisher_exists_via_graph(node, topic_name))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this API compatible on Humble?

Let's see what the CI says

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.85%. Comparing base (c7b97ca) to head (3d2b5ed).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...ensor_broadcaster/test/test_wrench_transformer.cpp 33.33% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2492      +/-   ##
==========================================
+ Coverage   86.83%   86.85%   +0.01%     
==========================================
  Files         148      148              
  Lines       16273    16267       -6     
  Branches     1368     1367       -1     
==========================================
- Hits        14131    14128       -3     
+ Misses       1635     1632       -3     
  Partials      507      507              
Flag Coverage Δ
unittests 86.85% <33.33%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ensor_broadcaster/test/test_wrench_transformer.cpp 92.02% <33.33%> (+0.16%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@christophfroehlich christophfroehlich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@christophfroehlich christophfroehlich added backport-humble Triggers PR backport to ROS 2 humble. backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted. labels Jul 29, 2026
@christophfroehlich
christophfroehlich merged commit be6f504 into ros-controls:master Jul 29, 2026
27 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-humble Triggers PR backport to ROS 2 humble. backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestWrenchTransformer is flaky

3 participants