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

refactor(tests): testifylint don't use Equal for floating point tests #13459

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

Joibel
Copy link
Member

@Joibel Joibel commented Aug 12, 2024

Part of the refactor started by #13365 to enable us to use testifylint, shift to using InEpsilon or InDelta for floating point comparisons. Mostly use InEpsilon as it is more resilient, but using InDelta for testing against zero.

Reviewers: As with the others in this series, please feel free to apply patches as you see fit.

Part of the refactor to enable us to use testifylint, shift to using
InEpsilon or InDelta for floating point comparisons

Signed-off-by: Alan Clucas <alan@clucas.org>
@Joibel Joibel self-assigned this Aug 12, 2024
@Joibel Joibel added the area/build Build or GithubAction/CI issues label Aug 12, 2024
@Joibel Joibel removed their assignment Aug 12, 2024
@Joibel Joibel enabled auto-merge (squash) August 12, 2024 14:45
@agilgur5 agilgur5 changed the title refactor(tests): testifylint don't use Equal for floating point tests refactor(tests): testifylint don't use Equal for floating point tests Aug 12, 2024
Copy link
Member

@agilgur5 agilgur5 left a comment

Choose a reason for hiding this comment

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

Code LGTM, but one question: Does testifylint require this? For general floating point arithmetic, this makes sense, but it seems like all of the cases here do not involve large or long floats and so don't have the same chance of being inaccurate (and the tests passed before too)

@Joibel Joibel merged commit 9490db7 into main Aug 13, 2024
31 checks passed
@Joibel Joibel deleted the testifylint-floats branch August 13, 2024 20:57
@agilgur5
Copy link
Member

Mmm I'm going to suggest the same as I did in #13406 (comment) that auto-merge before approval is an anti-pattern. I didn't even notice it was enabled here

@Joibel
Copy link
Member Author

Joibel commented Aug 14, 2024

Code LGTM, but one question: Does testifylint require this? For general floating point arithmetic, this makes sense, but it seems like all of the cases here do not involve large or long floats and so don't have the same chance of being inaccurate (and the tests passed before too)

Yes it does. Well, it is a default enabled linter which I agree with. It seems unlikely that rounding will affect the tests in question, but it felt better to leave the linter on.

Mmm I'm going to suggest the same as I did in #13406 (comment) that auto-merge before approval is an anti-pattern. I didn't even notice it was enabled here

Sorry, I missed that comment. I'll try to remember we're not using that here in future.

@Joibel
Copy link
Member Author

Joibel commented Aug 14, 2024

Also worth noting that most of these are removed by #13265 where I've moved metrics which make most sense as integers to be integers.

@agilgur5
Copy link
Member

agilgur5 commented Aug 14, 2024

Well, it is a default enabled linter which I agree with. It seems unlikely that rounding will affect the tests in question, but it felt better to leave the linter on.

Yea I prefer to stick with the defaults generally as well (for the same reasons that go fmt, prettier, and standard exist), just wanted to make sure.

Sorry, I missed that comment. I'll try to remember we're not using that here in future.

It's main use-case is to auto-merge once CI/tests are complete, so I think it only makes sense to use after a PR has been approved such that all changes (including to title and co-authors) are already in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Build or GithubAction/CI issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants