[9.3] [profiling] fix failing profiling tests due to [fleet-agent-policies/policy-elastic-agent-on-cloud] not found (#268428)#268450
Merged
Conversation
…policy-elastic-agent-on-cloud] not found (elastic#268428) ## Summary Closes elastic#268400 Closes elastic#268399 Profiling's `setupResources` POST takes the cloud branch (Scout's stateful Kibana runs with `xpack.cloud.id` set), so it tries to create the `profiler_collector` and `profiler_symbolizer` Fleet package policies on the `policy-elastic-agent-on-cloud` agent policy, which only `has_no_setup.spec.ts` provisions via `profilingHelper.installPolicies()`. When the UX Scout tests ran first, the worker order/state shifted just enough that `has_setup_apm_not_installed.spec.ts`'s `beforeAll` reached `setupResources` before `has_no_setup.spec.ts` had created the agent policy, so Fleet's `packagePolicyClient.create` blew up with `Saved object [fleet-agent-policies/policy-elastic-agent-on-cloud] not found`, which the route surfaced as the opaque 500. The fix makes each spec self-provision the agent policy instead of relying on test ordering. Tested locally: ``` # start servers node scripts/scout start-server --arch stateful --domain classic # run ux tests first npx playwright test --project local --grep @local-stateful-classic --config x-pack/solutions/observability/plugins/ux/test/scout/ui/playwright.config.ts # run profiling tests npx playwright test --project local --grep @local-stateful-classic --config x-pack/solutions/observability/plugins/profiling/test/scout/api/playwright.config.ts ``` Before the fix the following error occured: ``` proc [kibana] [2026-05-08T14:05:35.889+02:00][ERROR][plugins.profiling] Error: Saved object [fleet-agent-policies/policy-elastic-agent-on-cloud] not found proc [kibana] at SavedObjectsErrorHelpers.createGenericNotFoundError (saved_objects_error_helpers.ts:284:28) proc [kibana] at agent_policy.ts:752:40 proc [kibana] at processTicksAndRejections (node:internal/process/task_queues:104:5) proc [kibana] at AgentPolicyService.get (agent_policy.ts:747:27) proc [kibana] at PackagePolicyClientImpl.create (package_policy.ts:547:27) proc [kibana] at createCollectorPackagePolicy (fleet_policies.ts:89:3) proc [kibana] at async Promise.all (index 0) proc [kibana] at setupCloud (setup_cloud.ts:36:3) proc [kibana] at route.ts:139:11 proc [kibana] at handle (route.ts:161:26) proc [kibana] at handler (route.ts:78:14) proc [kibana] at Router.handle (router.ts:209:30) proc [kibana] at exports.Manager.execute (/Users/dmle/elastic/github/kibana/node_modules/@hapi/hapi/lib/toolkit.js:60:28) proc [kibana] at Object.internals.handler (/Users/dmle/elastic/github/kibana/node_modules/@hapi/hapi/lib/handler.js:46:20) proc [kibana] at exports.execute (/Users/dmle/elastic/github/kibana/node_modules/@hapi/hapi/lib/handler.js:31:20) proc [kibana] at Request._lifecycle (/Users/dmle/elastic/github/kibana/node_modules/@hapi/hapi/lib/request.js:384:32) proc [kibana] at Request._execute (/Users/dmle/elastic/github/kibana/node_modules/@hapi/hapi/lib/request.js:294:9) {"service":{"version":"9.5.0","type":"kibana","state":"available","node":{"roles":["background_tasks","ui"]},"id":"_jN54-qzRc2aypW_5PVHdw"}} ``` (cherry picked from commit 40f2b94)
This was referenced May 8, 2026
Contributor
Author
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
cc @dmlemeshko |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.3:Questions ?
Please refer to the Backport tool documentation