Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky transmission_interface tests by making them deterministic. (backport #1665) #1670

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Aug 13, 2024

Fixes #1555

The transmission_interface tests would give non deterministic spurious failures. The non determinism was because tests were randomly generated using the system time to seed the random number generator. The spurious failures were due to occasionally occurring tiny rounding errors from floating point math.

By seeding the random number generator the tests become deterministic and we avoid the spurious failures.
Additionally, changing the order of some of the multiplications seems to reduce the rounding error.

Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

  1. Limited scope. Your PR should do one thing or one set of things. Avoid adding “random fixes” to PRs. Put those on separate PRs.
  2. Give your PR a descriptive title. Add a short summary, if required.
  3. Make sure the pipeline is green.
  4. Don’t be afraid to request reviews from maintainers.
  5. New code = new tests. If you are adding new functionality, always make sure to add some tests exercising the code and serving as live documentation of your original intention.

To send us a pull request, please:

  • Fork the repository.
  • Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
  • Ensure local tests pass. (colcon test and pre-commit run (requires you to install pre-commit by pip3 install pre-commit)
  • Commit to your fork using clear commit messages.
  • Send a pull request, answering any default questions in the pull request interface.
  • Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

This is an automatic backport of pull request #1665 done by [Mergify](https://mergify.com).

…1665)

(cherry picked from commit ace8416)

# Conflicts:
#	transmission_interface/test/random_generator_utils.hpp
Copy link
Contributor Author

mergify bot commented Aug 13, 2024

Cherry-pick of ace8416 has failed:

On branch mergify/bp/humble/pr-1665
Your branch is up to date with 'origin/humble'.

You are currently cherry-picking commit ace8416.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   transmission_interface/include/transmission_interface/four_bar_linkage_transmission.hpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   transmission_interface/test/random_generator_utils.hpp

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot added the conflicts label Aug 13, 2024
Copy link

codecov bot commented Aug 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.98%. Comparing base (c04a16f) to head (2445d29).
Report is 13 commits behind head on humble.

Additional details and impacted files
@@            Coverage Diff             @@
##           humble    #1670      +/-   ##
==========================================
- Coverage   87.00%   86.98%   -0.02%     
==========================================
  Files          97       97              
  Lines        7505     7509       +4     
  Branches      677      677              
==========================================
+ Hits         6530     6532       +2     
- Misses        688      690       +2     
  Partials      287      287              
Flag Coverage Δ
unittests 86.98% <100.00%> (-0.02%) ⬇️

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

Files Coverage Δ
...ission_interface/four_bar_linkage_transmission.hpp 78.57% <100.00%> (ø)
...smission_interface/test/random_generator_utils.hpp 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@bmagyar bmagyar merged commit 8a3ac66 into humble Aug 14, 2024
10 of 11 checks passed
@bmagyar bmagyar deleted the mergify/bp/humble/pr-1665 branch August 14, 2024 10:56
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