mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-02-03 08:48:40 +08:00
make tests faster
This commit is contained in:
parent
0a9c427443
commit
a1b141d31a
15
core/stores/cache/cachenode_test.go
vendored
15
core/stores/cache/cachenode_test.go
vendored
@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/alicebob/miniredis"
|
"github.com/alicebob/miniredis"
|
||||||
"github.com/stretchr/testify/assert"
|
"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/logx"
|
||||||
"github.com/tal-tech/go-zero/core/mathx"
|
"github.com/tal-tech/go-zero/core/mathx"
|
||||||
"github.com/tal-tech/go-zero/core/stat"
|
"github.com/tal-tech/go-zero/core/stat"
|
||||||
@ -181,10 +182,18 @@ func TestCacheNode_String(t *testing.T) {
|
|||||||
|
|
||||||
func TestCacheValueWithBigInt(t *testing.T) {
|
func TestCacheValueWithBigInt(t *testing.T) {
|
||||||
s, err := miniredis.Run()
|
s, err := miniredis.Run()
|
||||||
if err != nil {
|
assert.Nil(t, err)
|
||||||
t.Error(err)
|
defer func() {
|
||||||
|
ch := make(chan lang.PlaceholderType)
|
||||||
|
go func() {
|
||||||
|
s.Close()
|
||||||
|
close(ch)
|
||||||
|
}()
|
||||||
|
select {
|
||||||
|
case <-ch:
|
||||||
|
case <-time.After(time.Second):
|
||||||
}
|
}
|
||||||
defer s.Close()
|
}()
|
||||||
|
|
||||||
cn := cacheNode{
|
cn := cacheNode{
|
||||||
rds: redis.NewRedis(s.Addr(), redis.NodeType),
|
rds: redis.NewRedis(s.Addr(), redis.NodeType),
|
||||||
|
Loading…
Reference in New Issue
Block a user