@@ -131,7 +131,7 @@ func prepareTestBlocks(t testing.TB, now time.Time, count int, dir string, bkt o
131131 return
132132}
133133
134- func prepareStoreWithTestBlocks (t testing.TB , dir string , bkt objstore.Bucket , manyParts bool , chunksLimiterFactory ChunksLimiterFactory , seriesLimiterFactory SeriesLimiterFactory , bytesLimiterFactory BytesLimiterFactory , relabelConfig []* relabel.Config , filterConf * FilterConfig ) * storeSuite {
134+ func prepareStoreWithTestBlocks (t testing.TB , dir string , bkt objstore.Bucket , manyParts bool , chunksLimiterFactory ChunksLimiterFactory , seriesLimiterFactory SeriesLimiterFactory , bytesLimiterFactory BytesLimiterFactory , relabelConfig []* relabel.Config , filterConf * FilterConfig , opts ... BucketStoreOption ) * storeSuite {
135135 series := []labels.Labels {
136136 labels .FromStrings ("a" , "1" , "b" , "1" ),
137137 labels .FromStrings ("a" , "1" , "b" , "2" ),
@@ -176,10 +176,10 @@ func prepareStoreWithTestBlocks(t testing.TB, dir string, bkt objstore.Bucket, m
176176 true ,
177177 true ,
178178 time .Minute ,
179- WithLogger (s .logger ),
180- WithIndexCache (s .cache ),
181- WithFilterConfig (filterConf ),
182- WithRegistry (reg ),
179+ append ( opts , WithLogger (s .logger ),
180+ WithIndexCache (s .cache ),
181+ WithFilterConfig (filterConf ),
182+ WithRegistry (reg )) ... ,
183183 )
184184 testutil .Ok (t , err )
185185 defer func () { testutil .Ok (t , store .Close ()) }()
@@ -619,6 +619,7 @@ func TestBucketStore_Series_ChunksLimiter_e2e(t *testing.T) {
619619 maxChunksLimit uint64
620620 maxSeriesLimit uint64
621621 maxBytesLimit int64
622+ storeOpts []BucketStoreOption
622623 expectedErr string
623624 code codes.Code
624625 }{
@@ -630,19 +631,40 @@ func TestBucketStore_Series_ChunksLimiter_e2e(t *testing.T) {
630631 expectedErr : "exceeded chunks limit" ,
631632 code : codes .ResourceExhausted ,
632633 },
634+ "should fail if the max chunks limit is exceeded - ResourceExhausted (sortingStrategyNone)" : {
635+ maxChunksLimit : expectedChunks - 1 ,
636+ expectedErr : "exceeded chunks limit" ,
637+ storeOpts : []BucketStoreOption {WithDontResort (true )},
638+ code : codes .ResourceExhausted ,
639+ },
633640 "should fail if the max series limit is exceeded - ResourceExhausted" : {
634641 maxChunksLimit : expectedChunks ,
635642 expectedErr : "exceeded series limit" ,
636643 maxSeriesLimit : 1 ,
637644 code : codes .ResourceExhausted ,
638645 },
646+ "should fail if the max series limit is exceeded - ResourceExhausted (sortingStrategyNone)" : {
647+ maxChunksLimit : expectedChunks ,
648+ expectedErr : "exceeded series limit" ,
649+ maxSeriesLimit : 1 ,
650+ storeOpts : []BucketStoreOption {WithDontResort (true )},
651+ code : codes .ResourceExhausted ,
652+ },
639653 "should fail if the max bytes limit is exceeded - ResourceExhausted" : {
640654 maxChunksLimit : expectedChunks ,
641655 expectedErr : "exceeded bytes limit" ,
642656 maxSeriesLimit : 2 ,
643657 maxBytesLimit : 1 ,
644658 code : codes .ResourceExhausted ,
645659 },
660+ "should fail if the max bytes limit is exceeded - ResourceExhausted (sortingStrategyNone)" : {
661+ maxChunksLimit : expectedChunks ,
662+ expectedErr : "exceeded bytes limit" ,
663+ maxSeriesLimit : 2 ,
664+ maxBytesLimit : 1 ,
665+ storeOpts : []BucketStoreOption {WithDontResort (true )},
666+ code : codes .ResourceExhausted ,
667+ },
646668 }
647669
648670 for testName , testData := range cases {
@@ -653,7 +675,7 @@ func TestBucketStore_Series_ChunksLimiter_e2e(t *testing.T) {
653675
654676 dir := t .TempDir ()
655677
656- s := prepareStoreWithTestBlocks (t , dir , bkt , false , NewChunksLimiterFactory (testData .maxChunksLimit ), NewSeriesLimiterFactory (testData .maxSeriesLimit ), NewBytesLimiterFactory (units .Base2Bytes (testData .maxBytesLimit )), emptyRelabelConfig , allowAllFilterConf )
678+ s := prepareStoreWithTestBlocks (t , dir , bkt , false , NewChunksLimiterFactory (testData .maxChunksLimit ), NewSeriesLimiterFactory (testData .maxSeriesLimit ), NewBytesLimiterFactory (units .Base2Bytes (testData .maxBytesLimit )), emptyRelabelConfig , allowAllFilterConf , testData . storeOpts ... )
657679 testutil .Ok (t , s .store .SyncBlocks (ctx ))
658680
659681 req := & storepb.SeriesRequest {
0 commit comments