From abf2ee7232a39d930d730cf7f759dc3a2a0ec2ff Mon Sep 17 00:00:00 2001 From: Francesco Fagnani Date: Tue, 15 Jul 2025 07:46:02 +0200 Subject: [PATCH] [Synthetics] Fixed EnableDefaultAlerting test (#227779) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/`. 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 439d81f05af9b117b12cbbbf066a7a628dc0bb37) --- .../apis/observability/synthetics/enable_default_alerting.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/synthetics/enable_default_alerting.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/synthetics/enable_default_alerting.ts index f542f1fba4fd0..7be87970915c2 100644 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/synthetics/enable_default_alerting.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/synthetics/enable_default_alerting.ts @@ -46,7 +46,9 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) { }); beforeEach(async () => { - await kibanaServer.savedObjects.cleanStandardList(); + await kibanaServer.savedObjects.clean({ + types: ['synthetics-monitor-multi-space'], + }); privateLocation = await privateLocationTestService.addTestPrivateLocation(); httpMonitorJson = { ..._httpMonitorJson,