forked from mirror/redis
fix: fix tests
This commit is contained in:
parent
91171f5e19
commit
3a722be811
5
Makefile
5
Makefile
|
@ -26,10 +26,9 @@ fmt:
|
|||
goimports -w -local github.com/go-redis/redis ./
|
||||
|
||||
go_mod_tidy:
|
||||
go get -u && go mod tidy
|
||||
set -e; for dir in $(PACKAGE_DIRS); do \
|
||||
echo "go mod tidy in $${dir}"; \
|
||||
(cd "$${dir}" && \
|
||||
go get -u && \
|
||||
go mod tidy); \
|
||||
go get -u ./... && \
|
||||
go mod tidy -compat=1.17); \
|
||||
done
|
||||
|
|
|
@ -2,14 +2,16 @@ package redisotel_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
|
||||
"testing"
|
||||
|
||||
"github.com/go-redis/redis/extra/redisotel/v8"
|
||||
"github.com/go-redis/redis/v8"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
"github.com/go-redis/redis/extra/redisotel/v8"
|
||||
"github.com/go-redis/redis/v8"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || illumos
|
||||
// +build linux darwin dragonfly freebsd netbsd openbsd solaris illumos
|
||||
|
||||
package pool
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//go:build !linux && !darwin && !dragonfly && !freebsd && !netbsd && !openbsd && !solaris && !illumos
|
||||
// +build !linux,!darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!illumos
|
||||
|
||||
package pool
|
||||
|
|
|
@ -86,13 +86,14 @@ var _ = Describe("pool", func() {
|
|||
cn.SetNetConn(&badConn{})
|
||||
client.Pool().Put(ctx, cn)
|
||||
|
||||
err = client.Ping(ctx).Err()
|
||||
Expect(err).To(MatchError("bad connection"))
|
||||
|
||||
val, err := client.Ping(ctx).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(val).To(Equal("PONG"))
|
||||
|
||||
val, err = client.Ping(ctx).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(val).To(Equal("PONG"))
|
||||
|
||||
pool := client.Pool()
|
||||
Expect(pool.Len()).To(Equal(1))
|
||||
Expect(pool.IdleLen()).To(Equal(1))
|
||||
|
|
|
@ -192,7 +192,7 @@ var _ = Describe("NewFailoverClusterClient", func() {
|
|||
err = master.Shutdown(ctx).Err()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Eventually(func() error {
|
||||
return sentinelMaster.Ping(ctx).Err()
|
||||
return master.Ping(ctx).Err()
|
||||
}, "15s", "100ms").Should(HaveOccurred())
|
||||
|
||||
// Check that client picked up new master.
|
||||
|
@ -223,7 +223,7 @@ var _ = Describe("SentinelAclAuth", func() {
|
|||
|
||||
var client *redis.Client
|
||||
var sentinel *redis.SentinelClient
|
||||
var sentinels = func() []*redisProcess {
|
||||
sentinels := func() []*redisProcess {
|
||||
return []*redisProcess{sentinel1, sentinel2, sentinel3}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,9 +142,6 @@ var _ = Describe("Tx", func() {
|
|||
return err
|
||||
}
|
||||
|
||||
err = do()
|
||||
Expect(err).To(MatchError("bad connection"))
|
||||
|
||||
err = do()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue