Skip to content

fix: remove use of testing.T.FailNow() inside goroutine - #1601

Merged
bai merged 1 commit into
IBM:masterfrom
alrs:fix-test-goroutine
Feb 6, 2020
Merged

bai merged 1 commit into
IBM:masterfrom
alrs:fix-test-goroutine

Conversation

@alrs

@alrs alrs commented Feb 5, 2020

Copy link
Copy Markdown
Contributor

This fixes TestClientAutoRefreshShutdownRace() to not fire t.Fatal() inside a goroutine.

t.Fatal() is a convenience function that calls t.Log() and t.FailNow(). t.FailNow() should not be called from inside a goroutine. From the godoc:

FailNow must be called from the goroutine running the test or benchmark function, not from other goroutines created during the test.

This replaces the done channel with an error channel, and tests the error variable outside the goroutine.

@alrs
alrs requested a review from bai as a code owner February 5, 2020 17:22
@ghost ghost added the cla-needed label Feb 5, 2020
@alrs

alrs commented Feb 5, 2020

Copy link
Copy Markdown
Contributor Author

I'm happy to fill out a CLA, should someone provide a link to one.

@alrs alrs changed the title fix: remove use of t.testing.FailNow() inside goroutine fix: remove use of testing.T.FailNow() inside goroutine Feb 5, 2020
@bai

bai commented Feb 5, 2020

Copy link
Copy Markdown
Contributor

@alrs

alrs commented Feb 5, 2020

Copy link
Copy Markdown
Contributor Author

@bai CLA is complete.

@ghost ghost removed the cla-needed label Feb 5, 2020
@bai

bai commented Feb 6, 2020

Copy link
Copy Markdown
Contributor

Thanks for contributing.

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.

2 participants