@@ -211,13 +211,12 @@ func TestCompactor_ShouldDoNothingOnNoUserBlocks(t *testing.T) {
211
211
212
212
assert .Equal (t , prom_testutil .ToFloat64 (c .compactionRunInterval ), cfg .CompactionInterval .Seconds ())
213
213
214
- assert .Equal (t , []string {
214
+ assert .ElementsMatch (t , []string {
215
215
`level=info component=cleaner msg="started blocks cleanup and maintenance"` ,
216
216
`level=info component=cleaner msg="successfully completed blocks cleanup and maintenance"` ,
217
217
`level=info component=compactor msg="compactor started"` ,
218
218
`level=info component=compactor msg="discovering users from bucket"` ,
219
219
`level=info component=compactor msg="discovered users from bucket" users=0` ,
220
- `level=info component=compactor msg="compactor stopped"` ,
221
220
}, removeIgnoredLogs (strings .Split (strings .TrimSpace (logs .String ()), "\n " )))
222
221
223
222
assert .NoError (t , prom_testutil .GatherAndCompare (registry , strings .NewReader (`
@@ -364,13 +363,12 @@ func TestCompactor_ShouldRetryCompactionOnFailureWhileDiscoveringUsersFromBucket
364
363
// Ensure the bucket iteration has been retried the configured number of times.
365
364
bucketClient .AssertNumberOfCalls (t , "Iter" , 1 + 3 )
366
365
367
- assert .Equal (t , []string {
366
+ assert .ElementsMatch (t , []string {
368
367
`level=info component=cleaner msg="started blocks cleanup and maintenance"` ,
369
368
`level=error component=cleaner msg="failed to run blocks cleanup and maintenance" err="failed to discover users from bucket: failed to iterate the bucket"` ,
370
369
`level=info component=compactor msg="compactor started"` ,
371
370
`level=info component=compactor msg="discovering users from bucket"` ,
372
371
`level=error component=compactor msg="failed to discover users from bucket" err="failed to iterate the bucket"` ,
373
- `level=info component=compactor msg="compactor stopped"` ,
374
372
}, removeIgnoredLogs (strings .Split (strings .TrimSpace (logs .String ()), "\n " )))
375
373
376
374
assert .NoError (t , prom_testutil .GatherAndCompare (registry , strings .NewReader (`
@@ -680,7 +678,6 @@ func TestCompactor_ShouldIterateOverUsersAndRunCompaction(t *testing.T) {
680
678
`level=info component=compactor org_id=user-2 msg="start of compactions"` ,
681
679
`level=info component=compactor org_id=user-2 msg="compaction iterations done"` ,
682
680
`level=info component=compactor msg="successfully compacted user blocks" user=user-2` ,
683
- `level=info component=compactor msg="compactor stopped"` ,
684
681
}, removeIgnoredLogs (strings .Split (strings .TrimSpace (logs .String ()), "\n " )))
685
682
686
683
// Instead of testing for shipper metrics, we only check our metrics here.
@@ -809,7 +806,6 @@ func TestCompactor_ShouldNotCompactBlocksMarkedForDeletion(t *testing.T) {
809
806
`level=info component=compactor org_id=user-1 msg="start of compactions"` ,
810
807
`level=info component=compactor org_id=user-1 msg="compaction iterations done"` ,
811
808
`level=info component=compactor msg="successfully compacted user blocks" user=user-1` ,
812
- `level=info component=compactor msg="compactor stopped"` ,
813
809
}, removeIgnoredLogs (strings .Split (strings .TrimSpace (logs .String ()), "\n " )))
814
810
815
811
// Instead of testing for shipper metrics, we only check our metrics here.
@@ -998,7 +994,6 @@ func TestCompactor_ShouldNotCompactBlocksForUsersMarkedForDeletion(t *testing.T)
998
994
`level=info component=compactor msg="discovering users from bucket"` ,
999
995
`level=info component=compactor msg="discovered users from bucket" users=1` ,
1000
996
`level=debug component=compactor msg="skipping user because it is marked for deletion" user=user-1` ,
1001
- `level=info component=compactor msg="compactor stopped"` ,
1002
997
}, removeIgnoredLogs (strings .Split (strings .TrimSpace (logs .String ()), "\n " )))
1003
998
1004
999
// Instead of testing for shipper metrics, we only check our metrics here.
@@ -1203,7 +1198,6 @@ func TestCompactor_ShouldCompactAllUsersOnShardingEnabledButOnlyOneInstanceRunni
1203
1198
`level=info component=compactor org_id=user-2 msg="start of compactions"` ,
1204
1199
`level=info component=compactor org_id=user-2 msg="compaction iterations done"` ,
1205
1200
`level=info component=compactor msg="successfully compacted user blocks" user=user-2` ,
1206
- `level=info component=compactor msg="compactor stopped"` ,
1207
1201
}, removeIgnoredLogs (strings .Split (strings .TrimSpace (logs .String ()), "\n " )))
1208
1202
}
1209
1203
@@ -1607,14 +1601,18 @@ func removeIgnoredLogs(input []string) []string {
1607
1601
`level=info component=compactor msg="instance removed from the KV store" ring=compactor` : {},
1608
1602
`level=info component=compactor msg="observing tokens before going ACTIVE" ring=compactor` : {},
1609
1603
`level=info component=compactor msg="lifecycler entering final sleep before shutdown" final_sleep=0s` : {},
1604
+ `level=info component=compactor msg="compactor stopped"` : {},
1610
1605
}
1611
1606
1612
1607
out := make ([]string , 0 , len (input ))
1613
- durationRe := regexp .MustCompile (`\s?duration=\S+` )
1614
- durationMsRe := regexp .MustCompile (`\s?duration_ms=\S+` )
1608
+ durationRe := regexp .MustCompile (`\s?duration(_ms)?=\S+` )
1615
1609
1616
1610
for i := 0 ; i < len (input ); i ++ {
1617
1611
log := input [i ]
1612
+
1613
+ // Remove any duration from logs.
1614
+ log = durationRe .ReplaceAllString (log , "" )
1615
+
1618
1616
if strings .Contains (log , "block.MetaFetcher" ) || strings .Contains (log , "block.BaseFetcher" ) {
1619
1617
continue
1620
1618
}
@@ -1623,10 +1621,6 @@ func removeIgnoredLogs(input []string) []string {
1623
1621
continue
1624
1622
}
1625
1623
1626
- // Remove any duration from logs.
1627
- log = durationRe .ReplaceAllString (log , "" )
1628
- log = durationMsRe .ReplaceAllString (log , "" )
1629
-
1630
1624
out = append (out , log )
1631
1625
}
1632
1626
0 commit comments