Skip to content

[9.3] [Fleet] add retry to knowledge base api tests (#246396)#247104

Merged
kibanamachine merged 2 commits intoelastic:9.3from
kibanamachine:backport/9.3/pr-246396
Dec 23, 2025
Merged

[9.3] [Fleet] add retry to knowledge base api tests (#246396)#247104
kibanamachine merged 2 commits intoelastic:9.3from
kibanamachine:backport/9.3/pr-246396

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.3:

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine requested a review from a team as a code owner December 19, 2025 14:34
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Dec 19, 2025
@kibanamachine kibanamachine enabled auto-merge (squash) December 19, 2025 14:34
@botelastic botelastic Bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Dec 19, 2025
## Summary

Closes elastic#246383
Closes elastic#246204
Closes elastic#235915
Closes elastic#246213
Closes elastic#246183
Closes elastic#246272

Use retry instead of wait for api tests to wait for knowledge_base docs
when installing packages, as it is an async step.
Relates elastic#245080

It seems the knowledge base indexing is flaky, sometimes failing with
errors.

```
[00:04:20]           │ proc [kibana] [2025-12-16T12:24:05.592+00:00][ERROR][plugins.fleet] Bulk index operation failed: {"index":{"_index":".integration_knowledge","_id":"all_assets-README.md","status":400,"error":{"type":"inference_exception","reason":"Exception when running inference id [.elser-2-elasticsearch] on field [content]","caused_by":{"type":"status_exception","reason":"Model definition truncated. Unable to deserialize trained model definition [.elser_model_2_linux-x86_64]"}}}} {"service":{"node":{"roles":["background_tasks","ui"]}}}
[00:04:20]           │ proc [kibana] [2025-12-16T12:24:05.592+00:00][ERROR][plugins.fleet] 1 out of 1 documents failed to index for package all_assets {"service":{"node":{"roles":["background_tasks","ui"]}}}

[00:02:46]         │ proc [kibana] [2025-12-16T10:27:11.732+00:00][WARN ][plugins.fleet] Retrying Elasticsearch operation after [8s] due to error: TimeoutError: Request timed out TimeoutError: Request timed out
[00:02:46]         │ proc [kibana]     at KibanaTransport._request (/opt/buildkite-agent/builds/bk-agent-prod-gcp-1765880237283723306/elastic/kibana-flaky-test-suite-runner/kibana-build-xpack/node_modules/@elastic/transport/lib/Transport.js:564:50)
[00:02:46]         │ proc [kibana]     at processTicksAndRejections (node:internal/process/task_queues:105:5)
[00:02:46]         │ proc [kibana]     at /opt/buildkite-agent/builds/bk-agent-prod-gcp-1765880237283723306/elastic/kibana-flaky-test-suite-runner/kibana-build-xpack/node_modules/@elastic/transport/lib/Transport.js:631:32
[00:02:46]         │ proc [kibana]     at KibanaTransport.request (/opt/buildkite-agent/builds/bk-agent-prod-gcp-1765880237283723306/elastic/kibana-flaky-test-suite-runner/kibana-build-xpack/node_modules/@elastic/transport/lib/Transport.js:627:20)
[00:02:46]         │ proc [kibana]     at KibanaTransport.request (/opt/buildkite-agent/builds/bk-agent-prod-gcp-1765880237283723306/elastic/kibana-flaky-test-suite-runner/kibana-build-xpack/node_modules/@kbn/core-elasticsearch-client-server-internal/src/create_transport.js:60:16)
[00:02:46]         │ proc [kibana]     at ClientTraced.BulkApi [as bulk] (/opt/buildkite-agent/builds/bk-agent-prod-gcp-1765880237283723306/elastic/kibana-flaky-test-suite-runner/kibana-build-xpack/node_modules/@elastic/elasticsearch/lib/api/api/bulk.js:75:12)
[00:02:46]         │ proc [kibana]     at retryTransientEsErrors (/opt/buildkite-agent/builds/bk-agent-prod-gcp-1765880237283723306/elastic/kibana-flaky-test-suite-runner/kibana-build-xpack/node_modules/@kbn/fleet-plugin/server/services/epm/elasticsearch/retry.js:36:12)
[00:02:46]         │ proc [kibana]     at saveKnowledgeBaseContentToIndex (/opt/buildkite-agent/builds/bk-agent-prod-gcp-1765880237283723306/elastic/kibana-flaky-test-suite-runner/kibana-build-xpack/node_modules/@kbn/fleet-plugin/server/services/epm/packages/knowledge_base_index.js:60:26)
[00:02:46]         │ proc [kibana]     at indexKnowledgeBase (/opt/buildkite-agent/builds/bk-agent-prod-gcp-1765880237283723306/elastic/kibana-flaky-test-suite-runner/kibana-build-xpack/node_modules/@kbn/fleet-plugin/server/services/epm/packages/install_state_machine/steps/step_save_knowledge_base.js:110:27)
[00:02:46]         │ proc [kibana]     at stepSaveKnowledgeBase (/opt/buildkite-agent/builds/bk-agent-prod-gcp-1765880237283723306/elastic/kibana-flaky-test-suite-runner/kibana-build-xpack/node_modules/@kbn/fleet-plugin/server/services/epm/packages/install_state_machine/steps/step_save_knowledge_base.js:98:10) {"service":{"node":{"roles":["background_tasks","ui"]}}}
```

There is also some flakyness with deleting ingest pipelines of old
package versions, so changed some asserts to check that expected assets
are in `installed_es` array, instead of exact equality.

```
 { id: 'logs-all_assets.test_logs-0.1.0',
       type: 'ingest_pipeline' },
     { id: 'logs-all_assets.test_logs-0.1.0-pipeline1',
       type: 'ingest_pipeline' },
     { id: 'logs-all_assets.test_logs-0.1.0-pipeline2',
       type: 'ingest_pipeline' },
```

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

(cherry picked from commit f128446)
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@nchaulet
Copy link
Copy Markdown
Member

@elasticmachine merge upstream

@kibanamachine kibanamachine merged commit 0afd97a into elastic:9.3 Dec 23, 2025
13 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @juliaElastic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR Team:Fleet Team label for Observability Data Collection Fleet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants