Run concurrent dev server starts as parallel subtests#1026
Open
highlyavailable wants to merge 1 commit into
Open
Run concurrent dev server starts as parallel subtests#1026highlyavailable wants to merge 1 commit into
highlyavailable wants to merge 1 commit into
Conversation
TestServer_StartDev_ConcurrentStarts spawned its worker goroutines by hand and called the require helpers (and the harness, which wraps them) from inside those goroutines. testify's require helpers call t.FailNow, which Go only permits from the goroutine running the test, so any failure it reported was unreliable and masked the real cause. Each instance now runs as a parallel subtest with its own *testing.T, so the require helpers run on a goroutine where FailNow is valid. A buffered channel caps concurrency at 8, matching the original intent.
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.
TestServer_StartDev_ConcurrentStartsspawned its worker goroutines by hand and called the testifyrequirehelpers from inside them, both directly and through the test harness.requirecallst.FailNow, which Go only allows from the goroutine running the test, so any failure it hit was reported unreliably.Each instance now runs as a parallel subtest with its own
*testing.T, so the assertions run on a goroutine whereFailNowis valid. A buffered channel caps concurrency at 8, same as before.While verifying with
-race, the corrected test surfaced a real data race ininitCommand: concurrentExecute()calls read and write the globalcolor.NoColorfromfatih/color. That looks like the actual flakiness this test was meant to catch. It's a separate production bug so I've left it out of this PR and filed it as #1027.Refs #581