Skip to content

Commit

Permalink
test(redlock): verify underlying instance
Browse files Browse the repository at this point in the history
  • Loading branch information
kiran94 committed Jun 9, 2022
1 parent b74ebba commit 2047380
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions redlock/redlock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 2047380

Please sign in to comment.