-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: Close metric scope after tests finish #5889
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
Merged
lukemassa
merged 13 commits into
runatlantis:main
from
lukemassa:close_logger_after_test_finishes
Dec 2, 2025
Merged
fix: Close metric scope after tests finish #5889
lukemassa
merged 13 commits into
runatlantis:main
from
lukemassa:close_logger_after_test_finishes
Dec 2, 2025
Conversation
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
Signed-off-by: Luke Massa <[email protected]>
Signed-off-by: Luke Massa <[email protected]>
Signed-off-by: Luke Massa <[email protected]>
503f22f to
18279b4
Compare
jamengual
previously approved these changes
Dec 1, 2025
Signed-off-by: Luke Massa <[email protected]>
jamengual
approved these changes
Dec 2, 2025
WebOfNakedFancies
pushed a commit
to WebOfNakedFancies/atlantis
that referenced
this pull request
Dec 2, 2025
Signed-off-by: Luke Massa <[email protected]> Signed-off-by: WebOfNakedFancies <[email protected]>
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.
what
Add a helper to close close metrics scope when tests are finished, use it throughout tests.
why
I was trying to use go's race detector on the unit tests, and running into these errors:
I dug into it and the issue wasn't with that race detector detected a data race, it's because the race detector reordered some code exposing a bug where we in many places create a new scope but then discard its
closer. Metrics are emitted during the tests, so if we don't close it, with the reordering, the metrics try to write to t.Log() in test that has already ended.This code consolidates the places where we create a new metrics scope, and properly calls a Cleanup() handler to close the scope when the test is done.
I did most of the conversions
tests
Running CI
references
N/A