mirror of
https://github.com/elastic/kibana.git
synced 2025-06-29 03:24:45 -04:00
## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > * This PR has been auto-generated. > * Any manual contributions will be lost if the 'relocate' script is re-run. > * Try to obtain the missing reviews / approvals before applying manual fixes, and/or keep your changes in a .patch / git stash. > * Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. Are you trying to rebase this PR to solve merge conflicts? Please follow the steps describe [here](https://elastic.slack.com/archives/C07TCKTA22E/p1734019532879269?thread_ts=1734019339.935419&cid=C07TCKTA22E). #### 10 plugin(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/enterprise-search-plugin` | `x-pack/solutions/search/plugins/enterprise_search` | | `@kbn/search-assistant` | `x-pack/solutions/search/plugins/search_assistant` | | `@kbn/search-connectors-plugin` | `x-pack/solutions/search/plugins/search_connectors` | | `@kbn/search-homepage` | `x-pack/solutions/search/plugins/search_homepage` | | `@kbn/search-indices` | `x-pack/solutions/search/plugins/search_indices` | | `@kbn/search-inference-endpoints` | `x-pack/solutions/search/plugins/search_inference_endpoints` | | `@kbn/search-navigation` | `x-pack/solutions/search/plugins/search_solution/search_navigation` | | `@kbn/search-notebooks` | `x-pack/solutions/search/plugins/search_notebooks` | | `@kbn/search-playground` | `x-pack/solutions/search/plugins/search_playground` | | `@kbn/serverless-search` | `x-pack/solutions/search/plugins/serverless_search` | #### 11 packages(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/ai-assistant` | `x-pack/platform/packages/shared/kbn-ai-assistant` | | `@kbn/deeplinks-search` | `src/platform/packages/shared/deeplinks/search` | | `@kbn/ipynb` | `x-pack/solutions/search/packages/kbn-ipynb` | | `@kbn/search-api-keys-components` | `x-pack/solutions/search/packages/kbn-search-api-keys-components` | | `@kbn/search-api-keys-server` | `x-pack/solutions/search/packages/kbn-search-api-keys-server` | | `@kbn/search-api-panels` | `src/platform/packages/shared/kbn-search-api-panels` | | `@kbn/search-connectors` | `src/platform/packages/shared/kbn-search-connectors` | | `@kbn/search-index-documents` | `x-pack/solutions/search/packages/kbn-search-index-documents` | | `@kbn/search-shared-ui` | `x-pack/solutions/search/packages/search/shared_ui` | | `@kbn/serverless-search-settings` | `src/platform/packages/shared/serverless/settings/search_project` | | `@kbn/try-in-console` | `src/platform/packages/shared/kbn-try-in-console` | <details open> <summary>Script errors</summary> ``` Cannot replace multiple occurrences of "../.." in the same line, please fix manually: /Users/pgayvallet/DEV/workspaces/elastic/kibana/x-pack/solutions/search/plugins/enterprise_search/cypress.sh:17 Cannot replace multiple occurrences of "../.." in the same line, please fix manually: /Users/pgayvallet/DEV/workspaces/elastic/kibana/x-pack/solutions/search/plugins/enterprise_search/cypress.sh:19 ``` </details><details > <summary>Updated relative paths</summary> ``` src/platform/packages/shared/deeplinks/search/jest.config.js:12 src/platform/packages/shared/deeplinks/search/tsconfig.json:2 src/platform/packages/shared/deeplinks/search/tsconfig.type_check.json:2 src/platform/packages/shared/kbn-search-api-panels/jest.config.js:12 src/platform/packages/shared/kbn-search-api-panels/tsconfig.json:2 src/platform/packages/shared/kbn-search-api-panels/tsconfig.type_check.json:2 src/platform/packages/shared/kbn-search-api-panels/tsconfig.type_check.json:28 src/platform/packages/shared/kbn-search-api-panels/tsconfig.type_check.json:34 src/platform/packages/shared/kbn-search-api-panels/tsconfig.type_check.json:37 src/platform/packages/shared/kbn-search-connectors/jest.config.js:12 src/platform/packages/shared/kbn-search-connectors/tsconfig.json:2 src/platform/packages/shared/kbn-search-connectors/tsconfig.type_check.json:2 src/platform/packages/shared/kbn-search-connectors/tsconfig.type_check.json:27 src/platform/packages/shared/kbn-try-in-console/jest.config.js:12 src/platform/packages/shared/kbn-try-in-console/tsconfig.json:2 src/platform/packages/shared/kbn-try-in-console/tsconfig.type_check.json:2 src/platform/packages/shared/kbn-try-in-console/tsconfig.type_check.json:29 src/platform/packages/shared/kbn-try-in-console/tsconfig.type_check.json:32 src/platform/packages/shared/serverless/settings/search_project/tsconfig.json:2 src/platform/packages/shared/serverless/settings/search_project/tsconfig.type_check.json:2 src/platform/packages/shared/serverless/settings/search_project/tsconfig.type_check.json:20 src/platform/packages/shared/serverless/settings/search_project/tsconfig.type_check.json:23 x-pack/platform/packages/shared/kbn-ai-assistant/.storybook/main.ts:14 x-pack/platform/packages/shared/kbn-ai-assistant/jest.config.js:16 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.json:2 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:2 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:23 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:26 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:29 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:32 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:35 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:38 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:41 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:44 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:47 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:50 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:53 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:56 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:59 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:62 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:65 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:68 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:71 x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.type_check.json:74 x-pack/solutions/search/packages/kbn-ipynb/jest.config.js:12 x-pack/solutions/search/packages/kbn-ipynb/tsconfig.json:2 x-pack/solutions/search/packages/kbn-ipynb/tsconfig.type_check.json:2 x-pack/solutions/search/packages/kbn-search-api-keys-components/jest.config.js:12 x-pack/solutions/search/packages/kbn-search-api-keys-components/tsconfig.json:2 x-pack/solutions/search/packages/kbn-search-api-keys-components/tsconfig.type_check.json:2 x-pack/solutions/search/packages/kbn-search-api-keys-components/tsconfig.type_check.json:23 x-pack/solutions/search/packages/kbn-search-api-keys-components/tsconfig.type_check.json:26 x-pack/solutions/search/packages/kbn-search-api-keys-components/tsconfig.type_check.json:29 x-pack/solutions/search/packages/kbn-search-api-keys-server/jest.config.js:12 x-pack/solutions/search/packages/kbn-search-api-keys-server/tsconfig.json:2 x-pack/solutions/search/packages/kbn-search-api-keys-server/tsconfig.type_check.json:2 x-pack/solutions/search/packages/kbn-search-api-keys-server/tsconfig.type_check.json:24 x-pack/solutions/search/packages/kbn-search-index-documents/README.md:11 x-pack/solutions/search/packages/kbn-search-index-documents/jest.config.js:12 x-pack/solutions/search/packages/kbn-search-index-documents/tsconfig.json:2 x-pack/solutions/search/packages/kbn-search-index-documents/tsconfig.type_check.json:2 x-pack/solutions/search/packages/kbn-search-index-documents/tsconfig.type_check.json:31 x-pack/solutions/search/packages/search/shared_ui/jest.config.js:13 x-pack/solutions/search/packages/search/shared_ui/tsconfig.json:2 x-pack/solutions/search/packages/search/shared_ui/tsconfig.type_check.json:2 x-pack/solutions/search/packages/search/shared_ui/tsconfig.type_check.json:23 x-pack/solutions/search/plugins/enterprise_search/README.md:138 x-pack/solutions/search/plugins/enterprise_search/README.md:140 x-pack/solutions/search/plugins/enterprise_search/common/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/cypress.config.js:20 x-pack/solutions/search/plugins/enterprise_search/cypress.config.js:23 x-pack/solutions/search/plugins/enterprise_search/cypress.config.ts:20 x-pack/solutions/search/plugins/enterprise_search/cypress.config.ts:23 x-pack/solutions/search/plugins/enterprise_search/cypress.sh:17 x-pack/solutions/search/plugins/enterprise_search/cypress.sh:19 x-pack/solutions/search/plugins/enterprise_search/cypress.sh:8 x-pack/solutions/search/plugins/enterprise_search/cypress/tsconfig.json:2 x-pack/solutions/search/plugins/enterprise_search/cypress/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/enterprise_search/cypress/tsconfig.type_check.json:22 x-pack/solutions/search/plugins/enterprise_search/jest.config.dev.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/ai_search/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/analytics/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/app_search/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/applications/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/elasticsearch/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_overview/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/search_experiences/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/semantic_search/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/shared/cypress/tsconfig.json:2 x-pack/solutions/search/plugins/enterprise_search/public/applications/shared/cypress/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/enterprise_search/public/applications/shared/cypress/tsconfig.type_check.json:21 x-pack/solutions/search/plugins/enterprise_search/public/applications/shared/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/vector_search/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/applications/workplace_search/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/public/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/server/jest.config.js:10 x-pack/solutions/search/plugins/enterprise_search/tsconfig.json:2 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:100 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:103 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:106 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:109 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:112 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:115 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:118 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:121 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:124 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:127 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:130 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:133 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:136 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:139 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:142 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:148 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:151 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:154 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:157 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:163 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:166 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:169 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:172 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:175 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:178 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:181 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:19 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:193 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:196 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:199 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:202 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:205 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:208 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:211 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:214 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:217 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:22 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:220 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:223 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:226 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:229 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:25 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:28 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:31 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:34 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:55 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:61 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:64 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:67 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:70 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:73 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:76 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:79 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:82 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:85 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:88 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:91 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:94 x-pack/solutions/search/plugins/enterprise_search/tsconfig.type_check.json:97 x-pack/solutions/search/plugins/search_assistant/tsconfig.json:12 x-pack/solutions/search/plugins/search_assistant/tsconfig.json:2 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:14 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:21 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:24 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:27 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:30 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:36 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:39 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:42 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:48 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:51 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:54 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:57 x-pack/solutions/search/plugins/search_assistant/tsconfig.type_check.json:66 x-pack/solutions/search/plugins/search_connectors/jest.config.js:10 x-pack/solutions/search/plugins/search_connectors/package.json:8 x-pack/solutions/search/plugins/search_connectors/package.json:9 x-pack/solutions/search/plugins/search_connectors/tsconfig.json:12 x-pack/solutions/search/plugins/search_connectors/tsconfig.json:2 x-pack/solutions/search/plugins/search_connectors/tsconfig.type_check.json:14 x-pack/solutions/search/plugins/search_connectors/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/search_connectors/tsconfig.type_check.json:21 x-pack/solutions/search/plugins/search_connectors/tsconfig.type_check.json:24 x-pack/solutions/search/plugins/search_connectors/tsconfig.type_check.json:27 x-pack/solutions/search/plugins/search_connectors/tsconfig.type_check.json:30 x-pack/solutions/search/plugins/search_homepage/jest.config.js:10 x-pack/solutions/search/plugins/search_homepage/tsconfig.json:2 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:19 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:22 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:25 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:28 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:31 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:34 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:37 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:40 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:43 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:46 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:49 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:52 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:55 x-pack/solutions/search/plugins/search_homepage/tsconfig.type_check.json:58 x-pack/solutions/search/plugins/search_indices/jest.config.js:10 x-pack/solutions/search/plugins/search_indices/tsconfig.json:11 x-pack/solutions/search/plugins/search_indices/tsconfig.json:2 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:101 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:13 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:20 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:23 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:26 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:29 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:32 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:35 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:38 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:41 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:44 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:47 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:50 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:53 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:56 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:59 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:62 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:65 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:68 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:71 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:74 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:77 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:83 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:86 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:89 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:92 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:95 x-pack/solutions/search/plugins/search_indices/tsconfig.type_check.json:98 x-pack/solutions/search/plugins/search_inference_endpoints/jest.config.js:10 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.json:2 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:19 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:22 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:25 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:28 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:31 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:34 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:40 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:43 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:46 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:49 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:55 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:58 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:61 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:64 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:67 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:70 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:73 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:76 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:82 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:85 x-pack/solutions/search/plugins/search_inference_endpoints/tsconfig.type_check.json:88 x-pack/solutions/search/plugins/search_notebooks/jest.config.js:10 x-pack/solutions/search/plugins/search_notebooks/package.json:8 x-pack/solutions/search/plugins/search_notebooks/package.json:9 x-pack/solutions/search/plugins/search_notebooks/tsconfig.json:12 x-pack/solutions/search/plugins/search_notebooks/tsconfig.json:2 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:14 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:21 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:24 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:27 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:30 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:33 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:36 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:39 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:42 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:45 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:48 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:51 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:54 x-pack/solutions/search/plugins/search_notebooks/tsconfig.type_check.json:57 x-pack/solutions/search/plugins/search_playground/jest.config.js:10 x-pack/solutions/search/plugins/search_playground/tsconfig.json:2 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:100 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:103 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:106 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:109 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:112 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:115 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:118 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:121 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:124 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:19 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:22 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:25 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:28 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:31 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:34 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:37 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:43 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:46 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:49 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:52 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:55 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:58 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:67 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:70 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:82 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:85 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:88 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:91 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:94 x-pack/solutions/search/plugins/search_playground/tsconfig.type_check.json:97 x-pack/solutions/search/plugins/search_solution/search_navigation/jest.config.js:10 x-pack/solutions/search/plugins/search_solution/search_navigation/tsconfig.json:2 x-pack/solutions/search/plugins/serverless_search/jest.config.js:10 x-pack/solutions/search/plugins/serverless_search/package.json:8 x-pack/solutions/search/plugins/serverless_search/package.json:9 x-pack/solutions/search/plugins/serverless_search/tsconfig.json:12 x-pack/solutions/search/plugins/serverless_search/tsconfig.json:2 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:102 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:105 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:111 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:114 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:120 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:126 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:132 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:135 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:138 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:14 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:2 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:21 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:24 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:27 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:30 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:33 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:36 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:39 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:51 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:54 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:57 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:60 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:63 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:66 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:69 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:72 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:75 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:78 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:81 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:84 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:90 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:93 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:96 x-pack/solutions/search/plugins/serverless_search/tsconfig.type_check.json:99 ``` </details> --------- Co-authored-by: pgayvallet <pierre.gayvallet@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
421 lines
16 KiB
TypeScript
421 lines
16 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import expect from '@kbn/expect';
|
|
import moment from 'moment';
|
|
import type SuperTest from 'supertest';
|
|
import deepmerge from 'deepmerge';
|
|
|
|
import ossRootTelemetrySchema from '@kbn/telemetry-plugin/schema/oss_root.json';
|
|
import xpackRootTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_root.json';
|
|
import monitoringRootTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_monitoring.json';
|
|
import ossPluginsTelemetrySchema from '@kbn/telemetry-plugin/schema/oss_plugins.json';
|
|
import ossPlatformTelemetrySchema from '@kbn/telemetry-plugin/schema/oss_platform.json';
|
|
import ossPackagesTelemetrySchema from '@kbn/telemetry-plugin/schema/kbn_packages.json';
|
|
import xpackPluginsTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_plugins.json';
|
|
import xpackPlatformTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_platform.json';
|
|
import xpackObservabilityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_observability.json';
|
|
import xpackSearchTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_search.json';
|
|
import xpackSecurityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_security.json';
|
|
import type { UnencryptedTelemetryPayload } from '@kbn/telemetry-plugin/common/types';
|
|
import type {
|
|
UsageStatsPayload,
|
|
CacheDetails,
|
|
} from '@kbn/telemetry-collection-manager-plugin/server/types';
|
|
import { assertTelemetryPayload } from '@kbn/telemetry-tools';
|
|
import type { TelemetrySchemaObject } from '@kbn/telemetry-tools/src/schema_ftr_validations/schema_to_config_schema';
|
|
import {
|
|
ELASTIC_HTTP_VERSION_HEADER,
|
|
X_ELASTIC_INTERNAL_ORIGIN_REQUEST,
|
|
} from '@kbn/core-http-common';
|
|
import type { SecurityService } from '@kbn/ftr-common-functional-ui-services';
|
|
import basicClusterFixture from './fixtures/basiccluster.json';
|
|
import multiClusterFixture from './fixtures/multicluster.json';
|
|
import type { FtrProviderContext } from '../../ftr_provider_context';
|
|
|
|
function omitCacheDetails(usagePayload: Array<Record<string, unknown>>) {
|
|
return usagePayload.map(({ cacheDetails, ...item }) => item);
|
|
}
|
|
|
|
function updateFixtureTimestamps(fixture: Array<Record<string, unknown>>, timestamp: string) {
|
|
return fixture.map((item) => ({ ...item, timestamp }));
|
|
}
|
|
|
|
function getCacheDetails(body: UnencryptedTelemetryPayload): CacheDetails[] {
|
|
return body.map(({ stats }) => (stats as UsageStatsPayload).cacheDetails);
|
|
}
|
|
|
|
function updateClusterUuidInLogstashStats(
|
|
clusterUuid: string,
|
|
payload: Array<Record<string, any>>
|
|
) {
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
return payload.map(({ stack_stats, ...item }) => {
|
|
const { logstash } = stack_stats;
|
|
if (logstash) {
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
const { cluster_stats } = logstash;
|
|
cluster_stats.monitoringClusterUuid = clusterUuid;
|
|
}
|
|
return { stack_stats, ...item };
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Update the .monitoring-* documents loaded via the archiver to the recent `timestamp`
|
|
* @param esSupertest The client to send requests to ES
|
|
* @param fromTimestamp The lower timestamp limit to query the documents from
|
|
* @param toTimestamp The upper timestamp limit to query the documents from
|
|
* @param timestamp The new timestamp to be set
|
|
*/
|
|
function updateMonitoringDates(
|
|
esSupertest: SuperTest.Agent,
|
|
fromTimestamp: string,
|
|
toTimestamp: string,
|
|
timestamp: string
|
|
) {
|
|
return esSupertest
|
|
.post('/.monitoring-*/_update_by_query?refresh=true')
|
|
.send({
|
|
query: {
|
|
range: {
|
|
timestamp: {
|
|
format: 'epoch_millis',
|
|
gte: moment(fromTimestamp).valueOf(),
|
|
lte: moment(toTimestamp).valueOf(),
|
|
},
|
|
},
|
|
},
|
|
script: {
|
|
source: `ctx._source.timestamp='${timestamp}'`,
|
|
lang: 'painless',
|
|
},
|
|
})
|
|
.expect(200);
|
|
}
|
|
|
|
async function createUserWithRole(
|
|
security: SecurityService,
|
|
userName: string,
|
|
roleName: string,
|
|
role: unknown
|
|
) {
|
|
await security.role.create(roleName, role);
|
|
|
|
await security.user.create(userName, {
|
|
password: password(userName),
|
|
roles: [roleName],
|
|
full_name: `User ${userName}`,
|
|
});
|
|
}
|
|
|
|
function password(userName: string) {
|
|
return `${userName}-password`;
|
|
}
|
|
|
|
export default function ({ getService }: FtrProviderContext) {
|
|
const supertest = getService('supertest');
|
|
const supertestWithoutAuth = getService('supertestWithoutAuth'); // We need this because `.auth` in the already authed one does not work as expected
|
|
const esArchiver = getService('esArchiver');
|
|
const esSupertest = getService('esSupertest');
|
|
const security = getService('security');
|
|
|
|
describe('/internal/telemetry/clusters/_stats', () => {
|
|
const timestamp = new Date().toISOString();
|
|
describe('monitoring/multicluster', () => {
|
|
let localXPack: Record<string, unknown>;
|
|
let monitoring: Array<Record<string, unknown>>;
|
|
|
|
const archive = 'x-pack/test/functional/es_archives/monitoring/multicluster';
|
|
const fromTimestamp = '2017-08-15T21:00:00.000Z';
|
|
const toTimestamp = '2017-08-16T00:00:00.000Z';
|
|
|
|
before(async () => {
|
|
await esArchiver.load(archive, {
|
|
performance: {
|
|
batchSize: 300,
|
|
concurrency: 1,
|
|
},
|
|
});
|
|
await updateMonitoringDates(esSupertest, fromTimestamp, toTimestamp, timestamp);
|
|
|
|
const { body }: { body: UnencryptedTelemetryPayload } = await supertest
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: true, refreshCache: true })
|
|
.expect(200);
|
|
|
|
expect(body.length).to.be.greaterThan(1);
|
|
const telemetryStats = body.map(({ stats }) => stats);
|
|
localXPack = telemetryStats.shift() as Record<string, unknown>;
|
|
monitoring = telemetryStats as Array<Record<string, unknown>>;
|
|
});
|
|
after(() => esArchiver.unload(archive));
|
|
|
|
it('should pass the schema validations', () => {
|
|
const root = deepmerge(ossRootTelemetrySchema, xpackRootTelemetrySchema);
|
|
|
|
// Merging root to monitoring because `kibana` may be passed in some cases for old collection methods reporting to a newer monitoring cluster
|
|
const monitoringRoot = deepmerge(
|
|
root,
|
|
// It's nested because of the way it's collected and declared
|
|
monitoringRootTelemetrySchema.properties.monitoringTelemetry.properties.stats.items
|
|
);
|
|
|
|
const schemas = [
|
|
ossPluginsTelemetrySchema,
|
|
ossPackagesTelemetrySchema,
|
|
ossPlatformTelemetrySchema,
|
|
xpackPluginsTelemetrySchema,
|
|
xpackPlatformTelemetrySchema,
|
|
xpackObservabilityTelemetrySchema,
|
|
xpackSearchTelemetrySchema,
|
|
xpackSecurityTelemetrySchema,
|
|
] as TelemetrySchemaObject[];
|
|
const plugins = schemas.reduce((acc, schema) => deepmerge(acc, schema));
|
|
|
|
try {
|
|
assertTelemetryPayload({ root, plugins }, localXPack);
|
|
monitoring.forEach((stats) => {
|
|
assertTelemetryPayload({ root: monitoringRoot, plugins }, stats);
|
|
});
|
|
} catch (err) {
|
|
err.message = `The telemetry schemas in are out-of-date. Please define the schema of your collector and run "node scripts/telemetry_check --fix" to update them: ${err.message}`;
|
|
throw err;
|
|
}
|
|
});
|
|
|
|
it('should load multiple trial-license clusters', async () => {
|
|
expect(monitoring).length(3);
|
|
expect(localXPack.collectionSource).to.eql('local_xpack');
|
|
|
|
const withoutCacheDetailsMonitoring = omitCacheDetails(monitoring);
|
|
const lsClusterUuidChangedMonitoring = updateClusterUuidInLogstashStats(
|
|
'integrationTestClusterUuid',
|
|
withoutCacheDetailsMonitoring
|
|
);
|
|
expect(lsClusterUuidChangedMonitoring).to.eql(
|
|
updateFixtureTimestamps(multiClusterFixture, timestamp)
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('with basic cluster and reporting and canvas usage info', () => {
|
|
const archive = 'x-pack/test/functional/es_archives/monitoring/basic_6.3.x';
|
|
const fromTimestamp = '2018-07-23T22:54:59.087Z';
|
|
const toTimestamp = '2018-07-23T22:55:05.933Z';
|
|
before(async () => {
|
|
await esArchiver.load(archive);
|
|
await updateMonitoringDates(esSupertest, fromTimestamp, toTimestamp, timestamp);
|
|
});
|
|
after(() => esArchiver.unload(archive));
|
|
it('should load non-expiring basic cluster', async () => {
|
|
const { body }: { body: UnencryptedTelemetryPayload } = await supertest
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: true, refreshCache: true })
|
|
.expect(200);
|
|
|
|
expect(body).length(2);
|
|
const telemetryStats = body.map(({ stats }) => stats);
|
|
|
|
const [localXPack, ...monitoring] = telemetryStats as Array<Record<string, unknown>>;
|
|
expect(localXPack.collectionSource).to.eql('local_xpack');
|
|
expect(omitCacheDetails(monitoring)).to.eql(
|
|
updateFixtureTimestamps(basicClusterFixture, timestamp)
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('Telemetry caching', () => {
|
|
const archive = 'x-pack/test/functional/es_archives/monitoring/basic_6.3.x';
|
|
const fromTimestamp = '2018-07-23T22:54:59.087Z';
|
|
const toTimestamp = '2018-07-23T22:55:05.933Z';
|
|
|
|
before(async () => {
|
|
await esArchiver.load(archive);
|
|
await updateMonitoringDates(esSupertest, fromTimestamp, toTimestamp, timestamp);
|
|
// hit the endpoint to cache results
|
|
await supertest
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: true, refreshCache: true })
|
|
.expect(200);
|
|
});
|
|
after(() => esArchiver.unload(archive));
|
|
});
|
|
|
|
it('returns non-cached results when unencrypted', async () => {
|
|
const now = Date.now();
|
|
const { body }: { body: UnencryptedTelemetryPayload } = await supertest
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: true })
|
|
.expect(200);
|
|
|
|
expect(body).length(1);
|
|
|
|
const cacheDetails = getCacheDetails(body);
|
|
cacheDetails.forEach(({ fetchedAt, updatedAt }) => {
|
|
// Check that the cache is fresh by comparing updatedAt timestamp with
|
|
// the timestamp the data was fetched.
|
|
expect(new Date(updatedAt).getTime()).to.be.greaterThan(now);
|
|
// Check that the fetchedAt timestamp is updated when the data is fetched
|
|
expect(new Date(fetchedAt).getTime()).to.be.greaterThan(now);
|
|
});
|
|
});
|
|
|
|
it('grabs a fresh copy on refresh', async () => {
|
|
const now = Date.now();
|
|
const { body }: { body: UnencryptedTelemetryPayload } = await supertest
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: true, refreshCache: true })
|
|
.expect(200);
|
|
|
|
expect(body).length(1);
|
|
getCacheDetails(body).forEach(({ updatedAt, fetchedAt }) => {
|
|
// Check that the cache is fresh by comparing updatedAt timestamp with
|
|
// the timestamp the data was fetched.
|
|
expect(new Date(updatedAt).getTime()).to.be.greaterThan(now);
|
|
// Check that the fetchedAt timestamp is updated when the data is fetched
|
|
expect(new Date(fetchedAt).getTime()).to.be.greaterThan(now);
|
|
});
|
|
});
|
|
|
|
describe('Only global read+ users can fetch unencrypted telemetry', () => {
|
|
describe('superadmin user', () => {
|
|
it('should return unencrypted telemetry for the admin user', async () => {
|
|
await supertest
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: true })
|
|
.expect(200);
|
|
});
|
|
|
|
it('should return encrypted telemetry for the admin user', async () => {
|
|
await supertest
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: false })
|
|
.expect(200);
|
|
});
|
|
});
|
|
|
|
describe('global-read user', () => {
|
|
const globalReadOnlyUser = 'telemetry-global-read-only-user';
|
|
const globalReadOnlyRole = 'telemetry-global-read-only-role';
|
|
|
|
before('create user', async () => {
|
|
await createUserWithRole(security, globalReadOnlyUser, globalReadOnlyRole, {
|
|
kibana: [
|
|
{
|
|
spaces: ['*'],
|
|
base: ['read'],
|
|
feature: {},
|
|
},
|
|
],
|
|
});
|
|
});
|
|
|
|
after(async () => {
|
|
await security.user.delete(globalReadOnlyUser);
|
|
await security.role.delete(globalReadOnlyRole);
|
|
});
|
|
|
|
it('should return encrypted telemetry for the global-read user', async () => {
|
|
await supertestWithoutAuth
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.auth(globalReadOnlyUser, password(globalReadOnlyUser))
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: false })
|
|
.expect(200);
|
|
});
|
|
|
|
it('should return unencrypted telemetry for the global-read user', async () => {
|
|
await supertestWithoutAuth
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.auth(globalReadOnlyUser, password(globalReadOnlyUser))
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: true })
|
|
.expect(200);
|
|
});
|
|
});
|
|
|
|
describe('non global-read user', () => {
|
|
const noGlobalUser = 'telemetry-no-global-user';
|
|
const noGlobalRole = 'telemetry-no-global-role';
|
|
|
|
before('create user', async () => {
|
|
await createUserWithRole(security, noGlobalUser, noGlobalRole, {
|
|
kibana: [
|
|
{
|
|
spaces: ['*'],
|
|
base: [],
|
|
feature: {
|
|
// It has access to many features specified individually but not a global one
|
|
discover: ['all'],
|
|
dashboard: ['all'],
|
|
canvas: ['all'],
|
|
maps: ['all'],
|
|
ml: ['all'],
|
|
visualize: ['all'],
|
|
dev_tools: ['all'],
|
|
},
|
|
},
|
|
],
|
|
});
|
|
});
|
|
|
|
after(async () => {
|
|
await security.user.delete(noGlobalUser);
|
|
await security.role.delete(noGlobalRole);
|
|
});
|
|
|
|
it('should return encrypted telemetry for the read-only user', async () => {
|
|
await supertestWithoutAuth
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.auth(noGlobalUser, password(noGlobalUser))
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: false })
|
|
.expect(200);
|
|
});
|
|
|
|
it('should return 403 when the read-only user requests unencrypted telemetry', async () => {
|
|
await supertestWithoutAuth
|
|
.post('/internal/telemetry/clusters/_stats')
|
|
.auth(noGlobalUser, password(noGlobalUser))
|
|
.set('kbn-xsrf', 'xxx')
|
|
.set(ELASTIC_HTTP_VERSION_HEADER, '2')
|
|
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
|
.send({ unencrypted: true })
|
|
.expect(403);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|