Skip to content

Add RunOnFailure option#129

Merged
sywhang merged 1 commit intouber-go:masterfrom
sywhang:sungyoon/128
Oct 1, 2024
Merged

Add RunOnFailure option#129
sywhang merged 1 commit intouber-go:masterfrom
sywhang:sungyoon/128

Conversation

@sywhang
Copy link
Copy Markdown
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.
@codecov
Copy link
Copy Markdown

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
Comment thread testmain.go
errorMsg string
)

if !opts.runOnFailure && exitCode == 0 {
Copy link
Copy Markdown

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
	}

Copy link
Copy Markdown

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