Merged
Conversation
This adds Cleanup option which can be passed to VerifyTestMain and VerifyNone. This takes in a function that will be executed at the end of the leak verification. Internal Ref: GO-888
Codecov Report
@@ Coverage Diff @@
## master #78 +/- ##
==========================================
+ Coverage 94.11% 94.92% +0.80%
==========================================
Files 5 5
Lines 119 138 +19
==========================================
+ Hits 112 131 +19
Misses 4 4
Partials 3 3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
abhinav
reviewed
Sep 6, 2022
options.go
Outdated
| } | ||
|
|
||
| // Cleanup sets up a cleanup function that will be executed at the | ||
| // end of the leak. |
Comment on lines
+54
to
+57
| opts := buildOpts(options...) | ||
|
|
||
| if exitCode == 0 { | ||
| if err := Find(options...); err != nil { | ||
| if err := Find(opts); err != nil { |
Collaborator
There was a problem hiding this comment.
Won't this end up passing a opts to Find that has teardown set to non-nil? Same for VerifyNone.
Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
rabbbit
reviewed
Sep 6, 2022
abhinav
approved these changes
Sep 6, 2022
Collaborator
abhinav
left a comment
There was a problem hiding this comment.
LGTM overall but I think there are a couple maintainability improvements we could make
Comment on lines
+51
to
+52
| assert.Contains(t, err.Error(), "blockedG") | ||
| assert.Contains(t, err.Error(), "created by go.uber.org/goleak.startBlockedG") |
Collaborator
There was a problem hiding this comment.
Suggested change
| assert.Contains(t, err.Error(), "blockedG") | |
| assert.Contains(t, err.Error(), "created by go.uber.org/goleak.startBlockedG") | |
| assert.ErrorContains(t, err, "blockedG") | |
| assert.ErrorContains(t, err, "created by go.uber.org/goleak.startBlockedG") |
Contributor
Author
There was a problem hiding this comment.
ack. This doesn't look doable rn because we're using 1.7.0 testify, and ErrorContains was introduced in 1.7.1. I'll follow up with another PR to address this.
abhinav
approved these changes
Sep 6, 2022
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.
This adds Cleanup option which can be passed to VerifyTestMain and
VerifyNone. This takes in a function that will be executed at the
end of the leak verification.
Internal Ref: GO-888
Fix #63