From 88333ee77fbdc2a4c0879f947ce86e2627f12028 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 5 Nov 2020 16:04:00 +0800 Subject: [PATCH] faster the tests --- core/stores/sqlc/cachedsql_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/stores/sqlc/cachedsql_test.go b/core/stores/sqlc/cachedsql_test.go index dd1c0448..3ce899fe 100644 --- a/core/stores/sqlc/cachedsql_test.go +++ b/core/stores/sqlc/cachedsql_test.go @@ -16,6 +16,7 @@ import ( "github.com/alicebob/miniredis" "github.com/stretchr/testify/assert" + "github.com/tal-tech/go-zero/core/fx" "github.com/tal-tech/go-zero/core/logx" "github.com/tal-tech/go-zero/core/stat" "github.com/tal-tech/go-zero/core/stores/cache" @@ -474,7 +475,10 @@ func TestCachedConnExec(t *testing.T) { func TestCachedConnExecDropCache(t *testing.T) { r, err := miniredis.Run() assert.Nil(t, err) - defer r.Close() + defer fx.DoWithTimeout(func() error { + r.Close() + return nil + }, time.Second) const ( key = "user"