Skip to content

Conversation

kevsecurity
Copy link
Contributor

Most of the places where we have been using assert in tests, we really wanted the tests to fail at those points and not continue. In these cases, we should use require instead as it does just that. This commit changes a lot of asserts to requires.

Most of the places where we have been using assert in tests, we really
wanted the tests to fail at those points and not continue. In these
cases, we should use require instead as it does just that. This commit
changes a lot of asserts to requires.

Signed-off-by: Kevin Sheldrake <[email protected]>
Most of the places where we have been using assert in tests, we really
wanted the tests to fail at those points and not continue. In these
cases, we should use require instead as it does just that. This commit
changes a lot of asserts to requires.

Signed-off-by: Kevin Sheldrake <[email protected]>
@kevsecurity kevsecurity added the release-note/misc This PR makes changes that have no direct user impact. label May 22, 2025
@kevsecurity kevsecurity marked this pull request as ready for review May 22, 2025 15:33
@kevsecurity kevsecurity requested a review from a team as a code owner May 22, 2025 15:33
@kevsecurity kevsecurity requested review from a user and mtardy May 22, 2025 15:33
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

looks innocent

Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

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

yeah this is especially important in the case where we have a function that can return a nul pointer and thus in the case of error, the test panics. I think this is generally done with https://github.com/Antonboom/testifylint. I might try to enable that.

@kevsecurity kevsecurity merged commit 59fe570 into main May 22, 2025
48 checks passed
@kevsecurity kevsecurity deleted the pr/kevsecurity/use-require-instead-of-assert branch May 22, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants