Skip to content

Commit

Permalink
Reduce raciness in test
Browse files Browse the repository at this point in the history
fetchSegsFromDBRetry select on ctx.Done() and time.After().
If the setup/calling of ctx.Done() takes more than what we pass in time.After,
it can be that both channels are ready at the same time and then the test might fail.

By increasing the timeout in the test this should no longer be a problem.
  • Loading branch information
lukedirtwalker committed Oct 18, 2018
1 parent 456aab0 commit edc2d12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go/path_srv/internal/handlers/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func Test_FetchDBRetry(t *testing.T) {
)
h := baseHandler{
pathDB: m,
retryInt: time.Microsecond,
retryInt: 100 * time.Microsecond,
}
_, err := h.fetchSegsFromDBRetry(ctx, nil)
SoMsg("Expect context err", err, ShouldEqual, ctx.Err())
Expand All @@ -60,7 +60,7 @@ func Test_FetchDBRetry(t *testing.T) {
)
h := baseHandler{
pathDB: m,
retryInt: time.Microsecond,
retryInt: 100 * time.Microsecond,
revCache: memrevcache.New(time.Second, time.Second),
}
_, err := h.fetchSegsFromDBRetry(context.Background(), nil)
Expand Down

0 comments on commit edc2d12

Please sign in to comment.