Skip to content

Commit

Permalink
Fix race condition in web vital unit test
Browse files Browse the repository at this point in the history
This returns when all the conditions are met from within the goroutine
so that the expected map is not written to once the context is
cancelled.
  • Loading branch information
ankur22 committed May 23, 2023
1 parent e8b4d6e commit da822f3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/webvital_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func TestWebVitalMetric(t *testing.T) {
}
if count == len(expected) {
cancel()
break
}
}
}()
Expand Down

0 comments on commit da822f3

Please sign in to comment.