Fix: a data race condition after a timeout on an assert.Eventually call.#1779
Open
kcross-ctoken wants to merge 1 commit into
Open
Fix: a data race condition after a timeout on an assert.Eventually call.#1779kcross-ctoken wants to merge 1 commit into
assert.Eventually call.#1779kcross-ctoken wants to merge 1 commit into
Conversation
…t.Eventually` timeout
assert.Eventuallyassert.Eventually call.
brackendawson
requested changes
Aug 17, 2025
Collaborator
brackendawson
left a comment
There was a problem hiding this comment.
I think you've found a valid bug but your fix changes the behavior of Eventually. Right now it will return and fail the test as soon as the timeout is hit but with this change it will now wait until the last condition function returns. While I actually think waiting is the better behavior it's not something we can just go changing.
This also doesn't fix the issue for other Eventually/Consistently/Never assertions.
Collaborator
|
#1657 would resolve the issue here I believe. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a data race when using assert.Eventually so the variables can be safely used after a timeout
This was found in my test code when the eventually timed out and I was using something set in the closure. It required the
--racego testparameter set.Changes
added a wait group to wait for the end of the go routine call in assert.Eventually