Dawid Wysokiński
037d557eef
All checks were successful
continuous-integration/drone/push Build is passing
27 lines
527 B
Go
27 lines
527 B
Go
package adapter_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/redis/go-redis/v9"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func newRedisClient(tb testing.TB) *redis.Client {
|
|
tb.Helper()
|
|
|
|
opts, err := redis.ParseURL(redisConnectionString)
|
|
require.NoError(tb, err, "couldn't parse redis connection string")
|
|
|
|
client := redis.NewClient(opts)
|
|
tb.Cleanup(func() {
|
|
_ = client.Close()
|
|
})
|
|
require.NoError(tb, retry(func() error {
|
|
return client.Ping(context.Background()).Err()
|
|
}), "couldn't ping DB")
|
|
|
|
return client
|
|
}
|