@@ -55,23 +55,23 @@ func TestExtensionAck_ProcessEvents_Concurrency(t *testing.T) {
55
55
56
56
// send events through different partitions
57
57
go func () {
58
- for i := 0 ; i < 100 ; i ++ {
58
+ for range 100 {
59
59
// each partition has 3 events
60
60
map1 [ext .ProcessEvent (partitionName )] = struct {}{}
61
61
}
62
62
wg .Done ()
63
63
}()
64
64
65
65
go func () {
66
- for i := 0 ; i < 100 ; i ++ {
66
+ for range 100 {
67
67
// each partition has 3 events
68
68
map2 [ext .ProcessEvent (partitionName )] = struct {}{}
69
69
}
70
70
wg .Done ()
71
71
}()
72
72
73
73
go func () {
74
- for i := 0 ; i < 100 ; i ++ {
74
+ for range 100 {
75
75
// each partition has 3 events
76
76
map3 [ext .ProcessEvent (partitionName )] = struct {}{}
77
77
}
@@ -94,15 +94,15 @@ func TestExtensionAck_ProcessEvents_EventsUnAcked(t *testing.T) {
94
94
ext := newInMemoryAckExtension (& conf )
95
95
96
96
// send events through different partitions
97
- for i := 0 ; i < 100 ; i ++ {
97
+ for i := range 100 {
98
98
// each partition has 3 events
99
- for j := 0 ; j < 3 ; j ++ {
99
+ for range 3 {
100
100
ext .ProcessEvent (fmt .Sprintf ("part-%d" , i ))
101
101
}
102
102
}
103
103
104
104
// non-acked events should be return false
105
- for i := 0 ; i < 100 ; i ++ {
105
+ for i := range 100 {
106
106
result := ext .QueryAcks (fmt .Sprintf ("part-%d" , i ), []uint64 {0 , 1 , 2 })
107
107
require .Len (t , result , 3 )
108
108
require .False (t , result [0 ])
@@ -119,15 +119,15 @@ func TestExtensionAck_ProcessEvents_EventsAcked(t *testing.T) {
119
119
ext := newInMemoryAckExtension (& conf )
120
120
121
121
// send events through different partitions
122
- for i := 0 ; i < 100 ; i ++ {
122
+ for i := range 100 {
123
123
// each partition has 3 events
124
- for j := 0 ; j < 3 ; j ++ {
124
+ for range 3 {
125
125
ext .ProcessEvent (fmt .Sprintf ("part-%d" , i ))
126
126
}
127
127
}
128
128
129
129
// ack the second event of all even partitions and first and third events of all odd partitions
130
- for i := 0 ; i < 100 ; i ++ {
130
+ for i := range 100 {
131
131
if i % 2 == 0 {
132
132
ext .Ack (fmt .Sprintf ("part-%d" , i ), 2 )
133
133
} else {
@@ -137,7 +137,7 @@ func TestExtensionAck_ProcessEvents_EventsAcked(t *testing.T) {
137
137
}
138
138
139
139
// second event of even partitions should be acked, and first and third events of odd partitions should be acked
140
- for i := 0 ; i < 100 ; i ++ {
140
+ for i := range 100 {
141
141
if i % 2 == 0 {
142
142
result := ext .QueryAcks (fmt .Sprintf ("part-%d" , i ), []uint64 {1 , 2 , 3 })
143
143
require .Len (t , result , 3 )
@@ -162,15 +162,15 @@ func TestExtensionAck_QueryAcks_Unidempotent(t *testing.T) {
162
162
ext := newInMemoryAckExtension (& conf )
163
163
164
164
// send events through different partitions
165
- for i := 0 ; i < 100 ; i ++ {
165
+ for i := range 100 {
166
166
// each partition has 3 events
167
- for j := 0 ; j < 3 ; j ++ {
167
+ for range 3 {
168
168
ext .ProcessEvent (fmt .Sprintf ("part-%d" , i ))
169
169
}
170
170
}
171
171
172
172
// ack the second event of all even partitions and first and third events of all odd partitions
173
- for i := 0 ; i < 100 ; i ++ {
173
+ for i := range 100 {
174
174
if i % 2 == 0 {
175
175
ext .Ack (fmt .Sprintf ("part-%d" , i ), 2 )
176
176
} else {
@@ -180,7 +180,7 @@ func TestExtensionAck_QueryAcks_Unidempotent(t *testing.T) {
180
180
}
181
181
182
182
// second event of even partitions should be acked, and first and third events of odd partitions should be acked
183
- for i := 0 ; i < 100 ; i ++ {
183
+ for i := range 100 {
184
184
if i % 2 == 0 {
185
185
result := ext .QueryAcks (fmt .Sprintf ("part-%d" , i ), []uint64 {1 , 2 , 3 })
186
186
require .Len (t , result , 3 )
@@ -197,7 +197,7 @@ func TestExtensionAck_QueryAcks_Unidempotent(t *testing.T) {
197
197
}
198
198
199
199
// querying the same acked events should result in false
200
- for i := 0 ; i < 100 ; i ++ {
200
+ for i := range 100 {
201
201
result := ext .QueryAcks (fmt .Sprintf ("part-%d" , i ), []uint64 {1 , 2 , 3 })
202
202
require .Len (t , result , 3 )
203
203
require .False (t , result [1 ])
@@ -217,10 +217,10 @@ func TestExtensionAckAsync(t *testing.T) {
217
217
var wg sync.WaitGroup
218
218
wg .Add (partitionCount )
219
219
// send events through different partitions
220
- for i := 0 ; i < partitionCount ; i ++ {
220
+ for i := range partitionCount {
221
221
go func () {
222
222
// each partition has 3 events
223
- for j := 0 ; j < 3 ; j ++ {
223
+ for range 3 {
224
224
ext .ProcessEvent (fmt .Sprintf ("part-%d" , i ))
225
225
}
226
226
wg .Done ()
@@ -230,7 +230,7 @@ func TestExtensionAckAsync(t *testing.T) {
230
230
wg .Wait ()
231
231
232
232
// non-acked events should be return false
233
- for i := 0 ; i < partitionCount ; i ++ {
233
+ for i := range partitionCount {
234
234
result := ext .QueryAcks (fmt .Sprintf ("part-%d" , i ), []uint64 {1 , 2 , 3 })
235
235
require .Len (t , result , 3 )
236
236
require .False (t , result [1 ])
@@ -240,7 +240,7 @@ func TestExtensionAckAsync(t *testing.T) {
240
240
241
241
wg .Add (partitionCount )
242
242
// ack the second event of all even partitions and first and third events of all odd partitions
243
- for i := 0 ; i < partitionCount ; i ++ {
243
+ for i := range partitionCount {
244
244
go func () {
245
245
if i % 2 == 0 {
246
246
ext .Ack (fmt .Sprintf ("part-%d" , i ), 2 )
@@ -254,7 +254,7 @@ func TestExtensionAckAsync(t *testing.T) {
254
254
255
255
wg .Wait ()
256
256
// second event of even partitions should be acked, and first and third events of odd partitions should be acked
257
- for i := 0 ; i < partitionCount ; i ++ {
257
+ for i := range partitionCount {
258
258
if i % 2 == 0 {
259
259
result := ext .QueryAcks (fmt .Sprintf ("part-%d" , i ), []uint64 {1 , 2 , 3 })
260
260
require .Len (t , result , 3 )
@@ -272,15 +272,15 @@ func TestExtensionAckAsync(t *testing.T) {
272
272
wg .Add (100 )
273
273
resultChan := make (chan map [uint64 ]bool , partitionCount )
274
274
// querying the same acked events should result in false
275
- for i := 0 ; i < partitionCount ; i ++ {
275
+ for i := range partitionCount {
276
276
go func () {
277
277
resultChan <- ext .QueryAcks (fmt .Sprintf ("part-%d" , i ), []uint64 {1 , 2 , 3 })
278
278
wg .Done ()
279
279
}()
280
280
}
281
281
wg .Wait ()
282
282
283
- for i := 0 ; i < partitionCount ; i ++ {
283
+ for range partitionCount {
284
284
result := <- resultChan
285
285
require .Len (t , result , 3 )
286
286
require .False (t , result [1 ])
0 commit comments