diff --git a/changelog.d/5-internal/deflake-metrics b/changelog.d/5-internal/deflake-metrics new file mode 100644 index 0000000000..e923cbb5ef --- /dev/null +++ b/changelog.d/5-internal/deflake-metrics @@ -0,0 +1 @@ +Deflake integration test: metrics diff --git a/services/brig/test/integration/API/Metrics.hs b/services/brig/test/integration/API/Metrics.hs index 836efebeab..22dffa10f9 100644 --- a/services/brig/test/integration/API/Metrics.hs +++ b/services/brig/test/integration/API/Metrics.hs @@ -51,9 +51,6 @@ testPrometheusMetrics brig = do -- Should contain the request duration metric in its output const (Just "TYPE http_request_duration_seconds histogram") =~= responseBody --- | This test runs in `withSettingsOverrides` to ensure that only this test is --- accessing brig, if we target the real brig, some other test running --- in-parallel could make this test fail. testMetricsEndpoint :: Opt.Opts -> Brig -> Http () testMetricsEndpoint opts brig0 = withSettingsOverrides opts $ do let brig = apiVersion "v1" . brig0 @@ -71,11 +68,11 @@ testMetricsEndpoint opts brig0 = withSettingsOverrides opts $ do _ <- post (brig . path p3 . contentJson . queryItem "persist" "true" . json (defEmailLogin email) . expect2xx) _ <- post (brig . path p3 . contentJson . queryItem "persist" "true" . json (defEmailLogin email) . expect2xx) countSelf <- getCount "/self" "GET" - liftIO $ assertEqual "/self was called once" (beforeSelf + 1) countSelf + liftIO $ assertBool "/self was called at least once" ((beforeSelf + 1) <= countSelf) countClients <- getCount "/users/:uid/clients" "GET" - liftIO $ assertEqual "/users/:uid/clients was called twice" (beforeClients + 2) countClients + liftIO $ assertBool "/users/:uid/clients was called at least twice" ((beforeClients + 2) <= countClients) countProperties <- getCount "/login" "POST" - liftIO $ assertEqual "/login was called twice" (beforeProperties + 2) countProperties + liftIO $ assertBool "/login was called at least twice" ((beforeProperties + 2) <= countProperties) where getCount endpoint m = do rsp <- responseBody <$> get (brig0 . path "i/metrics")