@@ -173,6 +173,7 @@ func TestCompactor_SkipCompactionWhenCmkError(t *testing.T) {
173
173
// No user blocks stored in the bucket.
174
174
bucketClient := & bucket.ClientMock {}
175
175
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
176
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
176
177
bucketClient .MockIter ("" , []string {userID }, nil )
177
178
bucketClient .MockIter ("__markers__" , []string {}, nil )
178
179
bucketClient .MockIter (userID + "/" , []string {userID + "/01DTVP434PA9VFXSW2JKB3392D" }, nil )
@@ -207,6 +208,7 @@ func TestCompactor_ShouldDoNothingOnNoUserBlocks(t *testing.T) {
207
208
// No user blocks stored in the bucket.
208
209
bucketClient := & bucket.ClientMock {}
209
210
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
211
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
210
212
bucketClient .MockIter ("" , []string {}, nil )
211
213
bucketClient .MockIter ("__markers__" , []string {}, nil )
212
214
cfg := prepareConfig ()
@@ -284,6 +286,7 @@ func TestCompactor_ShouldRetryCompactionOnFailureWhileDiscoveringUsersFromBucket
284
286
// Fail to iterate over the bucket while discovering users.
285
287
bucketClient := & bucket.ClientMock {}
286
288
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
289
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
287
290
bucketClient .MockIter ("__markers__" , nil , errors .New ("failed to iterate the bucket" ))
288
291
bucketClient .MockIter ("" , nil , errors .New ("failed to iterate the bucket" ))
289
292
@@ -357,6 +360,7 @@ func TestCompactor_ShouldIncrementCompactionErrorIfFailedToCompactASingleTenant(
357
360
userID := "test-user"
358
361
bucketClient := & bucket.ClientMock {}
359
362
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
363
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
360
364
bucketClient .MockIter ("" , []string {userID }, nil )
361
365
bucketClient .MockIter ("__markers__" , []string {}, nil )
362
366
bucketClient .MockIter (userID + "/" , []string {userID + "/01DTVP434PA9VFXSW2JKB3392D" , userID + "/01FN6CDF3PNEWWRY5MPGJPE3EX" , userID + "/01DTVP434PA9VFXSW2JKB3392D/meta.json" , userID + "/01FN6CDF3PNEWWRY5MPGJPE3EX/meta.json" }, nil )
@@ -414,6 +418,7 @@ func TestCompactor_ShouldIncrementCompactionErrorIfFailedToCompactASingleTenant(
414
418
func TestCompactor_ShouldCompactAndRemoveUserFolder (t * testing.T ) {
415
419
bucketClient := & bucket.ClientMock {}
416
420
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
421
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
417
422
bucketClient .MockIter ("" , []string {"user-1" }, nil )
418
423
bucketClient .MockIter ("__markers__" , []string {}, nil )
419
424
bucketClient .MockExists (users .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
@@ -464,6 +469,7 @@ func TestCompactor_ShouldIterateOverUsersAndRunCompaction(t *testing.T) {
464
469
// Mock the bucket to contain two users, each one with one block.
465
470
bucketClient := & bucket.ClientMock {}
466
471
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
472
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
467
473
bucketClient .MockIter ("" , []string {"user-1" , "user-2" }, nil )
468
474
bucketClient .MockIter ("__markers__" , []string {}, nil )
469
475
bucketClient .MockExists (users .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
@@ -609,6 +615,7 @@ func TestCompactor_ShouldNotCompactBlocksMarkedForDeletion(t *testing.T) {
609
615
// Mock the bucket to contain two users, each one with one block.
610
616
bucketClient := & bucket.ClientMock {}
611
617
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
618
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
612
619
bucketClient .MockIter ("" , []string {"user-1" }, nil )
613
620
bucketClient .MockIter ("__markers__" , []string {}, nil )
614
621
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ" }, nil )
@@ -731,6 +738,7 @@ func TestCompactor_ShouldNotCompactBlocksMarkedForSkipCompact(t *testing.T) {
731
738
// Mock the bucket to contain two users, each one with one block.
732
739
bucketClient := & bucket.ClientMock {}
733
740
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
741
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
734
742
bucketClient .MockIter ("" , []string {"user-1" , "user-2" }, nil )
735
743
bucketClient .MockIter ("__markers__" , []string {}, nil )
736
744
bucketClient .MockExists (users .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
@@ -817,6 +825,7 @@ func TestCompactor_ShouldNotCompactBlocksForUsersMarkedForDeletion(t *testing.T)
817
825
// Mock the bucket to contain two users, each one with one block.
818
826
bucketClient := & bucket.ClientMock {}
819
827
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
828
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
820
829
bucketClient .MockIter ("" , []string {"user-1" }, nil )
821
830
bucketClient .MockIter ("__markers__" , []string {"__markers__/user-1/" }, nil )
822
831
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" }, nil )
@@ -981,6 +990,7 @@ func TestCompactor_ShouldCompactAllUsersOnShardingEnabledButOnlyOneInstanceRunni
981
990
// Mock the bucket to contain two users, each one with one block.
982
991
bucketClient := & bucket.ClientMock {}
983
992
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
993
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
984
994
bucketClient .MockIter ("" , []string {"user-1" , "user-2" }, nil )
985
995
bucketClient .MockIter ("__markers__" , []string {}, nil )
986
996
bucketClient .MockExists (users .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
@@ -1092,6 +1102,7 @@ func TestCompactor_ShouldCompactOnlyUsersOwnedByTheInstanceOnShardingEnabledAndM
1092
1102
// Mock the bucket to contain all users, each one with one block.
1093
1103
bucketClient := & bucket.ClientMock {}
1094
1104
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
1105
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
1095
1106
bucketClient .MockIter ("" , userIDs , nil )
1096
1107
bucketClient .MockIter ("__markers__" , []string {}, nil )
1097
1108
for _ , userID := range userIDs {
@@ -1203,6 +1214,7 @@ func TestCompactor_ShouldCompactOnlyShardsOwnedByTheInstanceOnShardingEnabledWit
1203
1214
// Mock the bucket to contain all users, each one with five blocks, 2 sets of overlapping blocks and 1 separate block.
1204
1215
bucketClient := & bucket.ClientMock {}
1205
1216
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
1217
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
1206
1218
bucketClient .MockIter ("" , userIDs , nil )
1207
1219
bucketClient .MockIter ("__markers__" , []string {}, nil )
1208
1220
@@ -1856,6 +1868,7 @@ func TestCompactor_ShouldFailCompactionOnTimeout(t *testing.T) {
1856
1868
// Mock the bucket
1857
1869
bucketClient := & bucket.ClientMock {}
1858
1870
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
1871
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
1859
1872
bucketClient .MockIter ("" , []string {}, nil )
1860
1873
bucketClient .MockIter ("__markers__" , []string {}, nil )
1861
1874
@@ -1957,6 +1970,7 @@ func TestCompactor_ShouldNotFailCompactionIfAccessDeniedErrDuringMetaSync(t *tes
1957
1970
1958
1971
bucketClient := & bucket.ClientMock {}
1959
1972
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
1973
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
1960
1974
bucketClient .MockIter ("__markers__" , []string {}, nil )
1961
1975
bucketClient .MockIter ("" , []string {"user-1" }, nil )
1962
1976
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ" , "user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ/meta.json" }, nil )
@@ -2008,6 +2022,7 @@ func TestCompactor_ShouldNotFailCompactionIfAccessDeniedErrReturnedFromBucket(t
2008
2022
2009
2023
bucketClient := & bucket.ClientMock {}
2010
2024
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
2025
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
2011
2026
bucketClient .MockIter ("__markers__" , []string {}, nil )
2012
2027
bucketClient .MockIter ("" , []string {"user-1" }, nil )
2013
2028
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ" , "user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ/meta.json" }, nil )
@@ -2059,6 +2074,7 @@ func TestCompactor_FailedWithRetriableError(t *testing.T) {
2059
2074
2060
2075
bucketClient := & bucket.ClientMock {}
2061
2076
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
2077
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
2062
2078
bucketClient .MockIter ("__markers__" , []string {}, nil )
2063
2079
bucketClient .MockIter ("" , []string {"user-1" }, nil )
2064
2080
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ" , "user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ/meta.json" }, nil )
@@ -2113,6 +2129,7 @@ func TestCompactor_FailedWithHaltError(t *testing.T) {
2113
2129
2114
2130
bucketClient := & bucket.ClientMock {}
2115
2131
bucketClient .MockGet (users .UserIndexCompressedFilename , "" , nil )
2132
+ bucketClient .MockUpload (users .UserIndexCompressedFilename , nil )
2116
2133
bucketClient .MockIter ("__markers__" , []string {}, nil )
2117
2134
bucketClient .MockIter ("" , []string {"user-1" }, nil )
2118
2135
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ" , "user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ/meta.json" }, nil )
0 commit comments