From 204738079dd05bc808edb3d756fd475e8d9f756c Mon Sep 17 00:00:00 2001 From: kiran94 Date: Thu, 9 Jun 2022 23:49:34 +0100 Subject: [PATCH] test(redlock): verify underlying instance --- redlock/redlock_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/redlock/redlock_test.go b/redlock/redlock_test.go index a3cfdb1..b9e1de0 100644 --- a/redlock/redlock_test.go +++ b/redlock/redlock_test.go @@ -3,8 +3,9 @@ package redlock import ( "context" "fmt" - red "github.com/go-redis/redis/v8" "testing" + + red "github.com/go-redis/redis/v8" ) func CommonClient() []*RedClient { @@ -48,7 +49,11 @@ func TestNewRedisLock(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := NewRedisLock(tt.args.ctx, tt.args.options...) - for _, client := range got.client { + gotOut, ok := got.(*RedLock) + if !ok { + t.Fatalf("new redis lock was not a redlock instance") + } + for _, client := range gotOut.client { err := client.cli.Ping(ctx).Err() if err != nil { t.Fatalf("redis connect error")