From eb915f8ced36d45debdcb1be0ca4b8d211d48bea Mon Sep 17 00:00:00 2001 From: Charlie Le <3375195+CharlieTLe@users.noreply.github.com> Date: Sun, 8 Sep 2024 11:28:14 -0700 Subject: [PATCH] fix: querier integration flaky test Saw this test fail: https://github.com/cortexproject/cortex/actions/runs/10761255507/job/29840284232 Adding this test option to make the test wait until the metric is available. ``` querier_test.go:231: Error Trace: /home/runner/work/cortex/cortex/integration/querier_test.go:231 Error: Received unexpected error: metric not found github.com/cortexproject/cortex/integration/e2e.init :1 runtime.doInit1 /opt/hostedtoolcache/go/1.22.5/x64/src/runtime/proc.go:7176 runtime.doInit /opt/hostedtoolcache/go/1.22.5/x64/src/runtime/proc.go:7143 runtime.main /opt/hostedtoolcache/go/1.22.5/x64/src/runtime/proc.go:253 runtime.goexit /opt/hostedtoolcache/go/1.22.5/x64/src/runtime/asm_amd64.s:1695 metric=cortex_bucket_store_blocks_loaded service=store-gateway-1 github.com/cortexproject/cortex/integration/e2e.(*HTTPService).SumMetrics /home/runner/work/cortex/cortex/integration/e2e/service.go:619 github.com/cortexproject/cortex/integration/e2e.(*CompositeHTTPService).SumMetrics /home/runner/work/cortex/cortex/integration/e2e/composite_service.go:78 github.com/cortexproject/cortex/integration/e2e.(*CompositeHTTPService).WaitSumMetricsWithOptions /home/runner/work/cortex/cortex/integration/e2e/composite_service.go:55 github.com/cortexproject/cortex/integration/e2e.(*CompositeHTTPService).WaitSumMetrics /home/runner/work/cortex/cortex/integration/e2e/composite_service.go:44 github.com/cortexproject/cortex/integration.TestQuerierWithBlocksStorageRunningInMicroservicesMode.func1 /home/runner/work/cortex/cortex/integration/querier_test.go:231 testing.tRunner /opt/hostedtoolcache/go/1.22.5/x64/src/testing/testing.go:1689 runtime.goexit /opt/hostedtoolcache/go/1.22.5/x64/src/runtime/asm_amd64.s:1695 Test: TestQuerierWithBlocksStorageRunningInMicroservicesMode/blocks_sharding_disabled,_memcached_index_cache,thanosEngine=false ``` Signed-off-by: Charlie Le <3375195+CharlieTLe@users.noreply.github.com> --- integration/querier_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/querier_test.go b/integration/querier_test.go index a5e92e299e..98bbf87b1b 100644 --- a/integration/querier_test.go +++ b/integration/querier_test.go @@ -228,7 +228,7 @@ func TestQuerierWithBlocksStorageRunningInMicroservicesMode(t *testing.T) { // then the metric only appears in one store gateway instance. require.NoError(t, storeGateways.WaitSumMetricsWithOptions(e2e.Equals(2), []string{"cortex_bucket_store_blocks_loaded"}, e2e.SkipMissingMetrics)) } else { - require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(float64(2*storeGateways.NumInstances())), "cortex_bucket_store_blocks_loaded")) + require.NoError(t, storeGateways.WaitSumMetricsWithOptions(e2e.Equals(float64(2*storeGateways.NumInstances())), []string{"cortex_bucket_store_blocks_loaded"}, e2e.WaitMissingMetrics)) } // Check how many tenants have been discovered and synced by store-gateways.