Skip to content

Commit 3a722be

Browse files
committed
fix: fix tests
1 parent 91171f5 commit 3a722be

File tree

7 files changed

+17
-16
lines changed

7 files changed

+17
-16
lines changed

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ fmt:
2626
goimports -w -local github.com/go-redis/redis ./
2727

2828
go_mod_tidy:
29-
go get -u && go mod tidy
3029
set -e; for dir in $(PACKAGE_DIRS); do \
3130
echo "go mod tidy in $${dir}"; \
3231
(cd "$${dir}" && \
33-
go get -u && \
34-
go mod tidy); \
32+
go get -u ./... && \
33+
go mod tidy -compat=1.17); \
3534
done

extra/redisotel/redisotel_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ package redisotel_test
22

33
import (
44
"context"
5-
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
65
"testing"
76

8-
"github.com/go-redis/redis/extra/redisotel/v8"
9-
"github.com/go-redis/redis/v8"
7+
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
8+
109
"go.opentelemetry.io/otel"
1110
sdktrace "go.opentelemetry.io/otel/sdk/trace"
1211
"go.opentelemetry.io/otel/trace"
12+
13+
"github.com/go-redis/redis/extra/redisotel/v8"
14+
"github.com/go-redis/redis/v8"
1315
)
1416

1517
func TestNew(t *testing.T) {

internal/pool/conn_check.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || illumos
12
// +build linux darwin dragonfly freebsd netbsd openbsd solaris illumos
23

34
package pool
@@ -46,4 +47,4 @@ func connCheck(conn net.Conn) error {
4647
}
4748

4849
return sysErr
49-
}
50+
}

internal/pool/conn_check_dummy.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !linux && !darwin && !dragonfly && !freebsd && !netbsd && !openbsd && !solaris && !illumos
12
// +build !linux,!darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!illumos
23

34
package pool
@@ -6,4 +7,4 @@ import "net"
67

78
func connCheck(conn net.Conn) error {
89
return nil
9-
}
10+
}

pool_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,14 @@ var _ = Describe("pool", func() {
8686
cn.SetNetConn(&badConn{})
8787
client.Pool().Put(ctx, cn)
8888

89-
err = client.Ping(ctx).Err()
90-
Expect(err).To(MatchError("bad connection"))
91-
9289
val, err := client.Ping(ctx).Result()
9390
Expect(err).NotTo(HaveOccurred())
9491
Expect(val).To(Equal("PONG"))
9592

93+
val, err = client.Ping(ctx).Result()
94+
Expect(err).NotTo(HaveOccurred())
95+
Expect(val).To(Equal("PONG"))
96+
9697
pool := client.Pool()
9798
Expect(pool.Len()).To(Equal(1))
9899
Expect(pool.IdleLen()).To(Equal(1))

sentinel_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ var _ = Describe("NewFailoverClusterClient", func() {
192192
err = master.Shutdown(ctx).Err()
193193
Expect(err).NotTo(HaveOccurred())
194194
Eventually(func() error {
195-
return sentinelMaster.Ping(ctx).Err()
195+
return master.Ping(ctx).Err()
196196
}, "15s", "100ms").Should(HaveOccurred())
197197

198198
// Check that client picked up new master.
@@ -223,7 +223,7 @@ var _ = Describe("SentinelAclAuth", func() {
223223

224224
var client *redis.Client
225225
var sentinel *redis.SentinelClient
226-
var sentinels = func() []*redisProcess {
226+
sentinels := func() []*redisProcess {
227227
return []*redisProcess{sentinel1, sentinel2, sentinel3}
228228
}
229229

tx_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@ var _ = Describe("Tx", func() {
142142
return err
143143
}
144144

145-
err = do()
146-
Expect(err).To(MatchError("bad connection"))
147-
148145
err = do()
149146
Expect(err).NotTo(HaveOccurred())
150147
})

0 commit comments

Comments
 (0)