Skip to content

Commit fd3a502

Browse files
authored
[chore][extension/ackextension] run make modernize (#43269)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Run the `make modernize` tool. https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize Signed-off-by: Paulo Dias <[email protected]>
1 parent 793cfe9 commit fd3a502

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

extension/ackextension/inmemory_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,23 @@ func TestExtensionAck_ProcessEvents_Concurrency(t *testing.T) {
5555

5656
// send events through different partitions
5757
go func() {
58-
for i := 0; i < 100; i++ {
58+
for range 100 {
5959
// each partition has 3 events
6060
map1[ext.ProcessEvent(partitionName)] = struct{}{}
6161
}
6262
wg.Done()
6363
}()
6464

6565
go func() {
66-
for i := 0; i < 100; i++ {
66+
for range 100 {
6767
// each partition has 3 events
6868
map2[ext.ProcessEvent(partitionName)] = struct{}{}
6969
}
7070
wg.Done()
7171
}()
7272

7373
go func() {
74-
for i := 0; i < 100; i++ {
74+
for range 100 {
7575
// each partition has 3 events
7676
map3[ext.ProcessEvent(partitionName)] = struct{}{}
7777
}
@@ -94,15 +94,15 @@ func TestExtensionAck_ProcessEvents_EventsUnAcked(t *testing.T) {
9494
ext := newInMemoryAckExtension(&conf)
9595

9696
// send events through different partitions
97-
for i := 0; i < 100; i++ {
97+
for i := range 100 {
9898
// each partition has 3 events
99-
for j := 0; j < 3; j++ {
99+
for range 3 {
100100
ext.ProcessEvent(fmt.Sprintf("part-%d", i))
101101
}
102102
}
103103

104104
// non-acked events should be return false
105-
for i := 0; i < 100; i++ {
105+
for i := range 100 {
106106
result := ext.QueryAcks(fmt.Sprintf("part-%d", i), []uint64{0, 1, 2})
107107
require.Len(t, result, 3)
108108
require.False(t, result[0])
@@ -119,15 +119,15 @@ func TestExtensionAck_ProcessEvents_EventsAcked(t *testing.T) {
119119
ext := newInMemoryAckExtension(&conf)
120120

121121
// send events through different partitions
122-
for i := 0; i < 100; i++ {
122+
for i := range 100 {
123123
// each partition has 3 events
124-
for j := 0; j < 3; j++ {
124+
for range 3 {
125125
ext.ProcessEvent(fmt.Sprintf("part-%d", i))
126126
}
127127
}
128128

129129
// 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 {
131131
if i%2 == 0 {
132132
ext.Ack(fmt.Sprintf("part-%d", i), 2)
133133
} else {
@@ -137,7 +137,7 @@ func TestExtensionAck_ProcessEvents_EventsAcked(t *testing.T) {
137137
}
138138

139139
// 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 {
141141
if i%2 == 0 {
142142
result := ext.QueryAcks(fmt.Sprintf("part-%d", i), []uint64{1, 2, 3})
143143
require.Len(t, result, 3)
@@ -162,15 +162,15 @@ func TestExtensionAck_QueryAcks_Unidempotent(t *testing.T) {
162162
ext := newInMemoryAckExtension(&conf)
163163

164164
// send events through different partitions
165-
for i := 0; i < 100; i++ {
165+
for i := range 100 {
166166
// each partition has 3 events
167-
for j := 0; j < 3; j++ {
167+
for range 3 {
168168
ext.ProcessEvent(fmt.Sprintf("part-%d", i))
169169
}
170170
}
171171

172172
// 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 {
174174
if i%2 == 0 {
175175
ext.Ack(fmt.Sprintf("part-%d", i), 2)
176176
} else {
@@ -180,7 +180,7 @@ func TestExtensionAck_QueryAcks_Unidempotent(t *testing.T) {
180180
}
181181

182182
// 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 {
184184
if i%2 == 0 {
185185
result := ext.QueryAcks(fmt.Sprintf("part-%d", i), []uint64{1, 2, 3})
186186
require.Len(t, result, 3)
@@ -197,7 +197,7 @@ func TestExtensionAck_QueryAcks_Unidempotent(t *testing.T) {
197197
}
198198

199199
// querying the same acked events should result in false
200-
for i := 0; i < 100; i++ {
200+
for i := range 100 {
201201
result := ext.QueryAcks(fmt.Sprintf("part-%d", i), []uint64{1, 2, 3})
202202
require.Len(t, result, 3)
203203
require.False(t, result[1])
@@ -217,10 +217,10 @@ func TestExtensionAckAsync(t *testing.T) {
217217
var wg sync.WaitGroup
218218
wg.Add(partitionCount)
219219
// send events through different partitions
220-
for i := 0; i < partitionCount; i++ {
220+
for i := range partitionCount {
221221
go func() {
222222
// each partition has 3 events
223-
for j := 0; j < 3; j++ {
223+
for range 3 {
224224
ext.ProcessEvent(fmt.Sprintf("part-%d", i))
225225
}
226226
wg.Done()
@@ -230,7 +230,7 @@ func TestExtensionAckAsync(t *testing.T) {
230230
wg.Wait()
231231

232232
// non-acked events should be return false
233-
for i := 0; i < partitionCount; i++ {
233+
for i := range partitionCount {
234234
result := ext.QueryAcks(fmt.Sprintf("part-%d", i), []uint64{1, 2, 3})
235235
require.Len(t, result, 3)
236236
require.False(t, result[1])
@@ -240,7 +240,7 @@ func TestExtensionAckAsync(t *testing.T) {
240240

241241
wg.Add(partitionCount)
242242
// 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 {
244244
go func() {
245245
if i%2 == 0 {
246246
ext.Ack(fmt.Sprintf("part-%d", i), 2)
@@ -254,7 +254,7 @@ func TestExtensionAckAsync(t *testing.T) {
254254

255255
wg.Wait()
256256
// 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 {
258258
if i%2 == 0 {
259259
result := ext.QueryAcks(fmt.Sprintf("part-%d", i), []uint64{1, 2, 3})
260260
require.Len(t, result, 3)
@@ -272,15 +272,15 @@ func TestExtensionAckAsync(t *testing.T) {
272272
wg.Add(100)
273273
resultChan := make(chan map[uint64]bool, partitionCount)
274274
// querying the same acked events should result in false
275-
for i := 0; i < partitionCount; i++ {
275+
for i := range partitionCount {
276276
go func() {
277277
resultChan <- ext.QueryAcks(fmt.Sprintf("part-%d", i), []uint64{1, 2, 3})
278278
wg.Done()
279279
}()
280280
}
281281
wg.Wait()
282282

283-
for i := 0; i < partitionCount; i++ {
283+
for range partitionCount {
284284
result := <-resultChan
285285
require.Len(t, result, 3)
286286
require.False(t, result[1])

0 commit comments

Comments
 (0)