Skip to content

Commit 4948c88

Browse files
[9.1] Add tags for the query so the search is scoped within the test (#236706) (#238443)
# Backport This will backport the following commits from `main` to `9.1`: - [Add tags for the query so the search is scoped within the test (#236706)](#236706) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Faisal Kanout","email":"faisal.kanout@elastic.co"},"sourceCommit":{"committedDate":"2025-10-10T12:38:57Z","message":"Add tags for the query so the search is scoped within the test (#236706)\n\n## Summary\n\nIt fixes #231522 by adding tags to the SLO query and narrowing down the\nselection to match only the SLO created within the test. That avoids any\npotential interference with other tests OR the racing conditions (the\nflakiness is unreproducible locally).","sha":"02e7114e303492135b4967f5033a5c5e33f7dd5d","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","Feature:SLO","Team:obs-ux-management","author:obs-ux-management","v9.2.0","v9.3.0"],"title":"Add tags for the query so the search is scoped within the test","number":236706,"url":"https://github.com/elastic/kibana/pull/236706","mergeCommit":{"message":"Add tags for the query so the search is scoped within the test (#236706)\n\n## Summary\n\nIt fixes #231522 by adding tags to the SLO query and narrowing down the\nselection to match only the SLO created within the test. That avoids any\npotential interference with other tests OR the racing conditions (the\nflakiness is unreproducible locally).","sha":"02e7114e303492135b4967f5033a5c5e33f7dd5d"}},"sourceBranch":"main","suggestedTargetBranches":["9.2"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/236706","number":236706,"mergeCommit":{"message":"Add tags for the query so the search is scoped within the test (#236706)\n\n## Summary\n\nIt fixes #231522 by adding tags to the SLO query and narrowing down the\nselection to match only the SLO created within the test. That avoids any\npotential interference with other tests OR the racing conditions (the\nflakiness is unreproducible locally).","sha":"02e7114e303492135b4967f5033a5c5e33f7dd5d"}}]}] BACKPORT--> Co-authored-by: Faisal Kanout <faisal.kanout@elastic.co>
1 parent dc659a3 commit 4948c88

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

  • x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/slo

x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/slo/find_slo.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,16 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
5252
});
5353

5454
it('searches SLOs using kqlQuery', async () => {
55-
const createResponse1 = await sloApi.create(DEFAULT_SLO, adminRoleAuthc);
55+
const testTag = `test-${Date.now()}`;
56+
const createResponse1 = await sloApi.create(
57+
Object.assign({}, DEFAULT_SLO, { tags: ['test', testTag] }),
58+
adminRoleAuthc
59+
);
5660
const createResponse2 = await sloApi.create(
57-
Object.assign({}, DEFAULT_SLO, { name: 'something irrelevant foo' }),
61+
Object.assign({}, DEFAULT_SLO, {
62+
name: 'something irrelevant foo',
63+
tags: ['test', testTag],
64+
}),
5865
adminRoleAuthc
5966
);
6067

@@ -65,7 +72,7 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
6572
await retry.tryForTime(180 * 1000, async () => {
6673
let response = await supertestWithoutAuth
6774
.get(`/api/observability/slos`)
68-
.query({ page: 1, perPage: 333 })
75+
.query({ page: 1, perPage: 333, kqlQuery: `slo.tags:"${testTag}"` })
6976
.set(adminRoleAuthc.apiKeyHeader)
7077
.set(internalHeaders)
7178
.send();

0 commit comments

Comments
 (0)