Skip to content

Commit

Permalink
make tests faster
Browse files Browse the repository at this point in the history
  • Loading branch information
kevwan committed Oct 10, 2020
1 parent 0a9c427 commit a1b141d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions core/stores/cache/cachenode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/alicebob/miniredis"
"github.com/stretchr/testify/assert"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/core/mathx"
"github.com/tal-tech/go-zero/core/stat"
Expand Down Expand Up @@ -181,10 +182,18 @@ func TestCacheNode_String(t *testing.T) {

func TestCacheValueWithBigInt(t *testing.T) {
s, err := miniredis.Run()
if err != nil {
t.Error(err)
}
defer s.Close()
assert.Nil(t, err)
defer func() {
ch := make(chan lang.PlaceholderType)
go func() {
s.Close()
close(ch)
}()
select {
case <-ch:
case <-time.After(time.Second):
}
}()

cn := cacheNode{
rds: redis.NewRedis(s.Addr(), redis.NodeType),
Expand Down

0 comments on commit a1b141d

Please sign in to comment.