Skip to content

Commit aa7b3c2

Browse files
committed
Lint
1 parent 7ebe346 commit aa7b3c2

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

plugins/outputs/cloudwatchlogs/internal/pusher/target_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func TestDescribeLogGroupsBatching(t *testing.T) {
259259

260260
t.Run("ProcessBatchOnLimit", func(t *testing.T) {
261261
mockService := new(mockLogsService)
262-
262+
263263
// Setup mock to expect a batch of 50 log groups
264264
mockService.On("DescribeLogGroups", mock.MatchedBy(func(input *cloudwatchlogs.DescribeLogGroupsInput) bool {
265265
return len(input.LogGroupIdentifiers) == logGroupIdentifierLimit
@@ -269,7 +269,7 @@ func TestDescribeLogGroupsBatching(t *testing.T) {
269269

270270
manager := NewTargetManager(logger, mockService)
271271
tm := manager.(*targetManager)
272-
272+
273273
for i := 0; i < logGroupIdentifierLimit; i++ {
274274
target := Target{
275275
Group: fmt.Sprintf("group-%d", i),
@@ -278,15 +278,15 @@ func TestDescribeLogGroupsBatching(t *testing.T) {
278278
}
279279
tm.dlg <- target
280280
}
281-
281+
282282
time.Sleep(100 * time.Millisecond)
283-
283+
284284
mockService.AssertExpectations(t)
285285
})
286286

287287
t.Run("ProcessBatchOnTimer", func(t *testing.T) {
288288
mockService := new(mockLogsService)
289-
289+
290290
// Setup mock to expect a batch of less than 50 log groups
291291
mockService.On("DescribeLogGroups", mock.MatchedBy(func(input *cloudwatchlogs.DescribeLogGroupsInput) bool {
292292
return len(input.LogGroupIdentifiers) == 5
@@ -296,7 +296,7 @@ func TestDescribeLogGroupsBatching(t *testing.T) {
296296

297297
manager := NewTargetManager(logger, mockService)
298298
tm := manager.(*targetManager)
299-
299+
300300
for i := 0; i < 5; i++ {
301301
target := Target{
302302
Group: fmt.Sprintf("group-%d", i),
@@ -305,16 +305,16 @@ func TestDescribeLogGroupsBatching(t *testing.T) {
305305
}
306306
tm.dlg <- target
307307
}
308-
308+
309309
// Wait for ticker to fire (slightly longer than 5 seconds)
310310
time.Sleep(5100 * time.Millisecond)
311-
311+
312312
mockService.AssertExpectations(t)
313313
})
314314

315315
t.Run("ProcessBatchInvalidGroups", func(t *testing.T) {
316316
mockService := new(mockLogsService)
317-
317+
318318
// Return empty result
319319
mockService.On("DescribeLogGroups", mock.Anything).Return(&cloudwatchlogs.DescribeLogGroupsOutput{
320320
LogGroups: []*cloudwatchlogs.LogGroup{},
@@ -333,10 +333,10 @@ func TestDescribeLogGroupsBatching(t *testing.T) {
333333

334334
mockService.AssertNotCalled(t, "PutRetentionPolicy")
335335
})
336-
336+
337337
t.Run("RetentionPolicyUpdate", func(t *testing.T) {
338338
mockService := new(mockLogsService)
339-
339+
340340
mockService.On("DescribeLogGroups", mock.Anything).Return(&cloudwatchlogs.DescribeLogGroupsOutput{
341341
LogGroups: []*cloudwatchlogs.LogGroup{
342342
{
@@ -349,29 +349,29 @@ func TestDescribeLogGroupsBatching(t *testing.T) {
349349
},
350350
},
351351
}, nil).Once()
352-
352+
353353
// Setup mock for PutRetentionPolicy (should only be called for group-1)
354354
mockService.On("PutRetentionPolicy", mock.MatchedBy(func(input *cloudwatchlogs.PutRetentionPolicyInput) bool {
355355
return *input.LogGroupName == "group-1" && *input.RetentionInDays == 7
356356
})).Return(&cloudwatchlogs.PutRetentionPolicyOutput{}, nil).Once()
357357

358358
manager := NewTargetManager(logger, mockService)
359359
tm := manager.(*targetManager)
360-
360+
361361
// Create a batch with two targets, one needing retention update
362362
batch := make(map[string]Target)
363363
batch["group-1"] = Target{Group: "group-1", Stream: "stream", Retention: 7}
364364
batch["group-2"] = Target{Group: "group-2", Stream: "stream", Retention: 7}
365-
365+
366366
tm.updateTargetBatch(batch)
367367
time.Sleep(100 * time.Millisecond)
368-
368+
369369
mockService.AssertExpectations(t)
370370
})
371-
371+
372372
t.Run("BatchRetryOnError", func(t *testing.T) {
373373
mockService := new(mockLogsService)
374-
374+
375375
// Setup mock to fail once then succeed
376376
mockService.On("DescribeLogGroups", mock.Anything).
377377
Return(&cloudwatchlogs.DescribeLogGroupsOutput{}, fmt.Errorf("internal error")).Once()
@@ -382,15 +382,15 @@ func TestDescribeLogGroupsBatching(t *testing.T) {
382382

383383
manager := NewTargetManager(logger, mockService)
384384
tm := manager.(*targetManager)
385-
385+
386386
// Create a batch with one target
387387
batch := make(map[string]Target)
388388
batch["group-1"] = Target{Group: "group-1", Stream: "stream", Retention: 7}
389-
389+
390390
tm.updateTargetBatch(batch)
391391
// Sleep enough for retry
392392
time.Sleep(2 * time.Second)
393-
393+
394394
mockService.AssertExpectations(t)
395395
})
396396
}

0 commit comments

Comments
 (0)