From 9034697dc4b3958602fed6a8d6d2fdd1b977591e Mon Sep 17 00:00:00 2001 From: Faisal Kanout Date: Fri, 10 Oct 2025 15:38:57 +0300 Subject: [PATCH] Add tags for the query so the search is scoped within the test (#236706) ## Summary It fixes #231522 by adding tags to the SLO query and narrowing down the selection to match only the SLO created within the test. That avoids any potential interference with other tests OR the racing conditions (the flakiness is unreproducible locally). (cherry picked from commit 02e7114e303492135b4967f5033a5c5e33f7dd5d) --- .../apis/slo/find_slo.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/slo/find_slo.ts b/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/slo/find_slo.ts index 1bc77818f30a9..6932955abf100 100644 --- a/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/slo/find_slo.ts +++ b/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/slo/find_slo.ts @@ -52,9 +52,16 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) { }); it('searches SLOs using kqlQuery', async () => { - const createResponse1 = await sloApi.create(DEFAULT_SLO, adminRoleAuthc); + const testTag = `test-${Date.now()}`; + const createResponse1 = await sloApi.create( + Object.assign({}, DEFAULT_SLO, { tags: ['test', testTag] }), + adminRoleAuthc + ); const createResponse2 = await sloApi.create( - Object.assign({}, DEFAULT_SLO, { name: 'something irrelevant foo' }), + Object.assign({}, DEFAULT_SLO, { + name: 'something irrelevant foo', + tags: ['test', testTag], + }), adminRoleAuthc ); @@ -65,7 +72,7 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) { await retry.tryForTime(180 * 1000, async () => { let response = await supertestWithoutAuth .get(`/api/observability/slos`) - .query({ page: 1, perPage: 333 }) + .query({ page: 1, perPage: 333, kqlQuery: `slo.tags:"${testTag}"` }) .set(adminRoleAuthc.apiKeyHeader) .set(internalHeaders) .send();