Skip to content

Commit

Permalink
Merge pull request #1868 from loadimpact/fixRaceInSummaryTest
Browse files Browse the repository at this point in the history
Fix race condition in TestTextSummary
  • Loading branch information
mstoykov committed Feb 23, 2021
2 parents a85664b + fb27c89 commit 51790fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const (
func TestTextSummary(t *testing.T) {
t.Parallel()

summary := createTestSummary(t)
testCases := []struct {
stats []string
expected string
Expand All @@ -70,6 +69,7 @@ func TestTextSummary(t *testing.T) {
i, tc := i, tc
t.Run(fmt.Sprintf("%d_%v", i, tc.stats), func(t *testing.T) {
t.Parallel()
summary := createTestSummary(t)
trendStats, err := json.Marshal(tc.stats)
require.NoError(t, err)
runner, err := getSimpleRunner(
Expand All @@ -88,9 +88,9 @@ func TestTextSummary(t *testing.T) {
require.Len(t, result, 1)
stdout := result["stdout"]
require.NotNil(t, stdout)
summary, err := ioutil.ReadAll(stdout)
summaryOut, err := ioutil.ReadAll(stdout)
require.NoError(t, err)
assert.Equal(t, "\n"+tc.expected+"\n", string(summary))
assert.Equal(t, "\n"+tc.expected+"\n", string(summaryOut))
})
}
}
Expand Down

0 comments on commit 51790fc

Please sign in to comment.