Skip to content

Comments

[Synthetics] Fixed EnableDefaultAlerting test#227779

Merged
cesco-f merged 1 commit intoelastic:mainfrom
cesco-f:fix-synthetics-test
Jul 15, 2025
Merged

[Synthetics] Fixed EnableDefaultAlerting test#227779
cesco-f merged 1 commit intoelastic:mainfrom
cesco-f:fix-synthetics-test

Conversation

@cesco-f
Copy link
Contributor

@cesco-f cesco-f commented Jul 14, 2025

This PR closes #225448 .

EnableDefaultAlerting creates a new Fleet agent-policy for every test case.
Immediately after each case our beforeEach calls kibanaServer.savedObjects.cleanStandardList(), which deletes all saved-objects, including ingest-agent-policies/<id>.

Fleet’s packagePolicyService.bulkCreate() is invoked from the Synthetics server when the monitor is saved.
Because we call it with asyncDeploy: true, Fleet queues the package-policy creation and returns. A few seconds later the background task tries to attach the new synthetics package-policy to the agent-policy ID it received. If we have wiped that saved-object in the meantime the lookup fails.

Instead of wiping everything we now remove only the objects that matter for the test in the beforeEach.

@cesco-f cesco-f added release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v9.1.0 v8.19.0 v9.2.0 labels Jul 14, 2025
@github-actions github-actions bot added the author:obs-ux-management PRs authored by the obs ux management team label Jul 14, 2025
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#8638

[✅] x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/stateful/oblt.stateful.config.ts: 25/25 tests passed.

see run history

@cesco-f cesco-f marked this pull request as ready for review July 14, 2025 11:17
@cesco-f cesco-f requested a review from a team as a code owner July 14, 2025 11:17
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #83 / cases security and spaces enabled: basic Common analytics indexes synchronization task should sync the cases attachments index

Metrics [docs]

✅ unchanged

@cesco-f cesco-f merged commit 439d81f into elastic:main Jul 15, 2025
23 of 24 checks passed
@cesco-f cesco-f deleted the fix-synthetics-test branch July 15, 2025 05:46
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19, 9.1

https://github.com/elastic/kibana/actions/runs/16285154671

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 15, 2025
This PR closes elastic#225448 .

`EnableDefaultAlerting` creates a new Fleet agent-policy for every test
case.
Immediately after each case our `beforeEach` calls
`kibanaServer.savedObjects.cleanStandardList()`, which deletes all
saved-objects, including `ingest-agent-policies/<id>`.

Fleet’s `packagePolicyService.bulkCreate()` is invoked from the
Synthetics server when the monitor is saved.
Because we call it with `asyncDeploy: true`, Fleet queues the
package-policy creation and returns. A few seconds later the background
task tries to attach the new synthetics package-policy to the
agent-policy ID it received. If we have wiped that saved-object in the
meantime the lookup fails.

Instead of wiping everything we now remove only the objects that matter
for the test in the `beforeEach`.

(cherry picked from commit 439d81f)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 15, 2025
This PR closes elastic#225448 .

`EnableDefaultAlerting` creates a new Fleet agent-policy for every test
case.
Immediately after each case our `beforeEach` calls
`kibanaServer.savedObjects.cleanStandardList()`, which deletes all
saved-objects, including `ingest-agent-policies/<id>`.

Fleet’s `packagePolicyService.bulkCreate()` is invoked from the
Synthetics server when the monitor is saved.
Because we call it with `asyncDeploy: true`, Fleet queues the
package-policy creation and returns. A few seconds later the background
task tries to attach the new synthetics package-policy to the
agent-policy ID it received. If we have wiped that saved-object in the
meantime the lookup fails.

Instead of wiping everything we now remove only the objects that matter
for the test in the `beforeEach`.

(cherry picked from commit 439d81f)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jul 15, 2025
# Backport

