Skip to content

Commit 73d939e

Browse files
authored
test: remove testify (#2463)
* test: remove testify Signed-off-by: monkey92t <[email protected]>
1 parent e309eaf commit 73d939e

File tree

3 files changed

+32
-70
lines changed

3 files changed

+32
-70
lines changed

cluster_test.go

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ import (
99
"strconv"
1010
"strings"
1111
"sync"
12-
"testing"
1312
"time"
1413

1514
. "github.com/bsm/ginkgo/v2"
1615
. "github.com/bsm/gomega"
17-
"github.com/stretchr/testify/assert"
18-
1916
"github.com/redis/go-redis/v9"
2017
"github.com/redis/go-redis/v9/internal/hashtag"
2118
)
@@ -1360,8 +1357,8 @@ var _ = Describe("ClusterClient timeout", func() {
13601357
})
13611358
})
13621359

1363-
func TestParseClusterURL(t *testing.T) {
1364-
cases := []struct {
1360+
var _ = Describe("ClusterClient ParseURL", func() {
1361+
var cases = []struct {
13651362
test string
13661363
url string
13671364
o *redis.ClusterOptions // expected value
@@ -1454,47 +1451,36 @@ func TestParseClusterURL(t *testing.T) {
14541451
},
14551452
}
14561453

1457-
for i := range cases {
1458-
tc := cases[i]
1459-
t.Run(tc.test, func(t *testing.T) {
1460-
t.Parallel()
1461-
1454+
It("match ParseClusterURL", func() {
1455+
for i := range cases {
1456+
tc := cases[i]
14621457
actual, err := redis.ParseClusterURL(tc.url)
1463-
if tc.err == nil && err != nil {
1464-
t.Fatalf("unexpected error: %q", err)
1465-
return
1466-
}
1467-
if tc.err != nil && err == nil {
1468-
t.Fatalf("expected error: got %+v", actual)
1469-
return
1470-
}
1471-
if tc.err != nil && err != nil {
1472-
if tc.err.Error() != err.Error() {
1473-
t.Fatalf("got %q, expected %q", err, tc.err)
1474-
}
1475-
return
1458+
if tc.err != nil {
1459+
Expect(err).Should(MatchError(tc.err))
1460+
} else {
1461+
Expect(err).NotTo(HaveOccurred())
14761462
}
1477-
comprareOptions(t, actual, tc.o)
1478-
})
1479-
}
1480-
}
14811463

1482-
func comprareOptions(t *testing.T, actual, expected *redis.ClusterOptions) {
1483-
t.Helper()
1484-
assert.Equal(t, expected.Addrs, actual.Addrs)
1485-
assert.Equal(t, expected.TLSConfig, actual.TLSConfig)
1486-
assert.Equal(t, expected.Username, actual.Username)
1487-
assert.Equal(t, expected.Password, actual.Password)
1488-
assert.Equal(t, expected.MaxRetries, actual.MaxRetries)
1489-
assert.Equal(t, expected.MinRetryBackoff, actual.MinRetryBackoff)
1490-
assert.Equal(t, expected.MaxRetryBackoff, actual.MaxRetryBackoff)
1491-
assert.Equal(t, expected.DialTimeout, actual.DialTimeout)
1492-
assert.Equal(t, expected.ReadTimeout, actual.ReadTimeout)
1493-
assert.Equal(t, expected.WriteTimeout, actual.WriteTimeout)
1494-
assert.Equal(t, expected.PoolFIFO, actual.PoolFIFO)
1495-
assert.Equal(t, expected.PoolSize, actual.PoolSize)
1496-
assert.Equal(t, expected.MinIdleConns, actual.MinIdleConns)
1497-
assert.Equal(t, expected.ConnMaxLifetime, actual.ConnMaxLifetime)
1498-
assert.Equal(t, expected.ConnMaxIdleTime, actual.ConnMaxIdleTime)
1499-
assert.Equal(t, expected.PoolTimeout, actual.PoolTimeout)
1500-
}
1464+
if err == nil {
1465+
Expect(tc.o).NotTo(BeNil())
1466+
1467+
Expect(tc.o.Addrs).To(Equal(actual.Addrs))
1468+
Expect(tc.o.TLSConfig).To(Equal(actual.TLSConfig))
1469+
Expect(tc.o.Username).To(Equal(actual.Username))
1470+
Expect(tc.o.Password).To(Equal(actual.Password))
1471+
Expect(tc.o.MaxRetries).To(Equal(actual.MaxRetries))
1472+
Expect(tc.o.MinRetryBackoff).To(Equal(actual.MinRetryBackoff))
1473+
Expect(tc.o.MaxRetryBackoff).To(Equal(actual.MaxRetryBackoff))
1474+
Expect(tc.o.DialTimeout).To(Equal(actual.DialTimeout))
1475+
Expect(tc.o.ReadTimeout).To(Equal(actual.ReadTimeout))
1476+
Expect(tc.o.WriteTimeout).To(Equal(actual.WriteTimeout))
1477+
Expect(tc.o.PoolFIFO).To(Equal(actual.PoolFIFO))
1478+
Expect(tc.o.PoolSize).To(Equal(actual.PoolSize))
1479+
Expect(tc.o.MinIdleConns).To(Equal(actual.MinIdleConns))
1480+
Expect(tc.o.ConnMaxLifetime).To(Equal(actual.ConnMaxLifetime))
1481+
Expect(tc.o.ConnMaxIdleTime).To(Equal(actual.ConnMaxIdleTime))
1482+
Expect(tc.o.PoolTimeout).To(Equal(actual.PoolTimeout))
1483+
}
1484+
}
1485+
})
1486+
})

go.mod

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,4 @@ require (
77
github.com/bsm/gomega v1.26.0
88
github.com/cespare/xxhash/v2 v2.2.0
99
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
10-
github.com/stretchr/testify v1.8.1
11-
)
12-
13-
require (
14-
github.com/davecgh/go-spew v1.1.1 // indirect
15-
github.com/pmezard/go-difflib v1.0.0 // indirect
16-
gopkg.in/yaml.v3 v3.0.1 // indirect
1710
)

go.sum

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,5 @@ github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
44
github.com/bsm/gomega v1.26.0/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
55
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
66
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
7-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
9-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
107
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
118
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
12-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
13-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
14-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
15-
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
16-
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
17-
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
18-
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
19-
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
20-
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
21-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
22-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
23-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
24-
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
25-
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)