@@ -307,9 +307,10 @@ func TestQuerierWithBlocksStorageRunningInMicroservicesMode(t *testing.T) {
307307 memcached := e2ecache .NewMemcached ()
308308 redis := e2ecache .NewRedis ()
309309 require .NoError (t , s .StartAndWaitReady (consul , minio , memcached , redis ))
310- if testCfg .bucketStorageType == "tsdb" {
310+ switch testCfg .bucketStorageType {
311+ case "tsdb" :
311312 flags ["-blocks-storage.bucket-store.index-cache.backend" ] = testCfg .indexCacheBackend
312- } else if testCfg . bucketStorageType == "parquet" {
313+ case "parquet" :
313314 flags ["-parquet-converter.enabled" ] = "true"
314315 flags ["-parquet-converter.conversion-interval" ] = "1s"
315316 flags ["-parquet-converter.ring.consul.hostname" ] = consul .NetworkHTTPEndpoint ()
@@ -414,7 +415,8 @@ func TestQuerierWithBlocksStorageRunningInMicroservicesMode(t *testing.T) {
414415 require .NoError (t , s .StartAndWaitReady (compactor ))
415416 }
416417
417- if testCfg .bucketStorageType == "tsdb" {
418+ switch testCfg .bucketStorageType {
419+ case "tsdb" :
418420 // Wait until the store-gateway has synched the new uploaded blocks. When sharding is enabled
419421 // we don't known which store-gateway instance will synch the blocks, so we need to wait on
420422 // metrics extracted from all instances.
@@ -438,7 +440,7 @@ func TestQuerierWithBlocksStorageRunningInMicroservicesMode(t *testing.T) {
438440 // Wait until the querier has discovered the uploaded blocks.
439441 require .NoError (t , querier .WaitSumMetricsWithOptions (e2e .Equals (2 ), []string {"cortex_blocks_meta_synced" }, e2e .WaitMissingMetrics ))
440442 }
441- } else if testCfg . bucketStorageType == "parquet" {
443+ case "parquet" :
442444 // Wait until the parquet-converter convert blocks
443445 require .NoError (t , parquetConverter .WaitSumMetricsWithOptions (e2e .Equals (float64 (2 )), []string {"cortex_parquet_converter_blocks_converted_total" }, e2e .WaitMissingMetrics ))
444446 }
@@ -471,7 +473,8 @@ func TestQuerierWithBlocksStorageRunningInMicroservicesMode(t *testing.T) {
471473 require .Equal (t , model .ValVector , result .Type ())
472474 assert .Equal (t , expectedVector1 , result .(model.Vector ))
473475
474- if testCfg .bucketStorageType == "tsdb" {
476+ switch testCfg .bucketStorageType {
477+ case "tsdb" :
475478 if numberOfCacheBackends > 1 {
476479 // 6 requests for Expanded Postings, 5 for Postings and 3 for Series.
477480 require .NoError (t , storeGateways .WaitSumMetricsWithOptions (e2e .Equals (float64 (6 + 5 + 3 )), []string {"thanos_store_index_cache_requests_total" }, e2e .WithLabelMatchers (
@@ -496,7 +499,7 @@ func TestQuerierWithBlocksStorageRunningInMicroservicesMode(t *testing.T) {
496499 require .NoError (t , storeGateways .WaitSumMetrics (e2e .Equals (float64 (6 + 5 + 3 )), "thanos_store_index_cache_requests_total" ))
497500 }
498501 require .NoError (t , storeGateways .WaitSumMetrics (e2e .Equals (2 ), "thanos_store_index_cache_hits_total" )) // this time has used the index cache
499- } else if testCfg . bucketStorageType == "parquet" {
502+ case "parquet" :
500503 if strings .Contains (testCfg .parquetLabelsCache , tsdb .CacheBackendInMemory ) {
501504 require .NoError (t , storeGateways .WaitSumMetrics (e2e .Greater (float64 (0 )), "thanos_cache_inmemory_requests_total" ))
502505 }
@@ -669,9 +672,10 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
669672 },
670673 )
671674 require .NoError (t , writeFileToSharedDir (s , "alertmanager_configs/user-1.yaml" , []byte (cortexAlertmanagerUserConfigYaml )))
672- if testCfg .bucketStorageType == "tsdb" {
675+ switch testCfg .bucketStorageType {
676+ case "tsdb" :
673677 flags ["-blocks-storage.bucket-store.index-cache.backend" ] = testCfg .indexCacheBackend
674- } else if testCfg . bucketStorageType == "parquet" {
678+ case "parquet" :
675679 flags ["-parquet-converter.enabled" ] = "true"
676680 flags ["-parquet-converter.conversion-interval" ] = "1s"
677681 flags ["-parquet-converter.ring.consul.hostname" ] = consul .NetworkHTTPEndpoint ()
@@ -762,7 +766,8 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
762766 require .NoError (t , s .StartAndWaitReady (compactor ))
763767 }
764768
765- if testCfg .bucketStorageType == "tsdb" {
769+ switch testCfg .bucketStorageType {
770+ case "tsdb" :
766771 // Wait until the store-gateway has synched the new uploaded blocks. The number of blocks loaded
767772 // may be greater than expected if the compactor is running (there may have been compacted).
768773 const shippedBlocks = 2
@@ -777,7 +782,7 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
777782 require .NoError (t , cluster .WaitSumMetricsWithOptions (e2e .Equals (float64 (2 * cluster .NumInstances ()* 2 )), []string {"cortex_blocks_meta_synced" }, e2e .WithLabelMatchers (
778783 labels .MustNewMatcher (labels .MatchEqual , "component" , "querier" ))))
779784 }
780- } else if testCfg . bucketStorageType == "parquet" {
785+ case "parquet" :
781786 // Wait until the parquet-converter convert blocks
782787 require .NoError (t , parquetConverter .WaitSumMetrics (e2e .Equals (float64 (2 * cluster .NumInstances ())), "cortex_parquet_converter_blocks_converted_total" ))
783788 }
@@ -814,10 +819,11 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
814819 require .Equal (t , model .ValVector , result .Type ())
815820 assert .Equal (t , expectedVector1 , result .(model.Vector ))
816821
817- if testCfg .bucketStorageType == "tsdb" {
822+ switch testCfg .bucketStorageType {
823+ case "tsdb" :
818824 require .NoError (t , cluster .WaitSumMetrics (e2e .Equals (float64 ((12 + 2 )* seriesReplicationFactor )), "thanos_store_index_cache_requests_total" ))
819825 require .NoError (t , cluster .WaitSumMetrics (e2e .Equals (float64 (2 * seriesReplicationFactor )), "thanos_store_index_cache_hits_total" )) // this time has used the index cache
820- } else if testCfg . bucketStorageType == "parquet" {
826+ case "parquet" :
821827 switch testCfg .parquetLabelsCache {
822828 case tsdb .CacheBackendInMemory :
823829 require .NoError (t , cluster .WaitSumMetrics (e2e .Greater (float64 (0 )), "thanos_cache_inmemory_requests_total" ))
0 commit comments