@@ -118,17 +118,13 @@ var _ = Describe("Redis Ring", func() {
118
118
Expect (ring .Len (), 2 )
119
119
120
120
wantShard := ring .ShardByName ("ringShardOne" )
121
- ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
122
- defer cancel ()
123
121
ring .SetAddrs (map [string ]string {
124
122
"ringShardOne" : ":" + ringShard1Port ,
125
123
})
126
124
Expect (ring .Len (), 1 )
127
125
gotShard := ring .ShardByName ("ringShardOne" )
128
126
Expect (gotShard ).To (Equal (wantShard ))
129
127
130
- ctx , cancel = context .WithTimeout (context .Background (), 10 * time .Second )
131
- defer cancel ()
132
128
ring .SetAddrs (map [string ]string {
133
129
"ringShardOne" : ":" + ringShard1Port ,
134
130
"ringShardTwo" : ":" + ringShard2Port ,
@@ -145,6 +141,7 @@ var _ = Describe("Redis Ring", func() {
145
141
var err error
146
142
ringShard3 , err = startRedis (ringShard3Port )
147
143
Expect (err ).NotTo (HaveOccurred ())
144
+ defer ringShard3 .Close ()
148
145
149
146
shardName1 := "ringShardOne"
150
147
shardAddr1 := ":" + ringShard1Port
@@ -154,8 +151,7 @@ var _ = Describe("Redis Ring", func() {
154
151
wantShard2 := ring .ShardByName (shardName2 )
155
152
shardName3 := "ringShardThree"
156
153
shardAddr3 := ":" + ringShard3Port
157
- ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
158
- defer cancel ()
154
+
159
155
ring .SetAddrs (map [string ]string {
160
156
shardName1 : shardAddr1 ,
161
157
shardName2 : shardAddr2 ,
@@ -169,8 +165,6 @@ var _ = Describe("Redis Ring", func() {
169
165
Expect (gotShard2 ).To (Equal (wantShard2 ))
170
166
Expect (gotShard3 ).ToNot (BeNil ())
171
167
172
- ctx , cancel = context .WithTimeout (context .Background (), 10 * time .Second )
173
- defer cancel ()
174
168
ring .SetAddrs (map [string ]string {
175
169
shardName1 : shardAddr1 ,
176
170
shardName2 : shardAddr2 ,
0 commit comments