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

Add RunOnFailure option #129

Merged
merged 1 commit into from
Oct 1, 2024
Merged

Add RunOnFailure option #129

merged 1 commit into from
Oct 1, 2024

Conversation

sywhang
Copy link
Contributor

@sywhang sywhang commented Oct 1, 2024

This adds an Option to run goleak when test runs fail.

Fixes #128.

This adds an Option to run goleak when test runs fail.

Fixes uber-go#128.
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.20%. Comparing base (898a938) to head (c12ec8f).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #129      +/-   ##
==========================================
+ Coverage   99.14%   99.20%   +0.06%     
==========================================
  Files           5        5              
  Lines         234      252      +18     
==========================================
+ Hits          232      250      +18     
  Misses          1        1              
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sywhang sywhang merged commit 7452c70 into uber-go:master Oct 1, 2024
7 checks passed
errorMsg string
)

if !opts.runOnFailure && exitCode == 0 {

Choose a reason for hiding this comment

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

I don't think opts.runOnFailure should matter here.
to keep the old behaviour, we only need to check on exitCode.

	if exitCode == 0 {
		errorMsg = "goleak: Errors on successful test run:%v\n"
		run = true
	} else if opts.runOnFailure {
		errorMsg = "goleak: Errors on unsuccessful test run: %v\n"
		run = true
	}

Choose a reason for hiding this comment

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

I opened #132 in case this went unnoticed

machine424 added a commit to machine424/uber-goleak that referenced this pull request Oct 10, 2024
…ailure() option is used.

adjust RunOnFailure() doc.

follow up to uber-go#129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow VerifyTestMain to check for leaks even when the tests fail
3 participants