[Fleet] add retry to knowledge base api tests#246396
[Fleet] add retry to knowledge base api tests#246396juliaElastic merged 24 commits intoelastic:mainfrom
Conversation
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#10131[❌] x-pack/platform/test/fleet_api_integration/config.package_policy.ts: 2/25 tests passed. |
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#10132[❌] x-pack/platform/test/fleet_api_integration/config.epm.ts: 0/25 tests passed. |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#10135[✅] x-pack/platform/test/fleet_api_integration/config.package_policy.ts: 25/25 tests passed. |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#10137[✅] x-pack/platform/test/fleet_api_integration/config.epm.ts: 25/25 tests passed. |
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#10139[❌] x-pack/platform/test/fleet_api_integration/config.package_policy.ts: 1/25 tests passed. |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#10156[✅] x-pack/platform/test/fleet_api_integration/config.epm.ts: 25/25 tests passed. |
| .send({ force: true }); | ||
| }; | ||
|
|
||
| // Helper function to clean up knowledge base content |
There was a problem hiding this comment.
move the knowledge base tests to their own file
|
Pinging @elastic/fleet (Team:Fleet) |
💚 Build Succeeded
Metrics [docs]
History
|
|
Starting backport for target branches: 9.3 https://github.com/elastic/kibana/actions/runs/20372945373 |
|
Starting backport for target branches: 9.3 https://github.com/elastic/kibana/actions/runs/20372945371 |
## 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)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## 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)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
# Backport This will backport the following commits from `main` to `9.3`: - [[Fleet] add retry to knowledge base api tests (#246396)](#246396) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Julia Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-12-18T15:30:31Z","message":"[Fleet] add retry to knowledge base api tests (#246396)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/246383\nCloses https://github.com/elastic/kibana/issues/246204\nCloses https://github.com/elastic/kibana/issues/235915\nCloses https://github.com/elastic/kibana/issues/246213\nCloses https://github.com/elastic/kibana/issues/246183\nCloses https://github.com/elastic/kibana/issues/246272\n\nUse retry instead of wait for api tests to wait for knowledge_base docs\nwhen installing packages, as it is an async step.\nRelates https://github.com/elastic/kibana/pull/245080\n\nIt seems the knowledge base indexing is flaky, sometimes failing with\nerrors.\n\n```\n[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\"]}}}\n[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\"]}}}\n\n[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\n[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)\n[00:02:46] │ proc [kibana] at processTicksAndRejections (node:internal/process/task_queues:105:5)\n[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\n[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)\n[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)\n[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)\n[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)\n[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)\n[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)\n[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\"]}}}\n```\n\nThere is also some flakyness with deleting ingest pipelines of old\npackage versions, so changed some asserts to check that expected assets\nare in `installed_es` array, instead of exact equality.\n\n```\n { id: 'logs-all_assets.test_logs-0.1.0',\n type: 'ingest_pipeline' },\n { id: 'logs-all_assets.test_logs-0.1.0-pipeline1',\n type: 'ingest_pipeline' },\n { id: 'logs-all_assets.test_logs-0.1.0-pipeline2',\n type: 'ingest_pipeline' },\n```\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"f1284467fcb6ffcbb8699ecd118918ecf9c2a4b4","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:version","v9.3.0","v9.4.0"],"title":"[Fleet] add retry to knowledge base api tests","number":246396,"url":"https://github.com/elastic/kibana/pull/246396","mergeCommit":{"message":"[Fleet] add retry to knowledge base api tests (#246396)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/246383\nCloses https://github.com/elastic/kibana/issues/246204\nCloses https://github.com/elastic/kibana/issues/235915\nCloses https://github.com/elastic/kibana/issues/246213\nCloses https://github.com/elastic/kibana/issues/246183\nCloses https://github.com/elastic/kibana/issues/246272\n\nUse retry instead of wait for api tests to wait for knowledge_base docs\nwhen installing packages, as it is an async step.\nRelates https://github.com/elastic/kibana/pull/245080\n\nIt seems the knowledge base indexing is flaky, sometimes failing with\nerrors.\n\n```\n[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\"]}}}\n[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\"]}}}\n\n[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\n[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)\n[00:02:46] │ proc [kibana] at processTicksAndRejections (node:internal/process/task_queues:105:5)\n[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\n[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)\n[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)\n[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)\n[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)\n[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)\n[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)\n[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\"]}}}\n```\n\nThere is also some flakyness with deleting ingest pipelines of old\npackage versions, so changed some asserts to check that expected assets\nare in `installed_es` array, instead of exact equality.\n\n```\n { id: 'logs-all_assets.test_logs-0.1.0',\n type: 'ingest_pipeline' },\n { id: 'logs-all_assets.test_logs-0.1.0-pipeline1',\n type: 'ingest_pipeline' },\n { id: 'logs-all_assets.test_logs-0.1.0-pipeline2',\n type: 'ingest_pipeline' },\n```\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"f1284467fcb6ffcbb8699ecd118918ecf9c2a4b4"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/246396","number":246396,"mergeCommit":{"message":"[Fleet] add retry to knowledge base api tests (#246396)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/246383\nCloses https://github.com/elastic/kibana/issues/246204\nCloses https://github.com/elastic/kibana/issues/235915\nCloses https://github.com/elastic/kibana/issues/246213\nCloses https://github.com/elastic/kibana/issues/246183\nCloses https://github.com/elastic/kibana/issues/246272\n\nUse retry instead of wait for api tests to wait for knowledge_base docs\nwhen installing packages, as it is an async step.\nRelates https://github.com/elastic/kibana/pull/245080\n\nIt seems the knowledge base indexing is flaky, sometimes failing with\nerrors.\n\n```\n[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\"]}}}\n[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\"]}}}\n\n[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\n[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)\n[00:02:46] │ proc [kibana] at processTicksAndRejections (node:internal/process/task_queues:105:5)\n[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\n[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)\n[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)\n[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)\n[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)\n[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)\n[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)\n[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\"]}}}\n```\n\nThere is also some flakyness with deleting ingest pipelines of old\npackage versions, so changed some asserts to check that expected assets\nare in `installed_es` array, instead of exact equality.\n\n```\n { id: 'logs-all_assets.test_logs-0.1.0',\n type: 'ingest_pipeline' },\n { id: 'logs-all_assets.test_logs-0.1.0-pipeline1',\n type: 'ingest_pipeline' },\n { id: 'logs-all_assets.test_logs-0.1.0-pipeline2',\n type: 'ingest_pipeline' },\n```\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"f1284467fcb6ffcbb8699ecd118918ecf9c2a4b4"}}]}] BACKPORT--> Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Closes #246383
Closes #246204
Closes #235915
Closes #246213
Closes #246183
Closes #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 #245080
It seems the knowledge base indexing is flaky, sometimes failing with errors.
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_esarray, instead of exact equality.Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*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.