Fix go vet

This commit is contained in:
Vladimir Mihailenco 2018-03-07 11:56:24 +02:00
parent e9e73a92c0
commit 852a60d520
4 changed files with 537 additions and 234 deletions

View File

@ -208,7 +208,11 @@ func BenchmarkZAdd(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
if err := client.ZAdd("key", redis.Z{float64(1), "hello"}).Err(); err != nil {
err := client.ZAdd("key", redis.Z{
Score: float64(1),
Member: "hello",
}).Err()
if err != nil {
b.Fatal(err)
}
}

View File

@ -123,9 +123,37 @@ func startCluster(scenario *clusterScenario) error {
return err
}
wanted := []redis.ClusterSlot{
{0, 4999, []redis.ClusterNode{{"", "127.0.0.1:8220"}, {"", "127.0.0.1:8223"}}},
{5000, 9999, []redis.ClusterNode{{"", "127.0.0.1:8221"}, {"", "127.0.0.1:8224"}}},
{10000, 16383, []redis.ClusterNode{{"", "127.0.0.1:8222"}, {"", "127.0.0.1:8225"}}},
{
Start: 0,
End: 4999,
Nodes: []redis.ClusterNode{{
Id: "",
Addr: "127.0.0.1:8220",
}, {
Id: "",
Addr: "127.0.0.1:8223",
}},
}, {
Start: 5000,
End: 9999,
Nodes: []redis.ClusterNode{{
Id: "",
Addr: "127.0.0.1:8221",
}, {
Id: "",
Addr: "127.0.0.1:8224",
}},
}, {
Start: 10000,
End: 16383,
Nodes: []redis.ClusterNode{{
Id: "",
Addr: "127.0.0.1:8222",
}, {
Id: "",
Addr: "127.0.0.1:8225",
}},
},
}
return assertSlotsEqual(res, wanted)
}, 30*time.Second)
@ -492,9 +520,37 @@ var _ = Describe("ClusterClient", func() {
Expect(res).To(HaveLen(3))
wanted := []redis.ClusterSlot{
{0, 4999, []redis.ClusterNode{{"", "127.0.0.1:8220"}, {"", "127.0.0.1:8223"}}},
{5000, 9999, []redis.ClusterNode{{"", "127.0.0.1:8221"}, {"", "127.0.0.1:8224"}}},
{10000, 16383, []redis.ClusterNode{{"", "127.0.0.1:8222"}, {"", "127.0.0.1:8225"}}},
{
Start: 0,
End: 4999,
Nodes: []redis.ClusterNode{{
Id: "",
Addr: "127.0.0.1:8220",
}, {
Id: "",
Addr: "127.0.0.1:8223",
}},
}, {
Start: 5000,
End: 9999,
Nodes: []redis.ClusterNode{{
Id: "",
Addr: "127.0.0.1:8221",
}, {
Id: "",
Addr: "127.0.0.1:8224",
}},
}, {
Start: 10000,
End: 16383,
Nodes: []redis.ClusterNode{{
Id: "",
Addr: "127.0.0.1:8222",
}, {
Id: "",
Addr: "127.0.0.1:8225",
}},
},
}
Expect(assertSlotsEqual(res, wanted)).NotTo(HaveOccurred())
})

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ func Example_instrumentation() {
// finished processing: <ping: PONG>
}
func Example_Pipeline_instrumentation() {
func ExamplePipeline_instrumentation() {
client := redis.NewClient(&redis.Options{
Addr: ":6379",
})