This will backport the following commits from `main` to `9.1`:
- [[Synthetics] Fixed EnableDefaultAlerting test
(#227779)](#227779)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Francesco
Fagnani","email":"fagnani.francesco@gmail.com"},"sourceCommit":{"committedDate":"2025-07-15T05:46:02Z","message":"[Synthetics]
Fixed EnableDefaultAlerting test (#227779)\n\nThis PR closes #225448
.\n\n`EnableDefaultAlerting` creates a new Fleet agent-policy for every
test\ncase.\nImmediately after each case our `beforeEach`
calls\n`kibanaServer.savedObjects.cleanStandardList()`, which deletes
all\nsaved-objects, including `ingest-agent-policies/<id>`.\n\nFleet’s
`packagePolicyService.bulkCreate()` is invoked from the\nSynthetics
server when the monitor is saved.\nBecause we call it with `asyncDeploy:
true`, Fleet queues the\npackage-policy creation and returns. A few
seconds later the background\ntask tries to attach the new synthetics
package-policy to the\nagent-policy ID it received. If we have wiped
that saved-object in the\nmeantime the lookup fails.\n\nInstead of
wiping everything we now remove only the objects that matter\nfor the
test in the
`beforeEach`.","sha":"439d81f05af9b117b12cbbbf066a7a628dc0bb37","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.1.0","v8.19.0","author:obs-ux-management","v9.2.0"],"title":"[Synthetics]
Fixed EnableDefaultAlerting
test","number":227779,"url":"https://github.com/elastic/kibana/pull/227779","mergeCommit":{"message":"[Synthetics]
Fixed EnableDefaultAlerting test (#227779)\n\nThis PR closes #225448
.\n\n`EnableDefaultAlerting` creates a new Fleet agent-policy for every
test\ncase.\nImmediately after each case our `beforeEach`
calls\n`kibanaServer.savedObjects.cleanStandardList()`, which deletes
all\nsaved-objects, including `ingest-agent-policies/<id>`.\n\nFleet’s
`packagePolicyService.bulkCreate()` is invoked from the\nSynthetics
server when the monitor is saved.\nBecause we call it with `asyncDeploy:
true`, Fleet queues the\npackage-policy creation and returns. A few
seconds later the background\ntask tries to attach the new synthetics
package-policy to the\nagent-policy ID it received. If we have wiped
that saved-object in the\nmeantime the lookup fails.\n\nInstead of
wiping everything we now remove only the objects that matter\nfor the
test in the
`beforeEach`.","sha":"439d81f05af9b117b12cbbbf066a7a628dc0bb37"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227779","number":227779,"mergeCommit":{"message":"[Synthetics]
Fixed EnableDefaultAlerting test (#227779)\n\nThis PR closes #225448
.\n\n`EnableDefaultAlerting` creates a new Fleet agent-policy for every
test\ncase.\nImmediately after each case our `beforeEach`
calls\n`kibanaServer.savedObjects.cleanStandardList()`, which deletes
all\nsaved-objects, including `ingest-agent-policies/<id>`.\n\nFleet’s
`packagePolicyService.bulkCreate()` is invoked from the\nSynthetics
server when the monitor is saved.\nBecause we call it with `asyncDeploy:
true`, Fleet queues the\npackage-policy creation and returns. A few
seconds later the background\ntask tries to attach the new synthetics
package-policy to the\nagent-policy ID it received. If we have wiped
that saved-object in the\nmeantime the lookup fails.\n\nInstead of
wiping everything we now remove only the objects that matter\nfor the
test in the
`beforeEach`.","sha":"439d81f05af9b117b12cbbbf066a7a628dc0bb37"}}]}]
BACKPORT-->

Co-authored-by: Francesco Fagnani <fagnani.francesco@gmail.com>
kibanamachine added a commit that referenced this pull request Jul 15, 2025
# Backport

This will backport the following commits from `main` to `8.19`:
- [[Synthetics] Fixed EnableDefaultAlerting test
(#227779)](#227779)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Francesco
Fagnani","email":"fagnani.francesco@gmail.com"},"sourceCommit":{"committedDate":"2025-07-15T05:46:02Z","message":"[Synthetics]
Fixed EnableDefaultAlerting test (#227779)\n\nThis PR closes #225448
.\n\n`EnableDefaultAlerting` creates a new Fleet agent-policy for every
test\ncase.\nImmediately after each case our `beforeEach`
calls\n`kibanaServer.savedObjects.cleanStandardList()`, which deletes
all\nsaved-objects, including `ingest-agent-policies/<id>`.\n\nFleet’s
`packagePolicyService.bulkCreate()` is invoked from the\nSynthetics
server when the monitor is saved.\nBecause we call it with `asyncDeploy:
true`, Fleet queues the\npackage-policy creation and returns. A few
seconds later the background\ntask tries to attach the new synthetics
package-policy to the\nagent-policy ID it received. If we have wiped
that saved-object in the\nmeantime the lookup fails.\n\nInstead of
wiping everything we now remove only the objects that matter\nfor the
test in the
`beforeEach`.","sha":"439d81f05af9b117b12cbbbf066a7a628dc0bb37","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.1.0","v8.19.0","author:obs-ux-management","v9.2.0"],"title":"[Synthetics]
Fixed EnableDefaultAlerting
test","number":227779,"url":"https://github.com/elastic/kibana/pull/227779","mergeCommit":{"message":"[Synthetics]
Fixed EnableDefaultAlerting test (#227779)\n\nThis PR closes #225448
.\n\n`EnableDefaultAlerting` creates a new Fleet agent-policy for every
test\ncase.\nImmediately after each case our `beforeEach`
calls\n`kibanaServer.savedObjects.cleanStandardList()`, which deletes
all\nsaved-objects, including `ingest-agent-policies/<id>`.\n\nFleet’s
`packagePolicyService.bulkCreate()` is invoked from the\nSynthetics
server when the monitor is saved.\nBecause we call it with `asyncDeploy:
true`, Fleet queues the\npackage-policy creation and returns. A few
seconds later the background\ntask tries to attach the new synthetics
package-policy to the\nagent-policy ID it received. If we have wiped
that saved-object in the\nmeantime the lookup fails.\n\nInstead of
wiping everything we now remove only the objects that matter\nfor the
test in the
`beforeEach`.","sha":"439d81f05af9b117b12cbbbf066a7a628dc0bb37"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227779","number":227779,"mergeCommit":{"message":"[Synthetics]
Fixed EnableDefaultAlerting test (#227779)\n\nThis PR closes #225448
.\n\n`EnableDefaultAlerting` creates a new Fleet agent-policy for every
test\ncase.\nImmediately after each case our `beforeEach`
calls\n`kibanaServer.savedObjects.cleanStandardList()`, which deletes
all\nsaved-objects, including `ingest-agent-policies/<id>`.\n\nFleet’s
`packagePolicyService.bulkCreate()` is invoked from the\nSynthetics
server when the monitor is saved.\nBecause we call it with `asyncDeploy:
true`, Fleet queues the\npackage-policy creation and returns. A few
seconds later the background\ntask tries to attach the new synthetics
package-policy to the\nagent-policy ID it received. If we have wiped
that saved-object in the\nmeantime the lookup fails.\n\nInstead of
wiping everything we now remove only the objects that matter\nfor the
test in the
`beforeEach`.","sha":"439d81f05af9b117b12cbbbf066a7a628dc0bb37"}}]}]
BACKPORT-->

Co-authored-by: Francesco Fagnani <fagnani.francesco@gmail.com>
Bluefinger pushed a commit to Bluefinger/kibana that referenced this pull request Jul 22, 2025
This PR closes elastic#225448 .

`EnableDefaultAlerting` creates a new Fleet agent-policy for every test
case.
Immediately after each case our `beforeEach` calls
`kibanaServer.savedObjects.cleanStandardList()`, which deletes all
saved-objects, including `ingest-agent-policies/<id>`.

Fleet’s `packagePolicyService.bulkCreate()` is invoked from the
Synthetics server when the monitor is saved.
Because we call it with `asyncDeploy: true`, Fleet queues the
package-policy creation and returns. A few seconds later the background
task tries to attach the new synthetics package-policy to the
agent-policy ID it received. If we have wiped that saved-object in the
meantime the lookup fails.

Instead of wiping everything we now remove only the objects that matter
for the test in the `beforeEach`.
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
This PR closes elastic#225448 .

`EnableDefaultAlerting` creates a new Fleet agent-policy for every test
case.
Immediately after each case our `beforeEach` calls
`kibanaServer.savedObjects.cleanStandardList()`, which deletes all
saved-objects, including `ingest-agent-policies/<id>`.

Fleet’s `packagePolicyService.bulkCreate()` is invoked from the
Synthetics server when the monitor is saved.
Because we call it with `asyncDeploy: true`, Fleet queues the
package-policy creation and returns. A few seconds later the background
task tries to attach the new synthetics package-policy to the
agent-policy ID it received. If we have wiped that saved-object in the
meantime the lookup fails.

Instead of wiping everything we now remove only the objects that matter
for the test in the `beforeEach`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:obs-ux-management PRs authored by the obs ux management team backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes v8.19.0 v9.1.0 v9.2.0

Projects

None yet

4 participants