Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
janos committed Feb 8, 2020
1 parent ea5c1f5 commit 17c785a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions singleflight_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ func TestDo_cancelContextSecond(t *testing.T) {
time.Sleep(time.Second)
return want, nil
}
go g.Do(context.Background(), "key", fn)

go func() {
if _, _, err := g.Do(context.Background(), "key", fn); err != nil {
panic(err)
}
}()
ctx, cancel := context.WithCancel(context.Background())
go func() {
time.Sleep(100 * time.Millisecond)
Expand Down Expand Up @@ -197,7 +200,11 @@ func TestForget(t *testing.T) {
return wantPrefix + strconv.FormatUint(c, 10), nil
}

go g.Do(context.Background(), "key", fn)
go func() {
if _, _, err := g.Do(context.Background(), "key", fn); err != nil {
panic(err)
}
}()

<-firstCall
g.Forget("key")
Expand Down

0 comments on commit 17c785a

Please sign in to comment.