@@ -154,6 +154,46 @@ func TestQueryFrontendTLSWithBlocksStorageViaFlags(t *testing.T) {
154154 })
155155}
156156
157+ func TestQueryFrontendWithVerticalSharding (t * testing.T ) {
158+ runQueryFrontendTest (t , queryFrontendTestConfig {
159+ testMissingMetricName : false ,
160+ querySchedulerEnabled : false ,
161+ queryStatsEnabled : true ,
162+ setup : func (t * testing.T , s * e2e.Scenario ) (configFile string , flags map [string ]string ) {
163+ require .NoError (t , writeFileToSharedDir (s , cortexConfigFile , []byte (BlocksStorageConfig )))
164+
165+ minio := e2edb .NewMinio (9000 , BlocksStorageFlags ()["-blocks-storage.s3.bucket-name" ])
166+ require .NoError (t , s .StartAndWaitReady (minio ))
167+
168+ // Enable vertical sharding.
169+ flags := mergeFlags (e2e .EmptyFlags (), map [string ]string {
170+ "-frontend.query-vertical-shard-size" : "2" ,
171+ })
172+ return cortexConfigFile , e2e .EmptyFlags ()
173+ },
174+ })
175+ }
176+
177+ func TestQueryFrontendWithVerticalShardingQueryScheduler (t * testing.T ) {
178+ runQueryFrontendTest (t , queryFrontendTestConfig {
179+ testMissingMetricName : false ,
180+ querySchedulerEnabled : true ,
181+ queryStatsEnabled : true ,
182+ setup : func (t * testing.T , s * e2e.Scenario ) (configFile string , flags map [string ]string ) {
183+ require .NoError (t , writeFileToSharedDir (s , cortexConfigFile , []byte (BlocksStorageConfig )))
184+
185+ minio := e2edb .NewMinio (9000 , BlocksStorageFlags ()["-blocks-storage.s3.bucket-name" ])
186+ require .NoError (t , s .StartAndWaitReady (minio ))
187+
188+ // Enable vertical sharding.
189+ flags := mergeFlags (e2e .EmptyFlags (), map [string ]string {
190+ "-frontend.query-vertical-shard-size" : "2" ,
191+ })
192+ return cortexConfigFile , e2e .EmptyFlags ()
193+ },
194+ })
195+ }
196+
157197func runQueryFrontendTest (t * testing.T , cfg queryFrontendTestConfig ) {
158198 const numUsers = 10
159199 const numQueriesPerUser = 10
@@ -304,7 +344,7 @@ func runQueryFrontendTest(t *testing.T, cfg queryFrontendTestConfig) {
304344
305345 require .NoError (t , queryFrontend .WaitSumMetrics (e2e .Equals (numUsers * numQueriesPerUser + extra ), "cortex_query_frontend_queries_total" ))
306346
307- // The number of received request is greater then the query requests because include
347+ // The number of received request is greater than the query requests because include
308348 // requests to /metrics and /ready.
309349 require .NoError (t , queryFrontend .WaitSumMetricsWithOptions (e2e .Greater (numUsers * numQueriesPerUser ), []string {"cortex_request_duration_seconds" }, e2e .WithMetricCount ))
310350 require .NoError (t , querier .WaitSumMetricsWithOptions (e2e .Greater (numUsers * numQueriesPerUser ), []string {"cortex_request_duration_seconds" }, e2e .WithMetricCount ))
0 commit comments