@@ -170,6 +170,7 @@ func TestCompactor_SkipCompactionWhenCmkError(t *testing.T) {
170
170
// No user blocks stored in the bucket.
171
171
bucketClient := & bucket.ClientMock {}
172
172
bucketClient .MockIter ("" , []string {userID }, nil )
173
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
173
174
bucketClient .MockIter (userID + "/" , []string {}, nil )
174
175
bucketClient .MockIter (userID + "/markers/" , nil , nil )
175
176
bucketClient .MockGet (userID + "/bucket-index-sync-status.json" , string (content ), nil )
@@ -198,6 +199,7 @@ func TestCompactor_ShouldDoNothingOnNoUserBlocks(t *testing.T) {
198
199
// No user blocks stored in the bucket.
199
200
bucketClient := & bucket.ClientMock {}
200
201
bucketClient .MockIter ("" , []string {}, nil )
202
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
201
203
cfg := prepareConfig ()
202
204
c , _ , _ , logs , registry := prepare (t , cfg , bucketClient , nil )
203
205
require .NoError (t , services .StartAndAwaitRunning (context .Background (), c ))
@@ -348,6 +350,7 @@ func TestCompactor_ShouldRetryCompactionOnFailureWhileDiscoveringUsersFromBucket
348
350
349
351
// Fail to iterate over the bucket while discovering users.
350
352
bucketClient := & bucket.ClientMock {}
353
+ bucketClient .MockIter ("__markers__" , nil , errors .New ("failed to iterate the bucket" ))
351
354
bucketClient .MockIter ("" , nil , errors .New ("failed to iterate the bucket" ))
352
355
353
356
c , _ , _ , logs , registry := prepare (t , prepareConfig (), bucketClient , nil )
@@ -501,6 +504,7 @@ func TestCompactor_ShouldIncrementCompactionErrorIfFailedToCompactASingleTenant(
501
504
userID := "test-user"
502
505
bucketClient := & bucket.ClientMock {}
503
506
bucketClient .MockIter ("" , []string {userID }, nil )
507
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
504
508
bucketClient .MockIter (userID + "/" , []string {userID + "/01DTVP434PA9VFXSW2JKB3392D/meta.json" , userID + "/01FN6CDF3PNEWWRY5MPGJPE3EX/meta.json" }, nil )
505
509
bucketClient .MockIter (userID + "/markers/" , nil , nil )
506
510
bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath (userID ), false , nil )
@@ -553,6 +557,7 @@ func TestCompactor_ShouldIncrementCompactionErrorIfFailedToCompactASingleTenant(
553
557
func TestCompactor_ShouldCompactAndRemoveUserFolder (t * testing.T ) {
554
558
bucketClient := & bucket.ClientMock {}
555
559
bucketClient .MockIter ("" , []string {"user-1" }, nil )
560
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
556
561
bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
557
562
bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
558
563
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01FN6CDF3PNEWWRY5MPGJPE3EX/meta.json" }, nil )
@@ -598,6 +603,7 @@ func TestCompactor_ShouldIterateOverUsersAndRunCompaction(t *testing.T) {
598
603
// Mock the bucket to contain two users, each one with one block.
599
604
bucketClient := & bucket.ClientMock {}
600
605
bucketClient .MockIter ("" , []string {"user-1" , "user-2" }, nil )
606
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
601
607
bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
602
608
bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
603
609
bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-2" ), false , nil )
@@ -741,6 +747,7 @@ func TestCompactor_ShouldNotCompactBlocksMarkedForDeletion(t *testing.T) {
741
747
// Mock the bucket to contain two users, each one with one block.
742
748
bucketClient := & bucket.ClientMock {}
743
749
bucketClient .MockIter ("" , []string {"user-1" }, nil )
750
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
744
751
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ" }, nil )
745
752
bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
746
753
bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
@@ -866,6 +873,7 @@ func TestCompactor_ShouldNotCompactBlocksMarkedForSkipCompact(t *testing.T) {
866
873
// Mock the bucket to contain two users, each one with one block.
867
874
bucketClient := & bucket.ClientMock {}
868
875
bucketClient .MockIter ("" , []string {"user-1" , "user-2" }, nil )
876
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
869
877
bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
870
878
bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
871
879
bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-2" ), false , nil )
@@ -944,6 +952,7 @@ func TestCompactor_ShouldNotCompactBlocksForUsersMarkedForDeletion(t *testing.T)
944
952
// Mock the bucket to contain two users, each one with one block.
945
953
bucketClient := & bucket.ClientMock {}
946
954
bucketClient .MockIter ("" , []string {"user-1" }, nil )
955
+ bucketClient .MockIter ("__markers__" , []string {"__markers__/user-1/" }, nil )
947
956
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" }, nil )
948
957
bucketClient .MockGet (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), `{"deletion_time": 1}` , nil )
949
958
bucketClient .MockUpload (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), nil )
@@ -1107,6 +1116,7 @@ func TestCompactor_ShouldCompactAllUsersOnShardingEnabledButOnlyOneInstanceRunni
1107
1116
// Mock the bucket to contain two users, each one with one block.
1108
1117
bucketClient := & bucket.ClientMock {}
1109
1118
bucketClient .MockIter ("" , []string {"user-1" , "user-2" }, nil )
1119
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
1110
1120
bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
1111
1121
bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
1112
1122
bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-2" ), false , nil )
@@ -1215,6 +1225,7 @@ func TestCompactor_ShouldCompactOnlyUsersOwnedByTheInstanceOnShardingEnabledAndM
1215
1225
// Mock the bucket to contain all users, each one with one block.
1216
1226
bucketClient := & bucket.ClientMock {}
1217
1227
bucketClient .MockIter ("" , userIDs , nil )
1228
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
1218
1229
for _ , userID := range userIDs {
1219
1230
bucketClient .MockIter (userID + "/" , []string {userID + "/01DTVP434PA9VFXSW2JKB3392D" }, nil )
1220
1231
bucketClient .MockIter (userID + "/markers/" , nil , nil )
@@ -1321,6 +1332,7 @@ func TestCompactor_ShouldCompactOnlyShardsOwnedByTheInstanceOnShardingEnabledWit
1321
1332
// Mock the bucket to contain all users, each one with five blocks, 2 sets of overlapping blocks and 1 separate block.
1322
1333
bucketClient := & bucket.ClientMock {}
1323
1334
bucketClient .MockIter ("" , userIDs , nil )
1335
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
1324
1336
1325
1337
// Keys with a value greater than 1 will be groups that should be compacted
1326
1338
groupHashes := make (map [uint32 ]int )
@@ -1927,6 +1939,7 @@ func TestCompactor_ShouldFailCompactionOnTimeout(t *testing.T) {
1927
1939
// Mock the bucket
1928
1940
bucketClient := & bucket.ClientMock {}
1929
1941
bucketClient .MockIter ("" , []string {}, nil )
1942
+ bucketClient .MockIter ("__markers__" , []string {}, nil )
1930
1943
1931
1944
ringStore , closer := consul .NewInMemoryClient (ring .GetCodec (), log .NewNopLogger (), nil )
1932
1945
t .Cleanup (func () { assert .NoError (t , closer .Close ()) })
0 commit comments