diff --git a/.buildkite/ftr_base_serverless_configs.yml b/.buildkite/ftr_base_serverless_configs.yml index 7e036096910f1..75b85e44121e9 100644 --- a/.buildkite/ftr_base_serverless_configs.yml +++ b/.buildkite/ftr_base_serverless_configs.yml @@ -8,6 +8,8 @@ disabled: - x-pack/test_serverless/api_integration/config.base.ts - x-pack/test_serverless/functional/config.base.ts - x-pack/test_serverless/shared/config.base.ts + - x-pack/platform/test/serverless/shared/config.base.ts + - x-pack/platform/test/serverless/api_integration/config.base.ts enabled: # Serverless deployment-agnostic configs to run platform api-integration tests diff --git a/.buildkite/ftr_chat_serverless_configs.yml b/.buildkite/ftr_chat_serverless_configs.yml index 3790d52fe6607..4189af6b55134 100644 --- a/.buildkite/ftr_chat_serverless_configs.yml +++ b/.buildkite/ftr_chat_serverless_configs.yml @@ -4,7 +4,7 @@ disabled: # Serverless tests only run on main - x-pack/test_serverless/api_integration/test_suites/chat/config.ts - x-pack/test_serverless/api_integration/test_suites/chat/config.feature_flags.ts - - x-pack/test_serverless/api_integration/test_suites/chat/common_configs/config.group1.ts + - x-pack/platform/test/serverless/api_integration/configs/chat/config.group1.ts - x-pack/test_serverless/functional/test_suites/chat/config.ts - x-pack/test_serverless/functional/test_suites/chat/config.feature_flags.ts - x-pack/test_serverless/functional/test_suites/chat/common_configs/config.config_compat_mode.ts diff --git a/.buildkite/ftr_oblt_serverless_configs.yml b/.buildkite/ftr_oblt_serverless_configs.yml index e4231e7863adb..1739578556e44 100644 --- a/.buildkite/ftr_oblt_serverless_configs.yml +++ b/.buildkite/ftr_oblt_serverless_configs.yml @@ -9,8 +9,8 @@ disabled: - x-pack/test_serverless/api_integration/test_suites/observability/config.ts - x-pack/test_serverless/api_integration/test_suites/observability/config.logs_essentials.ts - x-pack/test_serverless/api_integration/test_suites/observability/config.feature_flags.ts - - x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.group1.ts - - x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.logs_essentials.group1.ts + - x-pack/platform/test/serverless/api_integration/configs/observability/config.group1.ts + - x-pack/platform/test/serverless/api_integration/configs/observability/config.logs_essentials.group1.ts - x-pack/test_serverless/api_integration/test_suites/observability/fleet/config.ts - x-pack/test_serverless/functional/test_suites/observability/config.ts - x-pack/test_serverless/functional/test_suites/observability/config.logs_essentials.ts diff --git a/.buildkite/ftr_search_serverless_configs.yml b/.buildkite/ftr_search_serverless_configs.yml index fe3bb2e6ad89e..c82064d81d246 100644 --- a/.buildkite/ftr_search_serverless_configs.yml +++ b/.buildkite/ftr_search_serverless_configs.yml @@ -3,7 +3,7 @@ disabled: - x-pack/test_serverless/api_integration/test_suites/search/config.ts - x-pack/test_serverless/api_integration/test_suites/search/config.feature_flags.ts - - x-pack/test_serverless/api_integration/test_suites/search/common_configs/config.group1.ts + - x-pack/platform/test/serverless/api_integration/configs/search/config.group1.ts - x-pack/test_serverless/functional/test_suites/search/config.ts - x-pack/test_serverless/functional/test_suites/search/config.examples.ts - x-pack/test_serverless/functional/test_suites/search/config.feature_flags.ts diff --git a/.buildkite/ftr_security_serverless_configs.yml b/.buildkite/ftr_security_serverless_configs.yml index 4fac2c698bbd0..760a84d4ee134 100644 --- a/.buildkite/ftr_security_serverless_configs.yml +++ b/.buildkite/ftr_security_serverless_configs.yml @@ -21,7 +21,7 @@ disabled: - x-pack/test_serverless/api_integration/test_suites/security/config.ts - x-pack/test_serverless/api_integration/test_suites/security/config.feature_flags.ts - - x-pack/test_serverless/api_integration/test_suites/security/common_configs/config.group1.ts + - x-pack/platform/test/serverless/api_integration/configs/security/config.group1.ts - x-pack/test_serverless/api_integration/test_suites/security/fleet/config.ts - x-pack/test_serverless/functional/test_suites/security/config.screenshots.ts - x-pack/test_serverless/functional/test_suites/security/config.ts diff --git a/.eslintrc.js b/.eslintrc.js index 62d79ae5b57f1..c09738c5c21c1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -791,6 +791,9 @@ module.exports = { 'x-pack/test/performance/**/*.ts', '**/cypress.config.{js,ts}', 'x-pack/test_serverless/**/config*.ts', + 'x-pack/platform/test/serverless/shared/config*.ts', + 'x-pack/platform/test/serverless/*/test_suites/**/*', + 'x-pack/platform/test/serverless/*/configs/**/*', 'x-pack/test_serverless/*/test_suites/**/*', 'x-pack/test/profiling_api_integration/**/*.ts', 'x-pack/test/security_solution_api_integration/*/test_suites/**/*', diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8897cfd518604..1d9e8fd6b4999 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1135,7 +1135,7 @@ x-pack/test_serverless # used for the 'team' designator within Kibana Stats /x-pack/solutions/observability/test/api_integration/apis/metrics_ui @elastic/obs-ux-infra_services-team -x-pack/test_serverless/api_integration/test_suites/common/platform_security @elastic/kibana-security +x-pack/platform/test/serverless/api_integration/test_suites/platform_security @elastic/kibana-security # Observability Entities Team (@elastic/obs-entities) /x-pack/plugins/observability_solution/entities_data_access @elastic/obs-entities @@ -1211,12 +1211,12 @@ x-pack/test_serverless/api_integration/test_suites/common/platform_security @ela /x-pack/platform/test/stack_functional_integration/apps/ccs/ccs_discover.js @elastic/kibana-data-discovery /x-pack/platform/test/stack_functional_integration/apps/management/_index_pattern_create.js @elastic/kibana-data-discovery /x-pack/platform/test/upgrade/apps/discover @elastic/kibana-data-discovery -/x-pack/test_serverless/api_integration/test_suites/common/data_views @elastic/kibana-data-discovery -/x-pack/test_serverless/api_integration/test_suites/common/data_view_field_editor @elastic/kibana-data-discovery -/x-pack/test_serverless/api_integration/test_suites/common/kql_telemetry @elastic/kibana-data-discovery -/x-pack/test_serverless/api_integration/test_suites/common/scripts_tests @elastic/kibana-data-discovery -/x-pack/test_serverless/api_integration/test_suites/common/search_oss @elastic/kibana-data-discovery -/x-pack/test_serverless/api_integration/test_suites/common/search_xpack @elastic/kibana-data-discovery +/x-pack/platform/test/serverless/api_integration/test_suites/data_views @elastic/kibana-data-discovery +/x-pack/platform/test/serverless/api_integration/test_suites/data_view_field_editor @elastic/kibana-data-discovery +/x-pack/platform/test/serverless/api_integration/test_suites/kql_telemetry @elastic/kibana-data-discovery +/x-pack/platform/test/serverless/api_integration/test_suites/scripts_tests @elastic/kibana-data-discovery +/x-pack/platform/test/serverless/api_integration/test_suites/search_oss @elastic/kibana-data-discovery +/x-pack/platform/test/serverless/api_integration/test_suites/search_xpack @elastic/kibana-data-discovery /x-pack/test_serverless/functional/test_suites/common/context @elastic/kibana-data-discovery /x-pack/test_serverless/functional/test_suites/common/discover @elastic/kibana-data-discovery /x-pack/test_serverless/functional/test_suites/common/discover_ml_uptime/discover @elastic/kibana-data-discovery @@ -1315,6 +1315,7 @@ x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions /docs/settings/reporting-settings.asciidoc @elastic/response-ops /docs/setup/configuring-reporting.asciidoc @elastic/response-ops /x-pack/test_serverless/**/test_suites/common/reporting/ @elastic/response-ops +/x-pack/platform/test/serverless/**/test_suites/reporting/ @elastic/response-ops /x-pack/platform/test/accessibility/apps/group3/reporting.ts @elastic/response-ops /x-pack/platform/test/functional/page_objects/reporting_page.ts @elastic/response-ops /x-pack/platform/test/upgrade/apps/reporting @elastic/response-ops @@ -1364,7 +1365,7 @@ x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions ### Observability Plugins # Observability AI Assistant -/x-pack/test_serverless/api_integration/test_suites/common/data_usage @elastic/kibana-management +/x-pack/platform/test/serverless/api_integration/test_suites/data_usage @elastic/kibana-management /x-pack/test_serverless/functional/test_suites/common/data_usage @elastic/kibana-management /x-pack/test_serverless/functional/page_objects/svl_data_usage.ts @elastic/kibana-management /x-pack/solutions/observability/test/observability_ai_assistant_functional @elastic/obs-ai-assistant @@ -1530,6 +1531,8 @@ x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions /src/dev/build/tasks/bundle_fleet_packages.ts @elastic/fleet @elastic/kibana-operations /x-pack/platform/plugins/shared/fleet/server/services/elastic_agent_manifest.ts @elastic/fleet @elastic/obs-cloudnative-monitoring /x-pack/test_serverless/**/test_suites/**/fleet/ @elastic/fleet +/x-pack/platform/test/serverless/**/test_suites/fleet/ @elastic/fleet +/x-pack/platform/test/serverless/api_integration/services/default_fleet_setup.ts @elastic/fleet # APM /x-pack/test/common/services/apm_synthtrace_kibana_client.ts @elastic/obs-ux-infra_services-team @elastic/obs-ux-logs-team @@ -1892,7 +1895,7 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/test_serverless/functional/page_objects/svl_common_page.ts @elastic/appex-qa /x-pack/test_serverless/README.md @elastic/appex-qa /x-pack/test_serverless/api_integration/ftr_provider_context.d.ts @elastic/appex-qa -/x-pack/test_serverless/api_integration/test_suites/common/README.md @elastic/appex-qa +/x-pack/platform/test/serverless/api_integration/test_suites/README.md @elastic/appex-qa /src/dev/code_coverage @elastic/appex-qa /src/platform/test/functional/services/common @elastic/appex-qa /src/platform/test/functional/services/lib @elastic/appex-qa @@ -1904,7 +1907,7 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/test_serverless/**/deployment_agnostic_services.ts @elastic/appex-qa /x-pack/test_serverless/shared/ @elastic/appex-qa /x-pack/test_serverless/**/test_suites/**/common_configs/ @elastic/appex-qa -/x-pack/test_serverless/api_integration/test_suites/common/elasticsearch_api @elastic/appex-qa +/x-pack/platform/test/serverless/api_integration/test_suites/elasticsearch_api @elastic/appex-qa /x-pack/test_serverless/functional/test_suites/security/ftr/ @elastic/appex-qa /x-pack/test_serverless/functional/test_suites/common/home_page/ @elastic/appex-qa /x-pack/test_serverless/**/services/ @elastic/appex-qa @@ -1924,8 +1927,7 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/solutions/security/test/api_integration/ftr_provider_context.d.ts @elastic/appex-qa /x-pack/solutions/security/test/api_integration/services/index.ts @elastic/appex-qa /x-pack/solutions/security/test/alerting_api_integration/ftr_provider_context.d.ts @elastic/appex-qa -/x-pack/platform/test/serverless @elastic/appex-qa -/x-pack/test/api_integration/deployment_agnostic @elastic/appex-qa +/x-pack/platform/test/serverless/shared @elastic/appex-qa /x-pack/platform/test/functional/services/ml/api.ts @elastic/appex-qa # temporarily due to SKA tests relocation /x-pack/platform/test/.gitignore @elastic/appex-qa /x-pack/solutions/**/test/.gitignore @elastic/appex-qa @@ -1934,6 +1936,10 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/platform/test/accessibility/ftr_provider_context.d.ts @elastic/appex-qa /x-pack/platform/test/accessibility/page_objects.ts @elastic/appex-qa /x-pack/platform/test/accessibility/services.ts @elastic/appex-qa +/x-pack/platform/test/serverless/api_integration/config.base.ts @elastic/appex-qa +/x-pack/platform/test/serverless/api_integration/ftr_provider_context.d.ts @elastic/appex-qa +/x-pack/platform/test/serverless/api_integration/services/ @elastic/appex-qa +/x-pack/platform/test/serverless/api_integration/configs/ @elastic/appex-qa /x-pack/test_serverless/functional/page_objects/add_cis_integration_form_page.ts @elastic/appex-qa # temporarily due to SKA tests relocation /x-pack/test_serverless/functional/page_objects/constants/test_subject_ids.ts @elastic/appex-qa # temporarily due to SKA tests relocation /x-pack/test_serverless/functional/page_objects/csp_dashboard_page.ts @elastic/appex-qa # temporarily due to SKA tests relocation @@ -2042,8 +2048,9 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /src/platform/packages/shared/kbn-test/src/jest/setup/mocks.kbn_i18n_react.js @elastic/kibana-core /x-pack/platform/test/saved_objects_field_count/ @elastic/kibana-core /x-pack/test_serverless/**/test_suites/common/saved_objects_management/ @elastic/kibana-core -/x-pack/test_serverless/api_integration/test_suites/common/core/ @elastic/kibana-core -/x-pack/test_serverless/api_integration/test_suites/**/telemetry/ @elastic/kibana-core +/x-pack/platform/test/serverless/**/test_suites/saved_objects_management/ @elastic/kibana-core +/x-pack/platform/test/serverless/api_integration/test_suites/core/ @elastic/kibana-core +/x-pack/platform/test/serverless/api_integration/test_suites/telemetry/ @elastic/kibana-core /x-pack/test/functional/es_archives/cases/migrations/8.8.0 @elastic/kibana-cases #CC# /src/core/server/csp/ @elastic/kibana-core @@ -2059,7 +2066,7 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/platform/test/functional_gen_ai/inference @elastic/appex-ai-infra # AppEx Platform Services Security -/x-pack/test_serverless/api_integration/test_suites/common/security_response_headers.ts @elastic/kibana-security +/x-pack/platform/test/serverless/api_integration/test_suites/security_response_headers.ts @elastic/kibana-security /x-pack/platform/test/api_integration/apis/es @elastic/kibana-security /x-pack/platform/test/api_integration/apis/features @elastic/kibana-security @@ -2141,6 +2148,7 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi /x-pack/platform/test/saved_object_api_integration/ @elastic/kibana-security /x-pack/test_serverless/**/test_suites/common/platform_security/ @elastic/kibana-security /x-pack/test_serverless/**/test_suites/search/platform_security/ @elastic/kibana-security +/x-pack/platform/test/serverless/**/test_suites/platform_security/ @elastic/kibana-security /x-pack/test_serverless/**/test_suites/observability/platform_security/ @elastic/kibana-security /src/core/packages/http/server-internal/src/cdn_config/ @elastic/kibana-security @elastic/kibana-core /x-pack/test_serverless/functional/test_suites/security/config.ts @elastic/kibana-security @elastic/appex-qa @@ -2216,7 +2224,7 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi /x-pack/test_serverless/functional/test_suites/search/screenshot_creation/response_ops_docs @elastic/response-ops /x-pack/test_serverless/functional/test_suites/security/screenshot_creation/response_ops_docs @elastic/response-ops /x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs @elastic/response-ops -/x-pack/test_serverless/api_integration/test_suites/common/alerting/ @elastic/response-ops +/x-pack/platform/test/serverless/api_integration/test_suites/alerting/ @elastic/response-ops /x-pack/test/functional/es_archives/action_task_params @elastic/response-ops /x-pack/test/functional/es_archives/actions @elastic/response-ops /x-pack/test/functional/es_archives/alerting @elastic/response-ops @@ -2324,17 +2332,21 @@ x-pack/platform/test/functional/page_objects/search_profiler_page.ts @elastic/se /x-pack/platform/test/api_integration/apis/searchprofiler @elastic/kibana-management /x-pack/platform/test/api_integration/apis/console @elastic/kibana-management /x-pack/test_serverless/**/test_suites/common/index_management/ @elastic/kibana-management +/x-pack/platform/test/serverless/**/test_suites/index_management/ @elastic/kibana-management /x-pack/test_serverless/**/test_suites/common/management/index_management/ @elastic/kibana-management /x-pack/test_serverless/**/test_suites/common/painless_lab/ @elastic/kibana-management +/x-pack/platform/test/serverless/**/test_suites/painless_lab/ @elastic/kibana-management /x-pack/test_serverless/**/test_suites/common/console/ @elastic/kibana-management -/x-pack/test_serverless/api_integration/test_suites/common/management/ @elastic/kibana-management -/x-pack/test_serverless/api_integration/test_suites/common/search_profiler/ @elastic/kibana-management +/x-pack/platform/test/serverless/**/test_suites/console/ @elastic/kibana-management +/x-pack/platform/test/serverless/api_integration/test_suites/management/ @elastic/kibana-management +/x-pack/platform/test/serverless/api_integration/test_suites/search_profiler/ @elastic/kibana-management /x-pack/test_serverless/functional/test_suites/**/advanced_settings.ts @elastic/kibana-management /x-pack/test_serverless/functional/test_suites/common/management/disabled_uis.ts @elastic/kibana-management /x-pack/test_serverless/functional/test_suites/common/management/ingest_pipelines.ts @elastic/kibana-management /x-pack/test_serverless/functional/test_suites/common/management/landing_page.ts @elastic/kibana-management /x-pack/test_serverless/functional/test_suites/common/dev_tools/ @elastic/kibana-management /x-pack/test_serverless/**/test_suites/common/grok_debugger/ @elastic/kibana-management +/x-pack/platform/test/serverless/**/test_suites/grok_debugger/ @elastic/kibana-management /x-pack/platform/test/api_integration/apis/management/ @elastic/kibana-management /x-pack/platform/test/api_integration_deployment_agnostic/apis/management/ @elastic/kibana-management /x-pack/platform/test/api_integration_deployment_agnostic/apis/painless_lab/ @elastic/kibana-management @@ -2885,7 +2897,7 @@ x-pack/solutions/observability/test/api_integration/profiling @elastic/obs-ux-in x-pack/solutions/observability/plugins/observability_shared/public/components/profiling @elastic/obs-ux-infra_services-team # Shared UX -/x-pack/test_serverless/api_integration/test_suites/common/favorites @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200985 +/x-pack/platform/test/serverless/api_integration/test_suites/favorites @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200985 /src/platform/test/api_integration/apis/short_url/**/*.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200209/files#r1846654156 /src/platform/test/api_integration/apis/unused_urls_task/**/*.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/220138 /src/platform/test/functional/page_objects/share_page.ts @elastic/appex-sharedux # Assigned per https://github.com/elastic/kibana/pull/200209/files#r1846648444 diff --git a/x-pack/test/api_integration/deployment_agnostic/README.md b/x-pack/platform/test/api_integration_deployment_agnostic/README.md similarity index 80% rename from x-pack/test/api_integration/deployment_agnostic/README.md rename to x-pack/platform/test/api_integration_deployment_agnostic/README.md index e383e63d16f61..760eda9642c66 100644 --- a/x-pack/test/api_integration/deployment_agnostic/README.md +++ b/x-pack/platform/test/api_integration_deployment_agnostic/README.md @@ -19,7 +19,7 @@ A deployment-agnostic test should be loaded in stateful and at least 1 serverles ## Tests Design Requirements -A deployment-agnostic test is contained within a single test file and always utilizes the [DeploymentAgnosticFtrProviderContext](https://github.com/elastic/kibana/blob/main/x-pack/test/api_integration/deployment_agnostic/ftr_provider_context.d.ts) to load compatible FTR services. A compatible FTR service must support: +A deployment-agnostic test is contained within a single test file and always utilizes the [DeploymentAgnosticFtrProviderContext](https://github.com/elastic/kibana/blob/main/x-pack/platform/test/api_integration_deployment_agnostic/ftr_provider_context.d.ts) to load compatible FTR services. A compatible FTR service must support: - **Serverless**: Both local environments and MKI (Managed Kubernetes Infrastructure). - **Stateful**: Both local environments and Cloud deployments. @@ -47,8 +47,8 @@ While the deployment-agnostic testing approach is beneficial, it should not comp We recommend following this structure to simplify maintenance and allow other teams to reuse code (e.g., FTR services) created by different teams: ``` -x-pack/test/ -├─ deployment_agnostic +x-pack/solutions//test/ +├─ api_integration_deployment_agnostic │ ├─ apis │ │ ├─ │ │ │ ├─ @@ -58,59 +58,42 @@ x-pack/test/ │ │ │ ├─ │ ├─ configs │ │ ├─ stateful -│ │ │ ├─ .index.ts // e.g., oblt.index.ts -│ │ │ ├─ .config.ts // e.g., oblt.stateful.config.ts +│ │ │ ├─ .index.ts // e.g., oblt_feature_A.index.ts +│ │ │ ├─ .config.ts // e.g., oblt_feature_A.stateful.config.ts │ │ ├─ serverless -│ │ ├─ .index.ts // e.g., oblt.index.ts -│ │ ├─ .serverless.config.ts // e.g., oblt.serverless.config.ts +│ │ ├─ .index.ts // e.g., oblt_feature_A.index.ts +│ │ ├─ .serverless.config.ts // e.g., oblt_feature_A.serverless.config.ts │ ├─ ftr_provider_context.d.ts // with types of services from './services' │ ├─ services -│ ├─ index.ts // only services from 'x-pack/test/api_integration/deployment_agnostic/services' +│ ├─ index.ts // only services from 'x-pack/solutions//test/api_integration_deployment_agnostic/services' │ ├─ .ts │ ├─ .ts ``` ## Loading Your Tests Properly -When Platform teams add deployment-agnostic tests, it is expected that these tests are loaded in `configs/stateful/platform.index.ts` and at least one of the `.serverless.config` files under `configs/serverless` folder. +When Platform teams add deployment-agnostic tests, it is expected that these tests are put in `x-pack/platform/test/api_integration_deployment_agnostic` directory and be loaded in `configs/stateful/platform.index.ts` and at least one of the `.serverless.config` files under `configs/serverless` folder in the same directory. -When a Solution team (e.g., one of the Oblt teams) adds deployment-agnostic tests, it is expected that these tests are loaded in both `configs/stateful/oblt.index.ts` and `configs/serverless/oblt.index.ts`. +When a Solution team (e.g., one of the Oblt teams) adds deployment-agnostic tests, it is expected that these tests are put in `x-pack/solutions/observability/test/api_integration_deployment_agnostic` directory and loaded in both `configs/stateful/oblt_feature_A.index.ts` and `configs/serverless/oblt_feature_A.index.ts` in the same directory. ## Step-by-Step Guide 1. Define Deployment-Agnostic Services -Under `x-pack/test//deployment_agnostic/services`, create `index.ts` and load base services from `x-pack/test/api_integration/deployment_agnostic/services`: +Add a new service either in `x-pack/platform/test/api_integration_deployment_agnostic` or `x-pack/solutions//test/api_integration_deployment_agnostic/services`, and make sure to load it in the related `index.ts` file: ```ts -import { services as deploymentAgnosticServices } from './../../api_integration/deployment_agnostic/services'; - -export type { - InternalRequestHeader, - RoleCredentials, - SupertestWithoutAuthProviderType, -} from '@kbn/ftr-common-functional-services'; +import { NewServiceProvider } from './new_service'; export const services = { - ...deploymentAgnosticServices, // create a new deployment-agnostic service and load here + newService: NewServiceProvider, }; ``` -We suggest adding new services to `x-pack/test/api_integration/deployment_agnostic/services` so other teams can benefit from them. - -2. Create `DeploymentAgnosticFtrProviderContext` with Services Defined in Step 2 - -Create `ftr_provider_context.d.ts` and export `DeploymentAgnosticFtrProviderContext`: - -```ts -import { GenericFtrProviderContext } from '@kbn/test'; -import { services } from './services'; - -export type DeploymentAgnosticFtrProviderContext = GenericFtrProviderContext; -``` +We suggest adding new platform-wide services to `x-pack/platform/test/api_integration_deployment_agnostic` so other teams can benefit from them. -3. Add Tests +2. Add Tests API Authentication in Kibana: Public vs. Internal APIs @@ -127,7 +110,7 @@ Recommendations: - pass `useCookieHeader: true` to use Cookie header for requests authentication - don't forget to invalidate API key using `destroy()` on supertest scoped instance in `after` hook -Add test files to `x-pack/test//deployment_agnostic/apis/`: +Add test files to `x-pack/solutions//test/api_integration_deployment_agnostic/apis/`: test example @@ -173,7 +156,7 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) { Load all test files in `index.ts` under the same folder. -4. Add Tests Entry File and FTR Config File for **Stateful** Deployment +3. Add Tests Entry File and FTR Config File for **Stateful** Deployment Create `configs/stateful/plaform.index.ts` tests entry file and load tests: @@ -190,7 +173,7 @@ export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext) Create `configs/stateful/platform.stateful.config.ts` and link tests entry file: ```ts -import { createStatefulTestConfig } from './../../api_integration/deployment_agnostic/default_configs/stateful.config.base'; +import { createStatefulTestConfig } from 'kbn/test-suites-xpack-platform/api_integration_deployment_agnostic/default_configs/stateful.config.base'; import { services } from './services'; export default createStatefulTestConfig({ @@ -221,7 +204,7 @@ export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext) oblt.serverless.config.ts ```ts -import { createServerlessTestConfig } from './../../api_integration/deployment_agnostic/default_configs/serverless.config.base'; +import { createServerlessTestConfig } from 'kbn/test-suites-xpack-platform/api_integration_deployment_agnostic/default_configs/serverless.config.base'; import { services } from './services'; export default createServerlessTestConfig({ @@ -247,20 +230,20 @@ We do not recommend use of custom server arguments because it may lead to unexpe ```sh # start server -node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/.stateful.config.ts +node scripts/functional_tests_server --config x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/stateful/oblt_feature_A.stateful.config.ts # run tests -node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/.stateful.config.ts --grep=$ +node scripts/functional_test_runner --config x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/stateful/oblt_feature_A.stateful.config.ts --grep=$ ``` ### Serverless ```sh # start server -node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/.serverless.config.ts +node scripts/functional_tests_server --config x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/serverless/oblt_feature_A.serverless.config.ts # run tests -node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/.serverless.config.ts --grep=$ +node scripts/functional_test_runner --config x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/serverless/oblt_feature_A.serverless.config.ts --grep=$ ``` ## Tagging and Skipping the Tests @@ -294,7 +277,7 @@ describe('test suite', function () { If your tests align with the outlined criteria and requirements, you can migrate them to deployment-agnostic by following these steps: -1. Move your tests to the `x-pack/test/api_integration/deployment_agnostic/apis/` directory. +1. Move your tests to the `x-pack/solutions//test/api_integration_deployment_agnostic/apis/` directory. 2. Update each test file to use the `DeploymentAgnosticFtrProviderContext` context and load the required FTR services it provides. 3. Ensure the `roleScopedSupertest` or `samlAuth` service is used instead for `supertest` for authentication and test API calls. 4. Remove all usage of the `supertest` service. It is authenticated as system index superuser and often causes test failures on Cloud, where priveleges are more strict. diff --git a/x-pack/platform/test/api_integration_deployment_agnostic/default_configs/feature_flag.serverless.config.base.ts b/x-pack/platform/test/api_integration_deployment_agnostic/default_configs/feature_flag.serverless.config.base.ts index 869e68f6b504d..f847bcce242e1 100644 --- a/x-pack/platform/test/api_integration_deployment_agnostic/default_configs/feature_flag.serverless.config.base.ts +++ b/x-pack/platform/test/api_integration_deployment_agnostic/default_configs/feature_flag.serverless.config.base.ts @@ -82,7 +82,7 @@ export function createServerlessFeatureFlagTestConfig { + const svlSharedConfig = await readConfigFile(require.resolve('../shared/config.base.ts')); + + return { + ...svlSharedConfig.getAll(), + + testConfigCategory: ScoutTestRunConfigCategory.API_TEST, + services: { + ...services, + ...options.services, + }, + esTestCluster: { + ...svlSharedConfig.get('esTestCluster'), + serverArgs: [ + ...svlSharedConfig.get('esTestCluster.serverArgs'), + 'xpack.security.authc.native_roles.enabled=true', + ...(options.esServerArgs ?? []), + ], + }, + kbnTestServer: { + ...svlSharedConfig.get('kbnTestServer'), + serverArgs: [ + ...svlSharedConfig.get('kbnTestServer.serverArgs'), + `--serverless=${options.serverlessProject}`, + ...(options.kbnServerArgs || []), + ], + }, + testFiles: options.testFiles, + junit: options.junit, + suiteTags: options.suiteTags, + }; + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/configs/chat/config.group1.ts b/x-pack/platform/test/serverless/api_integration/configs/chat/config.group1.ts new file mode 100644 index 0000000000000..9bd2909ee6ed7 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/configs/chat/config.group1.ts @@ -0,0 +1,24 @@ +/* + * 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 { createTestConfig } from '../../config.base'; + +export default createTestConfig({ + serverlessProject: 'chat', + testFiles: [ + require.resolve('../../test_suites/core'), + require.resolve('../../test_suites/elasticsearch_api'), + ], + junit: { + reportName: 'Serverless Chat Platform API Integration Tests - Common Group 1', + }, + suiteTags: { exclude: ['skipSvlChat'] }, + + // include settings from project controller + esServerArgs: [], + kbnServerArgs: [], +}); diff --git a/x-pack/platform/test/serverless/api_integration/configs/observability/config.group1.ts b/x-pack/platform/test/serverless/api_integration/configs/observability/config.group1.ts new file mode 100644 index 0000000000000..f11dd44db047a --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/configs/observability/config.group1.ts @@ -0,0 +1,56 @@ +/* + * 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 { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils'; +import { createTestConfig } from '../../config.base'; + +export default createTestConfig({ + serverlessProject: 'oblt', + testFiles: [ + require.resolve('../../test_suites/alerting'), + require.resolve('../../test_suites/data_view_field_editor'), + require.resolve('../../test_suites/data_views'), + require.resolve('../../test_suites/elasticsearch_api'), + require.resolve('../../test_suites/index_management'), + require.resolve('../../test_suites/kql_telemetry'), + require.resolve('../../test_suites/management'), + require.resolve('../../test_suites/platform_security'), + require.resolve('../../test_suites/scripts_tests'), + require.resolve('../../test_suites/search_oss'), + require.resolve('../../test_suites/search_profiler'), + require.resolve('../../test_suites/search_xpack'), + require.resolve('../../test_suites/core'), + require.resolve('../../test_suites/reporting'), + require.resolve('../../test_suites/grok_debugger'), + require.resolve('../../test_suites/painless_lab'), + require.resolve('../../test_suites/console'), + require.resolve('../../test_suites/saved_objects_management'), + require.resolve('../../test_suites/telemetry'), + require.resolve('../../test_suites/data_usage'), + require.resolve('../../test_suites/favorites'), + ], + junit: { + reportName: 'Serverless Observability Platform API Integration Tests - Common Group 1', + }, + suiteTags: { exclude: ['skipSvlOblt'] }, + + // include settings from project controller + esServerArgs: [], + kbnServerArgs: [ + // defined in MKI control plane + '--xpack.uptime.service.manifestUrl=mockDevUrl', + // useful for testing (also enabled in MKI QA) + '--coreApp.allowDynamicConfigOverrides=true', + '--xpack.dataUsage.enabled=true', + '--xpack.dataUsage.enableExperimental=[]', + // dataUsage.autoops* config is set in kibana controller + '--xpack.dataUsage.autoops.enabled=true', + '--xpack.dataUsage.autoops.api.url=http://localhost:9000', + `--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`, + `--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`, + ], +}); diff --git a/x-pack/platform/test/serverless/api_integration/configs/observability/config.logs_essentials.group1.ts b/x-pack/platform/test/serverless/api_integration/configs/observability/config.logs_essentials.group1.ts new file mode 100644 index 0000000000000..f76e70dd7f071 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/configs/observability/config.logs_essentials.group1.ts @@ -0,0 +1,42 @@ +/* + * 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 { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils'; +import { createTestConfig } from '../../config.base'; + +export default createTestConfig({ + serverlessProject: 'oblt', + testFiles: [require.resolve('../../test_suites/telemetry')], + junit: { + reportName: + 'Serverless Observability Logs Essentials Platform API Integration Tests - Common Group 1', + }, + suiteTags: { exclude: ['skipSvlOblt'] }, + + // include settings from elasticsearch controller + esServerArgs: [ + // logs essentials tier configuration + 'serverless.project_type=observability', + 'serverless.observability.tier=logs_essentials', + ], + kbnServerArgs: [ + // defined in MKI control plane + '--xpack.uptime.service.manifestUrl=mockDevUrl', + // useful for testing (also enabled in MKI QA) + '--coreApp.allowDynamicConfigOverrides=true', + '--xpack.dataUsage.enabled=true', + '--xpack.dataUsage.enableExperimental=[]', + // dataUsage.autoops* config is set in kibana controller + '--xpack.dataUsage.autoops.enabled=true', + '--xpack.dataUsage.autoops.api.url=http://localhost:9000', + `--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`, + `--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`, + `--pricing.tiers.products=${JSON.stringify([ + { name: 'observability', tier: 'logs_essentials' }, + ])}`, + ], +}); diff --git a/x-pack/platform/test/serverless/api_integration/configs/search/config.group1.ts b/x-pack/platform/test/serverless/api_integration/configs/search/config.group1.ts new file mode 100644 index 0000000000000..abb15bfe07075 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/configs/search/config.group1.ts @@ -0,0 +1,53 @@ +/* + * 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 { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils'; +import { createTestConfig } from '../../config.base'; + +export default createTestConfig({ + serverlessProject: 'es', + testFiles: [ + require.resolve('../../test_suites/alerting'), + require.resolve('../../test_suites/data_view_field_editor'), + require.resolve('../../test_suites/data_views'), + require.resolve('../../test_suites/elasticsearch_api'), + require.resolve('../../test_suites/index_management'), + require.resolve('../../test_suites/kql_telemetry'), + require.resolve('../../test_suites/management'), + require.resolve('../../test_suites/platform_security'), + require.resolve('../../test_suites/scripts_tests'), + require.resolve('../../test_suites/search_oss'), + require.resolve('../../test_suites/search_profiler'), + require.resolve('../../test_suites/search_xpack'), + require.resolve('../../test_suites/core'), + require.resolve('../../test_suites/reporting'), + require.resolve('../../test_suites/console'), + require.resolve('../../test_suites/saved_objects_management'), + require.resolve('../../test_suites/telemetry'), + require.resolve('../../test_suites/data_usage'), + require.resolve('../../test_suites/favorites'), + ], + junit: { + reportName: 'Serverless Search Platform API Integration Tests - Common Group 1', + }, + suiteTags: { exclude: ['skipSvlSearch'] }, + + // include settings from project controller + // https://github.com/elastic/project-controller/blob/main/internal/project/esproject/config/elasticsearch.yml + esServerArgs: [], + kbnServerArgs: [ + // useful for testing (also enabled in MKI QA) + '--coreApp.allowDynamicConfigOverrides=true', + '--xpack.dataUsage.enabled=true', + '--xpack.dataUsage.enableExperimental=[]', + // dataUsage.autoops* config is set in kibana controller + '--xpack.dataUsage.autoops.enabled=true', + '--xpack.dataUsage.autoops.api.url=http://localhost:9000', + `--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`, + `--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`, + ], +}); diff --git a/x-pack/platform/test/serverless/api_integration/configs/security/config.group1.ts b/x-pack/platform/test/serverless/api_integration/configs/security/config.group1.ts new file mode 100644 index 0000000000000..5dafb8ab301ce --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/configs/security/config.group1.ts @@ -0,0 +1,61 @@ +/* + * 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 { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils'; +import { createTestConfig } from '../../config.base'; + +export default createTestConfig({ + serverlessProject: 'security', + testFiles: [ + require.resolve('../../test_suites/alerting'), + require.resolve('../../test_suites/data_view_field_editor'), + require.resolve('../../test_suites/data_views'), + require.resolve('../../test_suites/elasticsearch_api'), + require.resolve('../../test_suites/index_management'), + require.resolve('../../test_suites/kql_telemetry'), + require.resolve('../../test_suites/management'), + require.resolve('../../test_suites/platform_security'), + require.resolve('../../test_suites/scripts_tests'), + require.resolve('../../test_suites/search_oss'), + require.resolve('../../test_suites/search_profiler'), + require.resolve('../../test_suites/search_xpack'), + require.resolve('../../test_suites/core'), + require.resolve('../../test_suites/reporting'), + require.resolve('../../test_suites/grok_debugger'), + require.resolve('../../test_suites/painless_lab'), + require.resolve('../../test_suites/console'), + require.resolve('../../test_suites/saved_objects_management'), + require.resolve('../../test_suites/telemetry'), + require.resolve('../../test_suites/data_usage'), + require.resolve('../../test_suites/favorites'), + ], + junit: { + reportName: 'Serverless Security Platform API Integration Tests - Common Group 1', + }, + suiteTags: { exclude: ['skipSvlSec'] }, + + // include settings from project controller + // https://github.com/elastic/project-controller/blob/main/internal/project/security/config/elasticsearch.yml + esServerArgs: ['xpack.ml.nlp.enabled=true'], + kbnServerArgs: [ + // disable fleet task that writes to metrics.fleet_server.* data streams, impacting functional tests + `--xpack.task_manager.unsafe.exclude_task_types=${JSON.stringify(['Fleet-Metrics-Task'])}`, + // useful for testing (also enabled in MKI QA) + '--coreApp.allowDynamicConfigOverrides=true', + `--xpack.securitySolutionServerless.cloudSecurityUsageReportingTaskInterval=5s`, + `--xpack.securitySolutionServerless.usageApi.url=http://localhost:8081`, + '--xpack.dataUsage.enabled=true', + '--xpack.dataUsage.enableExperimental=[]', + // dataUsage.autoops* config is set in kibana controller + '--xpack.dataUsage.autoops.enabled=true', + '--xpack.dataUsage.autoops.api.url=http://localhost:9000', + `--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`, + `--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`, + // Enables /internal/cloud_security_posture/graph API + `--uiSettings.overrides.securitySolution:enableGraphVisualization=true`, + ], +}); diff --git a/x-pack/test/api_integration/deployment_agnostic/ftr_provider_context.d.ts b/x-pack/platform/test/serverless/api_integration/ftr_provider_context.d.ts similarity index 77% rename from x-pack/test/api_integration/deployment_agnostic/ftr_provider_context.d.ts rename to x-pack/platform/test/serverless/api_integration/ftr_provider_context.d.ts index 81df490d79428..aa56557c09df8 100644 --- a/x-pack/test/api_integration/deployment_agnostic/ftr_provider_context.d.ts +++ b/x-pack/platform/test/serverless/api_integration/ftr_provider_context.d.ts @@ -9,4 +9,4 @@ import { GenericFtrProviderContext } from '@kbn/test'; import { services } from './services'; -export type DeploymentAgnosticFtrProviderContext = GenericFtrProviderContext; +export type FtrProviderContext = GenericFtrProviderContext; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/fleet/default_setup.ts b/x-pack/platform/test/serverless/api_integration/services/default_fleet_setup.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/fleet/default_setup.ts rename to x-pack/platform/test/serverless/api_integration/services/default_fleet_setup.ts index 7b6ba09a398d1..dc6af90fc621d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/fleet/default_setup.ts +++ b/x-pack/platform/test/serverless/api_integration/services/default_fleet_setup.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../ftr_provider_context'; const defaultFleetServerHostId = 'default-fleet-server'; const defaultElasticsearchOutputId = 'es-default-output'; diff --git a/x-pack/platform/test/serverless/api_integration/services/index.ts b/x-pack/platform/test/serverless/api_integration/services/index.ts new file mode 100644 index 0000000000000..907d3d62d70d9 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index.ts @@ -0,0 +1,61 @@ +/* + * 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 { GenericFtrProviderContext } from '@kbn/test'; +import { services as deploymentAgnosticSharedServices } from '../../shared/services/deployment_agnostic_services'; +import { services as svlSharedServices } from '../../shared/services'; + +import { SamlToolsProvider } from './saml_tools'; +import { SvlCasesServiceProvider } from './svl_cases'; + +import { SvlEnrichPoliciesApi } from './index_management/svl_enrich_policies.api'; +import { SvlSettingsApi } from './index_management/svl_settings.api'; +import { SvlIndicesApi } from './index_management/svl_indices.api'; +import { SvlIndicesHelpers } from './index_management/svl_indices.helpers'; +import { SvlEnrichPoliciesHelpers } from './index_management/svl_enrich_policies.helpers'; +import { SvlDatastreamsHelpers } from './index_management/svl_datastreams.helpers'; +import { SvlComponentTemplatesApi } from './index_management/svl_component_templates.api'; +import { SvlComponentTemplateHelpers } from './index_management/svl_component_templates.helpers'; +import { SvlTemplatesHelpers } from './index_management/svl_templates.helpers'; +import { SvlTemplatesApi } from './index_management/svl_templates.api'; +import { SvlMappingsApi } from './index_management/svl_mappings.api'; +import { SynthtraceProvider } from './synthtrace'; +import { SvlClusterNodesApi } from './index_management/svl_cluster_nodes.api'; + +export const services = { + // deployment agnostic FTR services + ...deploymentAgnosticSharedServices, + + // serverless FTR services + ...svlSharedServices, + samlTools: SamlToolsProvider, + svlCases: SvlCasesServiceProvider, + synthtrace: SynthtraceProvider, + svlEnrichPoliciesApi: SvlEnrichPoliciesApi, + svlSettingsApi: SvlSettingsApi, + svlIndicesApi: SvlIndicesApi, + svlIndicesHelpers: SvlIndicesHelpers, + svlEnrichPoliciesHelpers: SvlEnrichPoliciesHelpers, + svlDatastreamsHelpers: SvlDatastreamsHelpers, + svlComponentTemplatesApi: SvlComponentTemplatesApi, + svlComponentTemplateHelpers: SvlComponentTemplateHelpers, + svlTemplatesHelpers: SvlTemplatesHelpers, + svlTemplatesApi: SvlTemplatesApi, + svlMappingsApi: SvlMappingsApi, + svlClusterNodesApi: SvlClusterNodesApi, +}; + +export type InheritedFtrProviderContext = GenericFtrProviderContext; + +export type InheritedServices = InheritedFtrProviderContext extends GenericFtrProviderContext< + infer TServices, + {} +> + ? TServices + : {}; + +export type { SupertestWithRoleScopeType } from '../../shared/services'; diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/constants.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/constants.ts new file mode 100644 index 0000000000000..6d080a1eb95ff --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/constants.ts @@ -0,0 +1,34 @@ +/* + * 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. + */ + +export const API_BASE_PATH = '/api/index_management'; +export const INTERNAL_API_BASE_PATH = '/internal/index_management'; + +export const INDEX_PATTERNS = ['test*']; + +const expectedIndexKeys = [ + 'health', + 'hidden', + 'status', + 'name', + 'uuid', + 'primary', + 'replica', + 'documents', + 'documents_deleted', + 'size', + 'primary_size', + 'isFrozen', + 'aliases', + // Cloud disables CCR, so wouldn't expect follower indices. + 'isFollowerIndex', // data enricher + 'ilm', // data enricher + 'isRollupIndex', // data enricher +]; +// We need to sort the keys before comparing then, because race conditions +// can cause enrichers to register in non-deterministic order. +export const sortedExpectedIndexKeys = expectedIndexKeys.sort(); diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_cluster_nodes.api.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_cluster_nodes.api.ts new file mode 100644 index 0000000000000..f66876ba70e9b --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_cluster_nodes.api.ts @@ -0,0 +1,25 @@ +/* + * 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 { API_BASE_PATH } from './constants'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; + +export function SvlClusterNodesApi({ getService }: FtrProviderContext) { + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const svlCommonApi = getService('svlCommonApi'); + + const getNodesPlugins = (roleAuthc: RoleCredentials) => + supertestWithoutAuth + .get(`${API_BASE_PATH}/nodes/plugins`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + return { + getNodesPlugins, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_component_templates.api.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_component_templates.api.ts new file mode 100644 index 0000000000000..21d197d27209b --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_component_templates.api.ts @@ -0,0 +1,77 @@ +/* + * 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 { ClusterPutComponentTemplateRequest } from '@elastic/elasticsearch/lib/api/types'; + +import { API_BASE_PATH } from './constants'; +import { RoleCredentials } from '../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +type Options = Partial | { _kbnMeta: Record }; + +export function SvlComponentTemplatesApi({ getService }: FtrProviderContext) { + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const svlCommonApi = getService('svlCommonApi'); + + const createComponentTemplate = async ( + name: string, + options: Options, + roleAuthc: RoleCredentials + ) => + await supertestWithoutAuth + .post(`${API_BASE_PATH}/component_templates`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ name, ...options }); + + const getAllComponentTemplates = async (roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .get(`${API_BASE_PATH}/component_templates`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + const getOneComponentTemplate = async (name: string, roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .get(`${API_BASE_PATH}/component_templates/${name}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + const updateComponentTemplate = async ( + name: string, + options: Options, + roleAuthc: RoleCredentials + ) => + await supertestWithoutAuth + .get(`${API_BASE_PATH}/component_templates/${name}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ + name, + ...options, + }); + + const deleteComponentTemplate = async (name: string, roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .delete(`${API_BASE_PATH}/component_templates/${name}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + const getComponentTemplateDatastreams = async (name: string, roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .get(`${API_BASE_PATH}/component_templates/${name}/datastreams`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + return { + createComponentTemplate, + getAllComponentTemplates, + getOneComponentTemplate, + updateComponentTemplate, + deleteComponentTemplate, + getComponentTemplateDatastreams, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_component_templates.helpers.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_component_templates.helpers.ts new file mode 100644 index 0000000000000..32ad2b7181cc2 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_component_templates.helpers.ts @@ -0,0 +1,90 @@ +/* + * 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 { FtrProviderContext } from '../../ftr_provider_context'; + +export function SvlComponentTemplateHelpers({ getService }: FtrProviderContext) { + const log = getService('log'); + const es = getService('es'); + + let componentTemplatesCreated: string[] = []; + let indexTemplatesCreated: string[] = []; + let datastreamCreated: string[] = []; + + const removeComponentTemplate = (name: string) => es.cluster.deleteComponentTemplate({ name }); + + const removeDatastream = (datastream: string) => + es.indices.deleteDataStream({ name: datastream }); + + const removeIndexTemplate = (name: string) => + es.indices.deleteIndexTemplate({ name }, { meta: true }); + + const addComponentTemplate = (componentTemplate: any, shouldCacheTemplate: boolean) => { + if (shouldCacheTemplate) { + componentTemplatesCreated.push(componentTemplate.name); + } + + return es.cluster.putComponentTemplate(componentTemplate, { meta: true }); + }; + + const addIndexTemplate = (indexTemplate: any, shouldCacheTemplate: boolean) => { + if (shouldCacheTemplate) { + indexTemplatesCreated.push(indexTemplate.name); + } + + return es.indices.putIndexTemplate(indexTemplate, { meta: true }); + }; + + const addDatastream = (datastream: string, shouldCacheTemplate: boolean) => { + if (shouldCacheTemplate) { + datastreamCreated.push(datastream); + } + + return es.indices.createDataStream({ name: datastream }); + }; + + const cleanUpComponentTemplates = () => + Promise.all(componentTemplatesCreated.map(removeComponentTemplate)) + .then(() => { + componentTemplatesCreated = []; + }) + .catch((err) => { + log.debug(`[Cleanup error] Error deleting ES resources: ${err.message}`); + }); + + const cleanUpIndexTemplates = () => + Promise.all(indexTemplatesCreated.map(removeIndexTemplate)) + .then(() => { + indexTemplatesCreated = []; + }) + .catch((err) => { + log.debug(`[Cleanup error] Error deleting ES resources: ${err.message}`); + }); + + const cleanupDatastreams = () => + Promise.all(datastreamCreated.map(removeDatastream)) + .then(() => { + datastreamCreated = []; + }) + .catch((err) => { + log.debug(`[Cleanup error] Error deleting ES resources: ${err.message}`); + }); + + return { + addDatastream, + addIndexTemplate, + addComponentTemplate, + + removeDatastream, + removeIndexTemplate, + removeComponentTemplate, + + cleanupDatastreams, + cleanUpIndexTemplates, + cleanUpComponentTemplates, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_datastreams.helpers.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_datastreams.helpers.ts new file mode 100644 index 0000000000000..f4c33693e9b65 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_datastreams.helpers.ts @@ -0,0 +1,91 @@ +/* + * 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 { FtrProviderContext } from '../../ftr_provider_context'; + +export function SvlDatastreamsHelpers({ getService }: FtrProviderContext) { + const es = getService('es'); + + const createDataStream = async (name: string) => { + // A data stream requires an index template before it can be created. + await es.indices.putIndexTemplate({ + name, + // We need to match the names of backing indices with this template. + index_patterns: [name + '*'], + template: { + mappings: { + properties: { + '@timestamp': { + type: 'date', + }, + }, + }, + lifecycle: { + enabled: true, + }, + }, + data_stream: {}, + }); + + await es.indices.createDataStream({ name }); + }; + + const updateIndexTemplateMappings = async (name: string, mappings: any) => { + await es.indices.putIndexTemplate({ + name, + // We need to match the names of backing indices with this template. + index_patterns: [name + '*'], + template: { + mappings, + }, + data_stream: {}, + }); + }; + + const getDatastream = async (name: string) => { + const { + data_streams: [datastream], + } = await es.indices.getDataStream({ name }); + return datastream; + }; + + const getMapping = async (name: string) => { + const res = await es.indices.getMapping({ index: name }); + + return Object.values(res)[0]!.mappings; + }; + + const deleteComposableIndexTemplate = async (name: string) => { + await es.indices.deleteIndexTemplate({ name }); + }; + + const deleteDataStream = async (name: string) => { + await es.indices.deleteDataStream({ name }); + await deleteComposableIndexTemplate(name); + }; + + const assertDataStreamStorageSizeExists = (storageSize: string, storageSizeBytes: number) => { + // Storage size of a document doesn't look like it would be deterministic (could vary depending + // on how ES, Lucene, and the file system interact), so we'll just assert its presence and + // type. + expect(storageSize).to.be.ok(); + expect(typeof storageSize).to.be('string'); + expect(storageSizeBytes).to.be.ok(); + expect(typeof storageSizeBytes).to.be('number'); + }; + + return { + createDataStream, + updateIndexTemplateMappings, + getDatastream, + getMapping, + deleteComposableIndexTemplate, + deleteDataStream, + assertDataStreamStorageSizeExists, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_enrich_policies.api.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_enrich_policies.api.ts new file mode 100644 index 0000000000000..3ec9faa1c533b --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_enrich_policies.api.ts @@ -0,0 +1,39 @@ +/* + * 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 { INTERNAL_API_BASE_PATH } from './constants'; +import { RoleCredentials } from '../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export function SvlEnrichPoliciesApi({ getService }: FtrProviderContext) { + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const svlCommonApi = getService('svlCommonApi'); + + const getAllEnrichPolicies = async (roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .get(`${INTERNAL_API_BASE_PATH}/enrich_policies`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + const executeEnrichPolicy = async (name: string, roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .put(`${INTERNAL_API_BASE_PATH}/enrich_policies/${name}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + const removeEnrichPolicy = async (name: string, roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .delete(`${INTERNAL_API_BASE_PATH}/enrich_policies/${name}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + return { + getAllEnrichPolicies, + removeEnrichPolicy, + executeEnrichPolicy, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_enrich_policies.helpers.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_enrich_policies.helpers.ts new file mode 100644 index 0000000000000..c2e8b20c5bb88 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_enrich_policies.helpers.ts @@ -0,0 +1,49 @@ +/* + * 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 { FtrProviderContext } from '../../ftr_provider_context'; + +export function SvlEnrichPoliciesHelpers({ getService }: FtrProviderContext) { + const es = getService('es'); + + const createEnrichPolicy = async (policyName: string, indexName: string) => { + await es.enrich.putPolicy({ + name: policyName, + match: { + match_field: 'email', + enrich_fields: ['firstName'], + indices: [indexName], + }, + }); + }; + + const createIndex = async (indexName: string) => { + await es.indices.create({ + index: indexName, + mappings: { + properties: { + email: { + type: 'text', + }, + firstName: { + type: 'text', + }, + }, + }, + }); + }; + + const deleteIndex = async (indexName: string) => { + await es.indices.delete({ index: indexName }); + }; + + return { + createEnrichPolicy, + createIndex, + deleteIndex, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_indices.api.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_indices.api.ts new file mode 100644 index 0000000000000..93f523494a2dc --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_indices.api.ts @@ -0,0 +1,88 @@ +/* + * 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 { API_BASE_PATH } from './constants'; +import { RoleCredentials } from '../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export function SvlIndicesApi({ getService }: FtrProviderContext) { + const svlCommonApi = getService('svlCommonApi'); + const supertestWithoutAuth = getService('supertestWithoutAuth'); + + const executeActionOnIndices = + (roleAuthc: RoleCredentials) => + async ({ + index, + urlParam, + args, + }: { + index?: string | string[]; + urlParam: string; + args?: any; + }) => { + const indices = Array.isArray(index) ? index : [index]; + + return await supertestWithoutAuth + .post(`${API_BASE_PATH}/indices/${urlParam}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ indices, ...args }); + }; + + const closeIndex = async (index: string, roleAuthc: RoleCredentials) => + await executeActionOnIndices(roleAuthc)({ index, urlParam: 'close' }); + + const openIndex = async (index: string, roleAuthc: RoleCredentials) => + await executeActionOnIndices(roleAuthc)({ index, urlParam: 'open' }); + + const deleteIndex = async (roleAuthc: RoleCredentials, index?: string) => + await executeActionOnIndices(roleAuthc)({ index, urlParam: 'delete' }); + + const flushIndex = async (index: string, roleAuthc: RoleCredentials) => + await executeActionOnIndices(roleAuthc)({ index, urlParam: 'flush' }); + + const refreshIndex = async (index: string, roleAuthc: RoleCredentials) => + await executeActionOnIndices(roleAuthc)({ index, urlParam: 'refresh' }); + + const forceMerge = async ( + index: string, + roleAuthc: RoleCredentials, + args?: { maxNumSegments: number } + ) => await executeActionOnIndices(roleAuthc)({ index, urlParam: 'forcemerge', args }); + + const unfreeze = async (index: string, roleAuthc: RoleCredentials) => + await executeActionOnIndices(roleAuthc)({ index, urlParam: 'unfreeze' }); + + const clearCache = async (index: string, roleAuthc: RoleCredentials) => + await executeActionOnIndices(roleAuthc)({ index, urlParam: 'clear_cache' }); + + const list = async (roleAuthc: RoleCredentials) => + supertestWithoutAuth + .get(`${API_BASE_PATH}/indices`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + const reload = async (roleAuthc: RoleCredentials, indexNames?: string[]) => + await supertestWithoutAuth + .post(`${API_BASE_PATH}/indices/reload`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ indexNames }); + + return { + closeIndex, + openIndex, + deleteIndex, + flushIndex, + refreshIndex, + forceMerge, + unfreeze, + list, + reload, + clearCache, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_indices.helpers.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_indices.helpers.ts new file mode 100644 index 0000000000000..4be1d12d0619a --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_indices.helpers.ts @@ -0,0 +1,35 @@ +/* + * 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 { getRandomString } from './svl_random'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export function SvlIndicesHelpers({ getService }: FtrProviderContext) { + const es = getService('es'); + const esDeleteAllIndices = getService('esDeleteAllIndices'); + + let indicesCreated: string[] = []; + + const createIndex = async (index: string = getRandomString(), mappings?: any) => { + indicesCreated.push(index); + await es.indices.create({ index, mappings }); + return index; + }; + + const deleteAllIndices = async () => { + await esDeleteAllIndices(indicesCreated); + indicesCreated = []; + }; + + const catIndex = (index?: string, h?: any) => + es.cat.indices({ index, format: 'json', h }, { meta: true }); + + const indexStats = (index: string, metric: string) => + es.indices.stats({ index, metric }, { meta: true }); + + return { createIndex, deleteAllIndices, catIndex, indexStats }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_mappings.api.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_mappings.api.ts new file mode 100644 index 0000000000000..7c82319eebb1b --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_mappings.api.ts @@ -0,0 +1,33 @@ +/* + * 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 { API_BASE_PATH } from './constants'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; + +export function SvlMappingsApi({ getService }: FtrProviderContext) { + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const svlCommonApi = getService('svlCommonApi'); + + const getMapping = async (index: string, roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .get(`${API_BASE_PATH}/mapping/${index}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + const updateMappings = async (index: string, roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .put(`${API_BASE_PATH}/mapping/${index}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ name: { type: 'text' } }); + + return { + getMapping, + updateMappings, + }; +} diff --git a/x-pack/platform/test/serverless/services/index.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_random.ts similarity index 52% rename from x-pack/platform/test/serverless/services/index.ts rename to x-pack/platform/test/serverless/api_integration/services/index_management/svl_random.ts index 8e1ed515bd2b4..9c8a4cc5ff9d3 100644 --- a/x-pack/platform/test/serverless/services/index.ts +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_random.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { services as deploymentAgnosticServices } from '../../api_integration_deployment_agnostic/services'; +import Chance from 'chance'; -export const services = { - ...deploymentAgnosticServices, - // Add any additional serverless-specific services here -}; +const chance = new Chance(); +const CHARS_POOL = 'abcdefghijklmnopqrstuvwxyz'; + +export const getRandomString = () => `${chance.string({ pool: CHARS_POOL })}-${Date.now()}`; diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_settings.api.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_settings.api.ts new file mode 100644 index 0000000000000..aca8c659c7952 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_settings.api.ts @@ -0,0 +1,38 @@ +/* + * 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 { IndexSettings } from '@kbn/index-management-plugin/common'; +import { RoleCredentials } from '../../../shared/services'; +import { API_BASE_PATH } from './constants'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export function SvlSettingsApi({ getService }: FtrProviderContext) { + const svlCommonApi = getService('svlCommonApi'); + const supertestWithoutAuth = getService('supertestWithoutAuth'); + + const getIndexSettings = async (index: string, roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .get(`${API_BASE_PATH}/settings/${index}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + const updateIndexSettings = async ( + index: string, + settings: IndexSettings, + roleAuthc: RoleCredentials + ) => + await supertestWithoutAuth + .put(`${API_BASE_PATH}/settings/${index}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send(settings); + + return { + getIndexSettings, + updateIndexSettings, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_templates.api.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_templates.api.ts new file mode 100644 index 0000000000000..5960bfdd87e8e --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_templates.api.ts @@ -0,0 +1,84 @@ +/* + * 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 { TemplateDeserialized, TemplateSerialized } from '@kbn/index-management-plugin/common'; +import { API_BASE_PATH } from './constants'; +import { RoleCredentials } from '../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export function SvlTemplatesApi({ getService }: FtrProviderContext) { + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const svlCommonApi = getService('svlCommonApi'); + + let templatesCreated: Array<{ name: string; isLegacy?: boolean }> = []; + + const getAllTemplates = (roleAuthc: RoleCredentials) => + supertestWithoutAuth + .get(`${API_BASE_PATH}/index_templates`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader); + + const getOneTemplate = (name: string, isLegacy: boolean = false) => + supertestWithoutAuth.get(`${API_BASE_PATH}/index_templates/${name}?legacy=${isLegacy}`); + + const createTemplate = (template: TemplateDeserialized, roleAuthc: RoleCredentials) => { + templatesCreated.push({ name: template.name, isLegacy: template._kbnMeta.isLegacy }); + return supertestWithoutAuth + .post(`${API_BASE_PATH}/index_templates`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send(template); + }; + + const deleteTemplates = async ( + templates: Array<{ name: string; isLegacy?: boolean }>, + roleAuthc: RoleCredentials + ) => + await supertestWithoutAuth + .post(`${API_BASE_PATH}/delete_index_templates`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ templates }); + + const updateTemplate = async ( + payload: TemplateDeserialized, + templateName: string, + roleAuthc: RoleCredentials + ) => + await supertestWithoutAuth + .put(`${API_BASE_PATH}/index_templates/${templateName}`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send(payload); + + // Delete all templates created during tests + const cleanUpTemplates = async (roleAuthc: RoleCredentials) => { + try { + await deleteTemplates(templatesCreated, roleAuthc); + templatesCreated = []; + } catch (e) { + // Silently swallow errors + } + }; + + const simulateTemplate = async (payload: TemplateSerialized, roleAuthc: RoleCredentials) => + await supertestWithoutAuth + .post(`${API_BASE_PATH}/index_templates/simulate`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send(payload); + + return { + getAllTemplates, + getOneTemplate, + createTemplate, + updateTemplate, + deleteTemplates, + cleanUpTemplates, + simulateTemplate, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/index_management/svl_templates.helpers.ts b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_templates.helpers.ts new file mode 100644 index 0000000000000..abe940276d0ba --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/index_management/svl_templates.helpers.ts @@ -0,0 +1,99 @@ +/* + * 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 { + TemplateDeserialized, + TemplateSerialized, + IndexMode, +} from '@kbn/index-management-plugin/common'; +import { INDEX_PATTERNS } from './constants'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +const templateMock = { + settings: {}, + mappings: { + properties: { + host_name: { + type: 'keyword', + }, + created_at: { + type: 'date', + format: 'EEE MMM dd HH:mm:ss Z yyyy', + }, + }, + }, + aliases: { + alias1: {}, + }, +}; + +const getTemplateMock = (isMappingsSourceFieldEnabled: boolean) => { + if (isMappingsSourceFieldEnabled) { + return { + ...templateMock, + mappings: { + ...templateMock.mappings, + _source: { + enabled: false, + }, + }, + }; + } + return templateMock; +}; + +export function SvlTemplatesHelpers({ getService }: FtrProviderContext) { + const es = getService('es'); + + const catTemplate = (name: string) => es.cat.templates({ name, format: 'json' }, { meta: true }); + + const getTemplatePayload = ( + name: string, + indexPatterns: string[] = INDEX_PATTERNS, + isLegacy: boolean = false, + isMappingsSourceFieldEnabled: boolean = true, + indexMode?: IndexMode + ) => { + const baseTemplate: TemplateDeserialized = { + name, + indexPatterns, + indexMode, + version: 1, + template: { ...getTemplateMock(isMappingsSourceFieldEnabled) }, + _kbnMeta: { + isLegacy, + type: 'default', + hasDatastream: false, + }, + allowAutoCreate: 'NO_OVERWRITE', + }; + + if (isLegacy) { + baseTemplate.order = 1; + } else { + baseTemplate.priority = 1; + } + + return baseTemplate; + }; + + const getSerializedTemplate = ( + indexPatterns: string[] = INDEX_PATTERNS, + isMappingsSourceFieldEnabled: boolean = true + ): TemplateSerialized => { + return { + index_patterns: indexPatterns, + template: { ...getTemplateMock(isMappingsSourceFieldEnabled) }, + }; + }; + + return { + catTemplate, + getTemplatePayload, + getSerializedTemplate, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/saml_tools.ts b/x-pack/platform/test/serverless/api_integration/services/saml_tools.ts new file mode 100644 index 0000000000000..925f963f1223e --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/saml_tools.ts @@ -0,0 +1,44 @@ +/* + * 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 { parse as parseCookie } from 'tough-cookie'; +import Url from 'url'; + +import { createSAMLResponse } from '@kbn/mock-idp-utils'; +import { FtrProviderContext } from '../ftr_provider_context'; + +export function SamlToolsProvider({ getService }: FtrProviderContext) { + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const svlCommonApi = getService('svlCommonApi'); + const config = getService('config'); + + return { + async login(username: string) { + const kibanaUrl = Url.format({ + protocol: config.get('servers.kibana.protocol'), + hostname: config.get('servers.kibana.hostname'), + port: config.get('servers.kibana.port'), + pathname: '/api/security/saml/callback', + }); + const samlAuthenticationResponse = await supertestWithoutAuth + .post('/api/security/saml/callback') + .set(svlCommonApi.getCommonRequestHeader()) + .send({ + SAMLResponse: await createSAMLResponse({ + username, + roles: [], + kibanaUrl, + }), + }); + expect(samlAuthenticationResponse.status).to.equal(302); + expect(samlAuthenticationResponse.header.location).to.equal('/'); + const sessionCookie = parseCookie(samlAuthenticationResponse.header['set-cookie'][0])!; + return { Cookie: sessionCookie.cookieString() }; + }, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/svl_cases/api.ts b/x-pack/platform/test/serverless/api_integration/services/svl_cases/api.ts new file mode 100644 index 0000000000000..2e3cdab5a48cc --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/svl_cases/api.ts @@ -0,0 +1,214 @@ +/* + * 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 { CASES_URL } from '@kbn/cases-plugin/common'; +import { Case, CaseSeverity, CaseStatuses } from '@kbn/cases-plugin/common/types/domain'; +import type { CasePostRequest } from '@kbn/cases-plugin/common/types/api'; +import { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; +import { CasesFindResponse } from '@kbn/cases-plugin/common/types/api'; +import { kbnTestConfig, kibanaTestSuperuserServerless } from '@kbn/test'; +import type { RoleCredentials } from '../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export interface User { + username: string; + password: string; + description?: string; + roles: string[]; +} + +export function SvlCasesApiServiceProvider({ getService }: FtrProviderContext) { + const kbnServer = getService('kibanaServer'); + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const svlCommonApi = getService('svlCommonApi'); + + const defaultUser = { + email: null, + full_name: null, + username: kbnTestConfig.getUrlParts(kibanaTestSuperuserServerless).username, + }; + + /** + * A null filled user will occur when the security plugin is disabled + */ + const nullUser = { email: null, full_name: null, username: null }; + + const findCommon = { + page: 1, + per_page: 20, + total: 0, + count_open_cases: 0, + count_closed_cases: 0, + count_in_progress_cases: 0, + }; + + const findCasesResp: CasesFindResponse = { + ...findCommon, + cases: [], + }; + + return { + getSpaceUrlPrefix(spaceId: string | undefined | null) { + return spaceId && spaceId !== 'default' ? `/s/${spaceId}` : ``; + }, + + async deleteAllCaseItems() { + await Promise.all([ + this.deleteCases(), + this.deleteCasesUserActions(), + this.deleteComments(), + this.deleteConfiguration(), + this.deleteMappings(), + ]); + }, + + async deleteCasesUserActions(): Promise { + await kbnServer.savedObjects.clean({ types: ['cases-user-actions'] }); + }, + + async deleteCases(): Promise { + await kbnServer.savedObjects.clean({ types: ['cases'] }); + }, + + async deleteComments(): Promise { + await kbnServer.savedObjects.clean({ types: ['cases-comments'] }); + }, + + async deleteConfiguration(): Promise { + await kbnServer.savedObjects.clean({ types: ['cases-configure'] }); + }, + + async deleteMappings(): Promise { + await kbnServer.savedObjects.clean({ types: ['cases-connector-mappings'] }); + }, + + /** + * Return a request for creating a case. + */ + getPostCaseRequest(owner: string, req?: Partial): CasePostRequest { + return { + ...this.getPostCaseReq(owner), + ...req, + }; + }, + + postCaseResp(owner: string, id?: string | null, req?: CasePostRequest): Partial { + const request = req ?? this.getPostCaseReq(owner); + return { + ...request, + ...(id != null ? { id } : {}), + comments: [], + duration: null, + severity: request.severity ?? CaseSeverity.LOW, + totalAlerts: 0, + totalComment: 0, + closed_by: null, + created_by: defaultUser, + external_service: null, + status: CaseStatuses.open, + updated_by: null, + category: null, + customFields: [], + observables: [], + }; + }, + + async createCase( + params: CasePostRequest, + roleAuthc: RoleCredentials, + expectedHttpCode: number = 200 + ): Promise { + const apiCall = supertestWithoutAuth.post(`${CASES_URL}`); + + const response = await apiCall + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send(params) + .expect(expectedHttpCode); + + return response.body; + }, + + async findCases( + { + query = {}, + expectedHttpCode = 200, + space = 'default', + }: { + query?: Record; + expectedHttpCode?: number; + space?: string; + }, + roleAuthc: RoleCredentials + ): Promise { + const { body: res } = await supertestWithoutAuth + .get(`${this.getSpaceUrlPrefix(space)}${CASES_URL}/_find`) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .query({ sortOrder: 'asc', ...query }) + .send() + .expect(expectedHttpCode); + + return res; + }, + + async getCase( + { + caseId, + space = 'default', + expectedHttpCode = 200, + includeComments, + }: { + caseId: string; + space?: string; + expectedHttpCode?: number; + includeComments?: boolean; + }, + roleAuthc: RoleCredentials + ): Promise { + const basePath = `${this.getSpaceUrlPrefix(space)}${CASES_URL}/${caseId}`; + const path = + includeComments != null ? `${basePath}?includeComments=${includeComments}` : basePath; + + const { body: theCase } = await supertestWithoutAuth + .get(path) + .set(svlCommonApi.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .expect(expectedHttpCode); + + return theCase; + }, + + getFindCasesResp() { + return findCasesResp; + }, + + getPostCaseReq(owner: string): CasePostRequest { + return { + description: 'This is a brand new case of a bad meanie defacing data', + title: 'Super Bad Observability Issue', + tags: ['defacement'], + severity: CaseSeverity.LOW, + connector: { + id: 'none', + name: 'none', + type: ConnectorTypes.none, + fields: null, + }, + settings: { + syncAlerts: true, + }, + owner, + assignees: [], + }; + }, + + getNullUser() { + return nullUser; + }, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/svl_cases/index.ts b/x-pack/platform/test/serverless/api_integration/services/svl_cases/index.ts new file mode 100644 index 0000000000000..31b372e7442b3 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/svl_cases/index.ts @@ -0,0 +1,21 @@ +/* + * 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 { FtrProviderContext } from '../../ftr_provider_context'; + +import { SvlCasesApiServiceProvider } from './api'; +import { SvlCasesOmitServiceProvider } from './omit'; + +export function SvlCasesServiceProvider(context: FtrProviderContext) { + const api = SvlCasesApiServiceProvider(context); + const omit = SvlCasesOmitServiceProvider(context); + + return { + api, + omit, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/svl_cases/omit.ts b/x-pack/platform/test/serverless/api_integration/services/svl_cases/omit.ts new file mode 100644 index 0000000000000..eccda4c891dd8 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/svl_cases/omit.ts @@ -0,0 +1,53 @@ +/* + * 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 { Case, Attachment } from '@kbn/cases-plugin/common/types/domain'; +import { omit } from 'lodash'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export interface CommonSavedObjectAttributes { + id?: string | null; + created_at?: string | null; + updated_at?: string | null; + version?: string | null; + [key: string]: unknown; +} + +export function SvlCasesOmitServiceProvider({}: FtrProviderContext) { + const savedObjectCommonAttributes = ['created_at', 'updated_at', 'version', 'id']; + + return { + removeServerGeneratedPropertiesFromObject( + object: T, + keys: K[] + ): Omit { + return omit(object, keys); + }, + + removeServerGeneratedPropertiesFromSavedObject( + attributes: T, + keys: Array = [] + ): Omit { + return this.removeServerGeneratedPropertiesFromObject(attributes, [ + ...savedObjectCommonAttributes, + ...keys, + ]); + }, + + removeServerGeneratedPropertiesFromCase(theCase: Case): Partial { + return this.removeServerGeneratedPropertiesFromSavedObject(theCase, ['closed_at']); + }, + + removeServerGeneratedPropertiesFromComments( + comments: Attachment[] | undefined + ): Array> | undefined { + return comments?.map((comment) => { + return this.removeServerGeneratedPropertiesFromSavedObject(comment, []); + }); + }, + }; +} diff --git a/x-pack/platform/test/serverless/api_integration/services/synthtrace.ts b/x-pack/platform/test/serverless/api_integration/services/synthtrace.ts new file mode 100644 index 0000000000000..39c842237eb6b --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/services/synthtrace.ts @@ -0,0 +1,61 @@ +/* + * 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 { Client } from '@elastic/elasticsearch'; +import { + ApmSynthtraceEsClient, + ApmSynthtraceKibanaClient, + createLogger, + LogLevel, +} from '@kbn/apm-synthtrace'; +import url, { format, UrlObject } from 'url'; +import { FtrProviderContext } from '../ftr_provider_context'; + +async function getSynthtraceEsClient(client: Client, kibanaClient: ApmSynthtraceKibanaClient) { + const kibanaVersion = await kibanaClient.fetchLatestApmPackageVersion(); + await kibanaClient.installApmPackage(kibanaVersion); + + const esClient = new ApmSynthtraceEsClient({ + client, + logger: createLogger(LogLevel.info), + version: kibanaVersion, + refreshAfterIndex: true, + }); + + return esClient; +} + +function getSynthtraceKibanaClient(kibanaServerUrl: string) { + const kibanaServerUrlWithAuth = url + .format({ + ...url.parse(kibanaServerUrl), + }) + .slice(0, -1); + + const kibanaClient = new ApmSynthtraceKibanaClient({ + target: kibanaServerUrlWithAuth, + logger: createLogger(LogLevel.debug), + }); + + return kibanaClient; +} + +export function SynthtraceProvider({ getService }: FtrProviderContext) { + const es = getService('es'); + const config = getService('config'); + + const servers = config.get('servers'); + const kibanaServer = servers.kibana as UrlObject; + const kibanaServerUrl = format(kibanaServer); + const synthtraceKibanaClient = getSynthtraceKibanaClient(kibanaServerUrl); + + return { + createSynthtraceKibanaClient: getSynthtraceKibanaClient, + async createSynthtraceEsClient() { + return getSynthtraceEsClient(es, synthtraceKibanaClient); + }, + }; +} diff --git a/x-pack/test_serverless/api_integration/test_suites/common/alerting/alert_documents.ts b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/alert_documents.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/alerting/alert_documents.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/alerting/alert_documents.ts index 04b091d7db399..ad29b859cad9d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/alerting/alert_documents.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/alert_documents.ts @@ -42,9 +42,9 @@ import { ALERT_PREVIOUS_ACTION_GROUP, ALERT_PENDING_RECOVERED_COUNT, } from '@kbn/rule-data-utils'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { ObjectRemover } from '../../../../shared/lib'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { ObjectRemover } from './object_remover'; +import { RoleCredentials } from '../../../shared/services'; const OPEN_OR_ACTIVE = new Set(['open', 'active']); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/alerting/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/index.ts similarity index 89% rename from x-pack/test_serverless/api_integration/test_suites/common/alerting/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/alerting/index.ts index 9585819a7ffe6..dc1f494a3674f 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/alerting/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Alerting APIs', function () { diff --git a/x-pack/platform/test/serverless/api_integration/test_suites/alerting/object_remover.ts b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/object_remover.ts new file mode 100644 index 0000000000000..ef43c70d0ee49 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/object_remover.ts @@ -0,0 +1,82 @@ +/* + * 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 { Agent as SuperTestAgent } from 'supertest'; + +import { getUrlPathPrefixForSpace } from './space_path_prefix'; + +interface ObjectToRemove { + spaceId: string; + id: string; + type: string; + plugin: string; + isInternal?: boolean; +} + +export class ObjectRemover { + private readonly supertest: SuperTestAgent; + private objectsToRemove: ObjectToRemove[] = []; + + constructor(supertest: SuperTestAgent) { + this.supertest = supertest; + } + + /** + * Add a saved object to the collection. It will be deleted as + * + * DELETE [/s/{spaceId}]/[api|internal]/{plugin}/{type}/{id} + * + * @param spaceId The space ID + * @param id The saved object ID + * @param type The saved object type + * @param plugin The plugin name + * @param isInternal Whether the saved object is internal or not (default false/external) + */ + add( + spaceId: ObjectToRemove['spaceId'], + id: ObjectToRemove['id'], + type: ObjectToRemove['type'], + plugin: ObjectToRemove['plugin'], + isInternal?: ObjectToRemove['isInternal'] + ) { + this.objectsToRemove.push({ spaceId, id, type, plugin, isInternal }); + } + + async removeAll() { + await Promise.all( + this.objectsToRemove.map(({ spaceId, id, type, plugin, isInternal }) => { + const url = `${getUrlPathPrefixForSpace(spaceId)}/${ + isInternal ? 'internal' : 'api' + }/${plugin}/${type}/${id}`; + return deleteObject({ supertest: this.supertest, url, plugin }); + }) + ); + this.objectsToRemove = []; + } +} + +interface DeleteObjectParams { + supertest: SuperTestAgent; + url: string; + plugin: string; +} + +async function deleteObject({ supertest, url, plugin }: DeleteObjectParams) { + const result = await supertest + .delete(url) + .set('kbn-xsrf', 'foo') + .set('x-elastic-internal-origin', 'foo'); + + if (plugin === 'saved_objects' && result.status === 200) return; + if (plugin !== 'saved_objects' && result.status === 204) return; + + // eslint-disable-next-line no-console + console.log( + `ObjectRemover: unexpected status deleting ${url}: ${result.status}`, + result.body.text + ); +} diff --git a/x-pack/test_serverless/api_integration/test_suites/common/alerting/rules.ts b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/rules.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/alerting/rules.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/alerting/rules.ts index 593c10f371f09..cb6755a58c6a6 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/alerting/rules.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/rules.ts @@ -8,8 +8,8 @@ import { RULE_SAVED_OBJECT_TYPE } from '@kbn/alerting-plugin/server'; import expect from '@kbn/expect'; import { omit } from 'lodash'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import type { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import type { InternalRequestHeader, RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); diff --git a/x-pack/platform/test/serverless/api_integration/test_suites/alerting/space_path_prefix.ts b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/space_path_prefix.ts new file mode 100644 index 0000000000000..adf7cbdfb0df4 --- /dev/null +++ b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/space_path_prefix.ts @@ -0,0 +1,10 @@ +/* + * 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. + */ + +export function getUrlPathPrefixForSpace(spaceId: string) { + return spaceId && spaceId !== 'default' ? `/s/${spaceId}` : ``; +} diff --git a/x-pack/test_serverless/api_integration/test_suites/common/alerting/summary_actions.ts b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/summary_actions.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/alerting/summary_actions.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/alerting/summary_actions.ts index 084fa6d68a90d..6bf659972271e 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/alerting/summary_actions.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/alerting/summary_actions.ts @@ -29,8 +29,8 @@ import { ALERT_PENDING_RECOVERED_COUNT, } from '@kbn/rule-data-utils'; import { omit, padStart } from 'lodash'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts b/x-pack/platform/test/serverless/api_integration/test_suites/console/autocomplete_entities.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/console/autocomplete_entities.ts index 3ec162ad28ffd..4c88a18910a83 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/console/autocomplete_entities.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../shared/services'; export default ({ getService }: FtrProviderContext) => { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/console/es_config.ts b/x-pack/platform/test/serverless/api_integration/test_suites/console/es_config.ts similarity index 93% rename from x-pack/test_serverless/api_integration/test_suites/common/console/es_config.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/console/es_config.ts index 894101a40bc9c..3fce01116b4e5 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/console/es_config.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/console/es_config.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/console/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/console/index.ts similarity index 90% rename from x-pack/test_serverless/api_integration/test_suites/common/console/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/console/index.ts index ba086579cc12c..95aaa05617844 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/console/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/console/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Console APIs', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/console/proxy_route.ts b/x-pack/platform/test/serverless/api_integration/test_suites/console/proxy_route.ts similarity index 91% rename from x-pack/test_serverless/api_integration/test_suites/common/console/proxy_route.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/console/proxy_route.ts index 4c774d566bac7..0e08747f5e004 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/console/proxy_route.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/console/proxy_route.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/console/spec_definitions.ts b/x-pack/platform/test/serverless/api_integration/test_suites/console/spec_definitions.ts similarity index 90% rename from x-pack/test_serverless/api_integration/test_suites/common/console/spec_definitions.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/console/spec_definitions.ts index be6659ba9f05d..37a1abcc33da1 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/console/spec_definitions.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/console/spec_definitions.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/core/capabilities.ts b/x-pack/platform/test/serverless/api_integration/test_suites/core/capabilities.ts similarity index 91% rename from x-pack/test_serverless/api_integration/test_suites/common/core/capabilities.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/core/capabilities.ts index 68118e872e8f6..30e6b020822bd 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/core/capabilities.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/core/capabilities.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/core/compression.ts b/x-pack/platform/test/serverless/api_integration/test_suites/core/compression.ts similarity index 92% rename from x-pack/test_serverless/api_integration/test_suites/common/core/compression.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/core/compression.ts index 72f09e634ddf8..274d2be7e0699 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/core/compression.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/core/compression.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/core/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/core/index.ts similarity index 90% rename from x-pack/test_serverless/api_integration/test_suites/common/core/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/core/index.ts index 1e5cba0f7afb0..9374574981a9f 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/core/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/core/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('core', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/core/saved_objects.ts b/x-pack/platform/test/serverless/api_integration/test_suites/core/saved_objects.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/core/saved_objects.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/core/saved_objects.ts index b4f4f1779b306..54895122b270d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/core/saved_objects.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/core/saved_objects.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/core/translations.ts b/x-pack/platform/test/serverless/api_integration/test_suites/core/translations.ts similarity index 92% rename from x-pack/test_serverless/api_integration/test_suites/common/core/translations.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/core/translations.ts index bd348d27915c1..c8ecf6be47a40 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/core/translations.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/core/translations.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/core/ui_settings.ts b/x-pack/platform/test/serverless/api_integration/test_suites/core/ui_settings.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/core/ui_settings.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/core/ui_settings.ts index dd8744d18740e..79e33ca2998b9 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/core/ui_settings.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/core/ui_settings.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; // To test setting validations we are using the existing 'defaultColumns' setting that is available in all serverless projects // (See list of common serverless settings in /src/platform/packages/private/serverless/settings/common/index.ts) diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/index.ts similarity index 89% rename from x-pack/test_serverless/api_integration/test_suites/common/data_usage/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_usage/index.ts index b0236e8dab722..db4d46b8edd20 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Serverless Data Usage APIs', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/mock_api.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/mock_api.ts similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/data_usage/mock_api.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_usage/mock_api.ts diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/mock_data.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/mock_data.ts similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/data_usage/mock_data.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_usage/mock_data.ts diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/tests/data_streams.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/tests/data_streams.ts similarity index 94% rename from x-pack/test_serverless/api_integration/test_suites/common/data_usage/tests/data_streams.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_usage/tests/data_streams.ts index 322a568bdd6c6..c8f38c19caa88 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/tests/data_streams.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/tests/data_streams.ts @@ -8,8 +8,8 @@ import expect from '@kbn/expect'; import { DataStreamsResponseBodySchemaBody } from '@kbn/data-usage-plugin/common/rest_types'; import { DATA_USAGE_DATA_STREAMS_API_ROUTE } from '@kbn/data-usage-plugin/common'; -import { SupertestWithRoleScopeType } from '../../../../services'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../../services'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const svlDatastreamsHelpers = getService('svlDatastreamsHelpers'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/tests/data_streams_privileges.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/tests/data_streams_privileges.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/data_usage/tests/data_streams_privileges.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_usage/tests/data_streams_privileges.ts index 5c50b4acb8d0a..b5c39d7bfc054 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/tests/data_streams_privileges.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/tests/data_streams_privileges.ts @@ -13,7 +13,7 @@ import { NoIndicesMeteringError, NoPrivilegeMeteringError, } from '@kbn/data-usage-plugin/server/errors'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const svlDatastreamsHelpers = getService('svlDatastreamsHelpers'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/tests/metrics.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/tests/metrics.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/data_usage/tests/metrics.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_usage/tests/metrics.ts index 8dc7480023fe8..ed9dad350e4de 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_usage/tests/metrics.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_usage/tests/metrics.ts @@ -11,8 +11,8 @@ import http from 'http'; import { UsageMetricsRequestBody } from '@kbn/data-usage-plugin/common/rest_types'; import { DATA_USAGE_METRICS_API_ROUTE } from '@kbn/data-usage-plugin/common'; import { transformMetricsData } from '@kbn/data-usage-plugin/server/routes/internal/usage_metrics_handler'; -import { SupertestWithRoleScopeType } from '../../../../services'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../../services'; +import { FtrProviderContext } from '../../../ftr_provider_context'; import { setupMockServer } from '../mock_api'; import { mockAutoOpsResponse } from '../mock_data'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_view_field_editor/field_preview.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_view_field_editor/field_preview.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_view_field_editor/field_preview.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_view_field_editor/field_preview.ts index 270d6bfabdf06..2423c22d82349 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_view_field_editor/field_preview.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_view_field_editor/field_preview.ts @@ -13,8 +13,8 @@ import { FIELD_PREVIEW_PATH, INITIAL_REST_VERSION, } from '@kbn/data-view-field-editor-plugin/common/constants'; -import type { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import type { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; const INDEX_NAME = 'api-integration-test-field-preview'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_view_field_editor/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_view_field_editor/index.ts similarity index 86% rename from x-pack/test_serverless/api_integration/test_suites/common/data_view_field_editor/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_view_field_editor/index.ts index 7998f8b63f92c..182dee9244a61 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_view_field_editor/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_view_field_editor/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('index pattern field editor', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/constants.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/constants.ts similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/constants.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/constants.ts diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/create_data_view/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/create_data_view/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/create_data_view/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/create_data_view/index.ts index b4955e4947bae..4b04c0d03df28 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/create_data_view/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/create_data_view/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('create_index_pattern', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/create_data_view/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/create_data_view/main.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/create_data_view/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/create_data_view/main.ts index fb7afadb585c3..3b5185f933c0e 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/create_data_view/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/create_data_view/main.ts @@ -6,9 +6,9 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/create_data_view/validation.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/create_data_view/validation.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/create_data_view/validation.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/create_data_view/validation.ts index 8dbf1dd62bdb0..4d07e0641edce 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/create_data_view/validation.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/create_data_view/validation.ts @@ -6,9 +6,9 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/delete_data_view/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/delete_data_view/errors.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/delete_data_view/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/delete_data_view/errors.ts index ed74b952e27f5..64e03936cf8d8 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/delete_data_view/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/delete_data_view/errors.ts @@ -6,9 +6,9 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/delete_data_view/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/delete_data_view/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/delete_data_view/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/delete_data_view/index.ts index 42eec1aaa1704..de6910c9efb22 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/delete_data_view/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/delete_data_view/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('delete_index_pattern', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/delete_data_view/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/delete_data_view/main.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/delete_data_view/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/delete_data_view/main.ts index 2195340f2ec07..0333f64a1c1bf 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/delete_data_view/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/delete_data_view/main.ts @@ -8,8 +8,8 @@ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { INITIAL_REST_VERSION } from '@kbn/data-views-plugin/server/constants'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_view/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_view/errors.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_view/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_view/errors.ts index 980b6aba3a2c6..8a2050e46dfc7 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_view/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_view/errors.ts @@ -6,9 +6,9 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_view/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_view/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_view/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_view/index.ts index 63cb32bd2f868..49c42c6ef0373 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_view/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_view/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('get_index_pattern', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_view/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_view/main.ts similarity index 94% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_view/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_view/main.ts index 19d60a53a9055..03a00cd125816 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_view/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_view/main.ts @@ -6,9 +6,9 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; -import { RoleCredentials, InternalRequestHeader } from '../../../../../../shared/services'; +import { RoleCredentials, InternalRequestHeader } from '../../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_views/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_views/index.ts similarity index 83% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_views/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_views/index.ts index eec88c71b32c6..eab6cefe2beb2 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_views/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_views/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('get_data_views', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_views/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_views/main.ts similarity index 93% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_views/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_views/main.ts index 94a5c3e3adf8d..48377df472d70 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/get_data_views/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/get_data_views/main.ts @@ -6,9 +6,9 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { dataViewConfig } from '../../constants'; -import { RoleCredentials, InternalRequestHeader } from '../../../../../../shared/services'; +import { RoleCredentials, InternalRequestHeader } from '../../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/index.ts similarity index 89% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/index.ts index 2cf06c123af57..d68e6afaab7a5 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('index_pattern_crud', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/update_data_view/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/update_data_view/errors.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/update_data_view/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/update_data_view/errors.ts index 764a1bcdf4dea..9189c8b5347f7 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/update_data_view/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/update_data_view/errors.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { RoleCredentials, InternalRequestHeader } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { RoleCredentials, InternalRequestHeader } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/update_data_view/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/update_data_view/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/update_data_view/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/update_data_view/index.ts index 9e821943a31e3..cde98704a59f2 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/update_data_view/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/update_data_view/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('update_index_pattern', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/update_data_view/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/update_data_view/main.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/update_data_view/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/update_data_view/main.ts index b5596c93d908d..4571a2842f627 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/data_views_crud/update_data_view/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/data_views_crud/update_data_view/main.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { RoleCredentials, InternalRequestHeader } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { RoleCredentials, InternalRequestHeader } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/default_index_pattern/default_index_pattern.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/default_index_pattern/default_index_pattern.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/default_index_pattern/default_index_pattern.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/default_index_pattern/default_index_pattern.ts index 0be2332eb6209..2e5a86f7021fc 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/default_index_pattern/default_index_pattern.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/default_index_pattern/default_index_pattern.ts @@ -6,9 +6,9 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; import { configArray } from '../constants'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/default_index_pattern/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/default_index_pattern/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/default_index_pattern/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/default_index_pattern/index.ts index 94d73e6141b08..a7b3f169a315d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/default_index_pattern/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/default_index_pattern/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('default index pattern', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/es_errors/errors.js b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/es_errors/errors.js similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/es_errors/errors.js rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/es_errors/errors.js diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/es_errors/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/es_errors/index.ts similarity index 84% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/es_errors/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/es_errors/index.ts index 3fc4c06262100..e2f548e10075f 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/es_errors/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/es_errors/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('index_patterns/service/lib', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/es_errors/lib/get_es_errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/es_errors/lib/get_es_errors.ts similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/es_errors/lib/get_es_errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/es_errors/lib/get_es_errors.ts diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/es_errors/lib/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/es_errors/lib/index.ts similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/es_errors/lib/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/es_errors/lib/index.ts diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/existing_indices_route/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/existing_indices_route/index.ts similarity index 86% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/existing_indices_route/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/existing_indices_route/index.ts index 9b0dcc33d9615..b01f70f4e6565 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/existing_indices_route/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/existing_indices_route/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('index_patterns/_existing_indices route', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/existing_indices_route/params.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/existing_indices_route/params.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/existing_indices_route/params.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/existing_indices_route/params.ts index cb9d2620f38ed..1ba43b60252a4 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/existing_indices_route/params.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/existing_indices_route/params.ts @@ -8,8 +8,8 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/constants'; import { EXISTING_INDICES_PATH } from '@kbn/data-views-plugin/common/constants'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/existing_indices_route/response.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/existing_indices_route/response.ts similarity index 95% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/existing_indices_route/response.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/existing_indices_route/response.ts index 7d774196d125f..8c4974a0d139d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/existing_indices_route/response.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/existing_indices_route/response.ts @@ -8,8 +8,8 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/constants'; import { EXISTING_INDICES_PATH } from '@kbn/data-views-plugin/common/constants'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/index.ts similarity index 84% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/index.ts index 0fcf5454e7eba..53b2e2e069edd 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('fields_api', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/update_fields/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/update_fields/errors.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/update_fields/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/update_fields/errors.ts index 97d2d2150ceab..802caa40d85d0 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/update_fields/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/update_fields/errors.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { RoleCredentials, InternalRequestHeader } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { RoleCredentials, InternalRequestHeader } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/swap_references/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/update_fields/index.ts similarity index 92% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/swap_references/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/update_fields/index.ts index fc3c15d0d473a..76da56664b95c 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/swap_references/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/update_fields/index.ts @@ -8,7 +8,7 @@ import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { - describe('swap_references', () => { + describe('update_fields', () => { loadTestFile(require.resolve('./errors')); loadTestFile(require.resolve('./main')); }); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/update_fields/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/update_fields/main.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/update_fields/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/update_fields/main.ts index d31c23e2ef842..d8307f997f16f 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/update_fields/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_api/update_fields/main.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/conflicts.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/conflicts.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/conflicts.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/conflicts.ts index 14463383a7dab..0ff86a833bfed 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/conflicts.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/conflicts.ts @@ -9,8 +9,8 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/constants'; import { FIELDS_FOR_WILDCARD_PATH } from '@kbn/data-views-plugin/common/constants'; import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/filter.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/filter.ts similarity index 95% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/filter.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/filter.ts index 6e9bccbf4a53c..01bae516b61f8 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/filter.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/filter.ts @@ -9,8 +9,8 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/constants'; import { FIELDS_FOR_WILDCARD_PATH } from '@kbn/data-views-plugin/common/constants'; import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const es = getService('es'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/index.ts similarity index 88% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/index.ts index a64ddadf2f7a2..f4567a55e8efb 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('index_patterns/_fields_for_wildcard route', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/params.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/params.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/params.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/params.ts index 827d0a7bc7b6b..f97717ea030f7 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/params.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/params.ts @@ -8,8 +8,8 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/constants'; import { FIELDS_FOR_WILDCARD_PATH } from '@kbn/data-views-plugin/common/constants'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/response.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/response.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/response.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/response.ts index 43685a4a9b81d..ba298c8854c18 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_for_wildcard_route/response.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/fields_for_wildcard_route/response.ts @@ -10,8 +10,8 @@ import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/con import { FIELDS_FOR_WILDCARD_PATH } from '@kbn/data-views-plugin/common/constants'; import expect from '@kbn/expect'; import { sortBy } from 'lodash'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/has_user_index_pattern/has_user_index_pattern.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/has_user_index_pattern/has_user_index_pattern.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/has_user_index_pattern/has_user_index_pattern.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/has_user_index_pattern/has_user_index_pattern.ts index 96bd55b6374bf..3a927d5ae0404 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/has_user_index_pattern/has_user_index_pattern.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/has_user_index_pattern/has_user_index_pattern.ts @@ -11,9 +11,9 @@ import { INITIAL_REST_VERSION_INTERNAL, } from '@kbn/data-views-plugin/server/constants'; import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; import { configArray } from '../constants'; -import { RoleCredentials, InternalRequestHeader } from '../../../../../shared/services'; +import { RoleCredentials, InternalRequestHeader } from '../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/has_user_index_pattern/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/has_user_index_pattern/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/has_user_index_pattern/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/has_user_index_pattern/index.ts index 4ec3661feffde..02c6c8064b61f 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/has_user_index_pattern/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/has_user_index_pattern/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('has user index pattern', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/index.ts similarity index 94% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/index.ts index 5a2623a8b7c43..d9e550bb8460d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('index_patterns', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/integration/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/integration/index.ts similarity index 86% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/integration/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/integration/index.ts index 55a9585ee7f1f..0279fc8744fd1 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/integration/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/integration/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; /** * Test usage of different index patterns APIs in combination diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/integration/integration.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/integration/integration.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/integration/integration.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/integration/integration.ts index ed2a649f626f2..7af5e594a40d9 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/integration/integration.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/integration/integration.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; import _ from 'lodash'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; /** * Test usage of different index patterns APIs in combination diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/create_runtime_field/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/create_runtime_field/errors.ts similarity index 95% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/create_runtime_field/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/create_runtime_field/errors.ts index 229a4c1067a31..26eba9bce420a 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/create_runtime_field/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/create_runtime_field/errors.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/create_runtime_field/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/create_runtime_field/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/create_runtime_field/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/create_runtime_field/index.ts index 226a2026ef945..7b15085d5e4db 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/create_runtime_field/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/create_runtime_field/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('create_runtime_field', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/create_runtime_field/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/create_runtime_field/main.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/create_runtime_field/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/create_runtime_field/main.ts index 5f57da9727f03..2b5b7f9dfe279 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/create_runtime_field/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/create_runtime_field/main.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/delete_runtime_field/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/delete_runtime_field/errors.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/delete_runtime_field/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/delete_runtime_field/errors.ts index f4bed270c4407..64dfb749dcb12 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/delete_runtime_field/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/delete_runtime_field/errors.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/delete_runtime_field/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/delete_runtime_field/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/delete_runtime_field/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/delete_runtime_field/index.ts index 434c986417696..3a82d46237748 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/delete_runtime_field/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/delete_runtime_field/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('delete_runtime_field', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/delete_runtime_field/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/delete_runtime_field/main.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/delete_runtime_field/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/delete_runtime_field/main.ts index 83e2f054ec5cc..b4246b113bda7 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/delete_runtime_field/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/delete_runtime_field/main.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/get_runtime_field/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/get_runtime_field/errors.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/get_runtime_field/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/get_runtime_field/errors.ts index 91d19932bf869..bcc85d6658520 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/get_runtime_field/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/get_runtime_field/errors.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/get_runtime_field/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/get_runtime_field/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/get_runtime_field/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/get_runtime_field/index.ts index 7f22ba407e651..b222b1ab84ebb 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/get_runtime_field/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/get_runtime_field/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('get_runtime_field', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/get_runtime_field/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/get_runtime_field/main.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/get_runtime_field/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/get_runtime_field/main.ts index d6ed01c246807..605856d23b4e5 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/get_runtime_field/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/get_runtime_field/main.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/index.ts similarity index 89% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/index.ts index 5b95e3b39dcf4..dffa721afea4d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('runtime_fields_crud', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/put_runtime_field/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/put_runtime_field/errors.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/put_runtime_field/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/put_runtime_field/errors.ts index 3578fa048d27a..7c064122c2afd 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/put_runtime_field/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/put_runtime_field/errors.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { RoleCredentials, InternalRequestHeader } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { RoleCredentials, InternalRequestHeader } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/put_runtime_field/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/put_runtime_field/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/put_runtime_field/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/put_runtime_field/index.ts index 85f3c93570a06..989066177c605 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/put_runtime_field/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/put_runtime_field/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('put_runtime_field', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/put_runtime_field/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/put_runtime_field/main.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/put_runtime_field/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/put_runtime_field/main.ts index c466c28e52c8a..948873bafeab6 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/put_runtime_field/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/put_runtime_field/main.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/update_runtime_field/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/update_runtime_field/errors.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/update_runtime_field/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/update_runtime_field/errors.ts index a693c756f363e..325da73aff64a 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/update_runtime_field/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/update_runtime_field/errors.ts @@ -6,9 +6,9 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/update_runtime_field/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/update_runtime_field/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/update_runtime_field/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/update_runtime_field/index.ts index d60fcf7f047a1..dbacc90699ce3 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/update_runtime_field/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/update_runtime_field/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('update_runtime_field', () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/update_runtime_field/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/update_runtime_field/main.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/update_runtime_field/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/update_runtime_field/main.ts index f58e27f5c4a78..e1839c3d4ae4e 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/runtime_fields_crud/update_runtime_field/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/runtime_fields_crud/update_runtime_field/main.ts @@ -8,8 +8,8 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { INITIAL_REST_VERSION } from '@kbn/data-views-plugin/server/constants'; import expect from '@kbn/expect'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { configArray } from '../../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/swap_references/errors.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/swap_references/errors.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/swap_references/errors.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/swap_references/errors.ts index 29f3fa424f0e2..31f4ec4cb32c6 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/swap_references/errors.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/swap_references/errors.ts @@ -8,8 +8,8 @@ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { INITIAL_REST_VERSION } from '@kbn/data-views-plugin/server/constants'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; import { dataViewConfig } from '../constants'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/update_fields/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/swap_references/index.ts similarity index 78% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/update_fields/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/swap_references/index.ts index a716524e8ba22..f527c63e478e3 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/fields_api/update_fields/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/swap_references/index.ts @@ -5,10 +5,10 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { - describe('update_fields', () => { + describe('swap_references', () => { loadTestFile(require.resolve('./errors')); loadTestFile(require.resolve('./main')); }); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/data_views/swap_references/main.ts b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/swap_references/main.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/data_views/swap_references/main.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/data_views/swap_references/main.ts index 01465714df768..0b4c730e1f436 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/data_views/swap_references/main.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/data_views/swap_references/main.ts @@ -13,8 +13,8 @@ import { } from '@kbn/data-views-plugin/server'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { INITIAL_REST_VERSION } from '@kbn/data-views-plugin/server/constants'; -import type { FtrProviderContext } from '../../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../../shared/services'; +import type { FtrProviderContext } from '../../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/elasticsearch_api/home.ts b/x-pack/platform/test/serverless/api_integration/test_suites/elasticsearch_api/home.ts similarity index 90% rename from x-pack/test_serverless/api_integration/test_suites/common/elasticsearch_api/home.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/elasticsearch_api/home.ts index 1008378140d64..052a071be3850 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/elasticsearch_api/home.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/elasticsearch_api/home.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esSupertest = getService('esSupertest'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/elasticsearch_api/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/elasticsearch_api/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/elasticsearch_api/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/elasticsearch_api/index.ts index aafab33abb587..1940f5fe3c885 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/elasticsearch_api/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/elasticsearch_api/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Elasticsearch API', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/favorites/dashboard.ts b/x-pack/platform/test/serverless/api_integration/test_suites/favorites/dashboard.ts similarity index 95% rename from x-pack/test_serverless/api_integration/test_suites/common/favorites/dashboard.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/favorites/dashboard.ts index 05ad57aadbf18..d720d319a7363 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/favorites/dashboard.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/favorites/dashboard.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const roleScopedSupertest = getService('roleScopedSupertest'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/favorites/esql.ts b/x-pack/platform/test/serverless/api_integration/test_suites/favorites/esql.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/favorites/esql.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/favorites/esql.ts index 4dfb92273a410..25fb27c1cabd9 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/favorites/esql.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/favorites/esql.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const roleScopedSupertest = getService('roleScopedSupertest'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/favorites/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/favorites/index.ts similarity index 86% rename from x-pack/test_serverless/api_integration/test_suites/common/favorites/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/favorites/index.ts index 684f88f6ac973..d5834cbab95ba 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/favorites/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/favorites/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Favorites API', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/grok_debugger/grok_debugger.ts b/x-pack/platform/test/serverless/api_integration/test_suites/grok_debugger/grok_debugger.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/grok_debugger/grok_debugger.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/grok_debugger/grok_debugger.ts index b0ad1dbc8e45b..64189a60f1265 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/grok_debugger/grok_debugger.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/grok_debugger/grok_debugger.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; const API_BASE_PATH = '/api/grokdebugger'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/grok_debugger/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/grok_debugger/index.ts similarity index 86% rename from x-pack/test_serverless/api_integration/test_suites/common/grok_debugger/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/grok_debugger/index.ts index 25f6258b394dc..4ab22e26931b0 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/grok_debugger/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/grok_debugger/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Grok Debugger API', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/cluster_nodes.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/cluster_nodes.ts similarity index 88% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/cluster_nodes.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/cluster_nodes.ts index 6179cbfd4b56f..9bbce904e555d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/cluster_nodes.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/cluster_nodes.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlClusterNodesApi = getService('svlClusterNodesApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/create_enrich_policies.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/create_enrich_policies.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/create_enrich_policies.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/create_enrich_policies.ts index 908679fbeab40..cebf33c8434e9 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/create_enrich_policies.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/create_enrich_policies.ts @@ -6,8 +6,8 @@ */ import expect from 'expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; const INTERNAL_API_BASE_PATH = '/internal/index_management'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/datastreams.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/datastreams.ts index 03e63968bc1e3..ebafb002d91b3 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/datastreams.ts @@ -8,8 +8,8 @@ import expect from '@kbn/expect'; import { DataStream } from '@kbn/index-management-plugin/common'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../shared/services'; const API_BASE_PATH = '/api/index_management'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/enrich_policies.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/enrich_policies.ts similarity index 95% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/enrich_policies.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/enrich_policies.ts index fbcc232dc030d..e6e0dfdbbd16c 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/enrich_policies.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/enrich_policies.ts @@ -6,8 +6,8 @@ */ import expect from 'expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const log = getService('log'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/index.ts similarity index 93% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/index.ts index 7564c891ef509..61ec4f45b92ce 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Serverless Index Management APIs', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/index_component_templates.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/index_component_templates.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/index_component_templates.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/index_component_templates.ts index 512dec7f4a856..933aa0bf62bc3 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/index_component_templates.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/index_component_templates.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; const CACHE_TEMPLATES = true; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/index_templates.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/index_templates.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/index_templates.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/index_templates.ts index 1b58588e45d82..94a817c560b6f 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/index_templates.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/index_templates.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import type { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import type { InternalRequestHeader, RoleCredentials } from '../../../shared/services'; const API_BASE_PATH = '/api/index_management'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/indices.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/indices.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/indices.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/indices.ts index cba7b6557a80b..1ebb2503238f6 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/indices.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/indices.ts @@ -6,9 +6,9 @@ */ import expect from '@kbn/expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { RoleCredentials } from '../../../../shared/services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { RoleCredentials } from '../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; const INTERNAL_API_BASE_PATH = '/internal/index_management'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/mappings.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/mappings.ts similarity index 93% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/mappings.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/mappings.ts index 148d22e382cb8..ca0e8a0c9e786 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/mappings.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/mappings.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const log = getService('log'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/settings.ts b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/settings.ts similarity index 94% rename from x-pack/test_serverless/api_integration/test_suites/common/index_management/settings.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/index_management/settings.ts index a2c10a39a3859..740c537c9a7a7 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/settings.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/index_management/settings.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/kql_telemetry/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/kql_telemetry/index.ts similarity index 85% rename from x-pack/test_serverless/api_integration/test_suites/common/kql_telemetry/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/kql_telemetry/index.ts index 8a832ef82169e..fa2c71ed6f8fb 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/kql_telemetry/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/kql_telemetry/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('KQL', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/kql_telemetry/kql_telemetry.ts b/x-pack/platform/test/serverless/api_integration/test_suites/kql_telemetry/kql_telemetry.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/kql_telemetry/kql_telemetry.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/kql_telemetry/kql_telemetry.ts index bc742f6d9d1ad..6bfc962aa0226 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/kql_telemetry/kql_telemetry.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/kql_telemetry/kql_telemetry.ts @@ -10,8 +10,8 @@ import { get } from 'lodash'; import { ANALYTICS_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server'; import { KQL_TELEMETRY_ROUTE_LATEST_VERSION } from '@kbn/data-plugin/common'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; -import { SupertestWithRoleScopeType } from '../../../services'; -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/management/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/management/index.ts similarity index 88% rename from x-pack/test_serverless/api_integration/test_suites/common/management/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/management/index.ts index 7694845a4ed0f..3c90812bbc537 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/management/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/management/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Management', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/management/rollups.ts b/x-pack/platform/test/serverless/api_integration/test_suites/management/rollups.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/management/rollups.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/management/rollups.ts index 43b0cc45e8985..299e1793103b4 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/management/rollups.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/management/rollups.ts @@ -11,8 +11,8 @@ import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/con import { X_ELASTIC_INTERNAL_ORIGIN_REQUEST } from '@kbn/core-http-common/src/constants'; import { FIELDS_FOR_WILDCARD_PATH as BASE_URI } from '@kbn/data-views-plugin/common/constants'; import { DataViewType } from '@kbn/data-views-plugin/common'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/management/scripted_fields.ts b/x-pack/platform/test/serverless/api_integration/test_suites/management/scripted_fields.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/management/scripted_fields.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/management/scripted_fields.ts index 3209722a95768..04ae5dce357b3 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/management/scripted_fields.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/management/scripted_fields.ts @@ -7,8 +7,8 @@ import expect from 'expect'; import { DATA_VIEW_PATH } from '@kbn/data-views-plugin/server'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/management/spaces.ts b/x-pack/platform/test/serverless/api_integration/test_suites/management/spaces.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/management/spaces.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/management/spaces.ts index f3a583237455a..86ff9929dab7f 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/management/spaces.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/management/spaces.ts @@ -7,8 +7,8 @@ import expect from 'expect'; import { asyncForEach } from '@kbn/std'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/painless_lab/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/painless_lab/index.ts similarity index 86% rename from x-pack/test_serverless/api_integration/test_suites/common/painless_lab/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/painless_lab/index.ts index b3316533be703..9ca44f6fa8eac 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/painless_lab/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/painless_lab/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Painless Lab API', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/painless_lab/painless_lab.ts b/x-pack/platform/test/serverless/api_integration/test_suites/painless_lab/painless_lab.ts similarity index 94% rename from x-pack/test_serverless/api_integration/test_suites/common/painless_lab/painless_lab.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/painless_lab/painless_lab.ts index 34e5a275fe9fe..9c0ec7dddb714 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/painless_lab/painless_lab.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/painless_lab/painless_lab.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; const API_BASE_PATH = '/api/painless_lab'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/anonymous.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/anonymous.ts similarity index 91% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/anonymous.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/anonymous.ts index c63ada30a9137..d06da34eaf95d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/anonymous.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/anonymous.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/api_keys.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/api_keys.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/api_keys.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/api_keys.ts index d1bbe4b5e505e..a196a1123d3c0 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/api_keys.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/api_keys.ts @@ -6,8 +6,8 @@ */ import expect from 'expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { let roleMapping: { id: string; name: string; api_key: string; encoded: string }; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/authentication.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/authentication.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/authentication.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/authentication.ts index 7233318dda59e..748cc4f3e109b 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/authentication.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/authentication.ts @@ -6,8 +6,8 @@ */ import expect from 'expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const roleScopedSupertest = getService('roleScopedSupertest'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/authentication_http.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/authentication_http.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/authentication_http.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/authentication_http.ts index 6c7e939a3b6b0..c316ac09eb6a8 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/authentication_http.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/authentication_http.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/authorization.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/authorization.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/authorization.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/authorization.ts index 34134b8abdf40..c919adbe5c296 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/authorization.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/authorization.ts @@ -8,8 +8,8 @@ import expect from 'expect'; import { KibanaFeatureConfig, SubFeaturePrivilegeConfig } from '@kbn/features-plugin/common'; import type { Role } from '@kbn/security-plugin-types-common'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; /* * This file contains authorization tests that... diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/encrypted_saved_objects.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/encrypted_saved_objects.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/encrypted_saved_objects.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/encrypted_saved_objects.ts index d392fce85df02..1c9a7df321129 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/encrypted_saved_objects.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/encrypted_saved_objects.ts @@ -6,8 +6,8 @@ */ import expect from 'expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { InternalRequestHeader, RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/feature_check.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/feature_check.ts similarity index 88% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/feature_check.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/feature_check.ts index a552aade6ab25..be457fb583e7c 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/feature_check.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/feature_check.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/index.ts similarity index 94% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/index.ts index e5f3f4a86a923..5dd3f24c7d5bb 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('serverless common API', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/misc.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/misc.ts similarity index 94% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/misc.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/misc.ts index 93dd03bab4013..b34e16102ac35 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/misc.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/misc.ts @@ -6,8 +6,8 @@ */ import expect from 'expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/response_headers.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/response_headers.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/response_headers.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/response_headers.ts index 8f915f6bd822f..a82ab2c55551b 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/response_headers.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/response_headers.ts @@ -7,8 +7,8 @@ import expect from 'expect'; import cspParser from 'content-security-policy-parser'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const samlAuth = getService('samlAuth'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/role_mappings.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/role_mappings.ts similarity index 94% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/role_mappings.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/role_mappings.ts index 6b6595c1dc2c5..100ca19f5e4f6 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/role_mappings.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/role_mappings.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/sessions.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/sessions.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/sessions.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/sessions.ts index 741b71115076b..7db41fee3eb56 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/sessions.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/sessions.ts @@ -6,8 +6,8 @@ */ import expect from 'expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const samlAuth = getService('samlAuth'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/user_profiles.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/user_profiles.ts similarity index 94% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/user_profiles.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/user_profiles.ts index 46f5c8755c28c..a81a2b98479da 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/user_profiles.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/user_profiles.ts @@ -7,8 +7,8 @@ import expect from 'expect'; import { kibanaTestUser } from '@kbn/test'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const samlTools = getService('samlTools'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/users.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/users.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/users.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/users.ts index 86e0ea273bd7f..e345213da1217 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/users.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/users.ts @@ -6,8 +6,8 @@ */ import expect from 'expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const samlAuth = getService('samlAuth'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/views.ts b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/views.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/platform_security/views.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/platform_security/views.ts index fc6060c98fb17..66aa3843f6a00 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/platform_security/views.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/platform_security/views.ts @@ -6,8 +6,8 @@ */ import expect from 'expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/reporting/__snapshots__/csv_v2_esql.snap b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/__snapshots__/csv_v2_esql.snap similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/reporting/__snapshots__/csv_v2_esql.snap rename to x-pack/platform/test/serverless/api_integration/test_suites/reporting/__snapshots__/csv_v2_esql.snap diff --git a/x-pack/test_serverless/api_integration/test_suites/common/reporting/__snapshots__/generate_csv_discover.snap b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/__snapshots__/generate_csv_discover.snap similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/reporting/__snapshots__/generate_csv_discover.snap rename to x-pack/platform/test/serverless/api_integration/test_suites/reporting/__snapshots__/generate_csv_discover.snap diff --git a/x-pack/test_serverless/api_integration/test_suites/common/reporting/csv_v2_esql.ts b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/csv_v2_esql.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/reporting/csv_v2_esql.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/reporting/csv_v2_esql.ts index 3ae6759d3148f..031083e04a4f2 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/reporting/csv_v2_esql.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/csv_v2_esql.ts @@ -12,7 +12,7 @@ import { DISCOVER_APP_LOCATOR } from '@kbn/discover-plugin/common'; import { CookieCredentials, InternalRequestHeader } from '@kbn/ftr-common-functional-services'; import type { ReportApiJSON } from '@kbn/reporting-common/types'; import type { JobParamsCsvFromSavedObject } from '@kbn/reporting-export-types-csv-common'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { const es = getService('es'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/reporting/datastream.ts b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/datastream.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/reporting/datastream.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/reporting/datastream.ts index 3ca89009d2be3..38fbb23ddf063 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/reporting/datastream.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/datastream.ts @@ -11,7 +11,7 @@ import { InternalRequestHeader, RoleCredentials, } from '@kbn/ftr-common-functional-services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/reporting/generate_csv_discover.ts b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/generate_csv_discover.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/reporting/generate_csv_discover.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/reporting/generate_csv_discover.ts index 3ab3037bdb359..3fd65e9805dbf 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/reporting/generate_csv_discover.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/generate_csv_discover.ts @@ -10,7 +10,7 @@ import type { SortDirection } from '@kbn/data-plugin/common'; import type { JobParamsCSV } from '@kbn/reporting-export-types-csv-common'; import type { Filter } from '@kbn/es-query'; import { CookieCredentials, InternalRequestHeader } from '@kbn/ftr-common-functional-services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/reporting/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/index.ts similarity index 89% rename from x-pack/test_serverless/api_integration/test_suites/common/reporting/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/reporting/index.ts index fe5dd868216ab..1088625cdb6e4 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/reporting/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ loadTestFile }: FtrProviderContext) => { describe('Reporting', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/reporting/management.ts b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/management.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/reporting/management.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/reporting/management.ts index f3c918eace419..d7c845e1d9819 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/reporting/management.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/reporting/management.ts @@ -9,7 +9,7 @@ import expect from '@kbn/expect'; import { INTERNAL_ROUTES } from '@kbn/reporting-common'; import type { ReportApiJSON } from '@kbn/reporting-common/types'; import type { CookieCredentials, InternalRequestHeader } from '@kbn/ftr-common-functional-services'; -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; const API_HEADER: [string, string] = ['kbn-xsrf', 'reporting']; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/find.ts b/x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/find.ts similarity index 98% rename from x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/find.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/find.ts index 6e098f46f4258..edc3e5bd9836c 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/find.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/find.ts @@ -5,8 +5,8 @@ * 2.0. */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/index.ts similarity index 89% rename from x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/index.ts index 9a0b49d5fc8e8..c410f1c96cda9 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('saved objects management apis', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/relationships.ts b/x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/relationships.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/relationships.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/relationships.ts index dc06e47f8b02a..07886f5f4e857 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/relationships.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/relationships.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; import { schema } from '@kbn/config-schema'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const svlCommonApi = getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/scroll_count.ts b/x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/scroll_count.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/scroll_count.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/scroll_count.ts index b5bd070655f78..50427c39c1cbc 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/saved_objects_management/scroll_count.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/saved_objects_management/scroll_count.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; const apiUrl = '/api/kibana/management/saved_objects/scroll/counts'; const defaultTypes = ['visualization', 'index-pattern', 'search', 'dashboard']; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/scripts_tests/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/scripts_tests/index.ts similarity index 89% rename from x-pack/test_serverless/api_integration/test_suites/common/scripts_tests/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/scripts_tests/index.ts index 29776682a2a35..4c59913d1e9d4 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/scripts_tests/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/scripts_tests/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { // TODO: The `scripts` folder was renamed to `scripts_tests` because the folder diff --git a/x-pack/test_serverless/api_integration/test_suites/common/scripts_tests/languages.ts b/x-pack/platform/test/serverless/api_integration/test_suites/scripts_tests/languages.ts similarity index 92% rename from x-pack/test_serverless/api_integration/test_suites/common/scripts_tests/languages.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/scripts_tests/languages.ts index 02afd0e02dd53..0a0196cec6d9c 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/scripts_tests/languages.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/scripts_tests/languages.ts @@ -9,8 +9,8 @@ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { SCRIPT_LANGUAGES_ROUTE_LATEST_VERSION } from '@kbn/data-plugin/common/constants'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const roleScopedSupertest = getService('roleScopedSupertest'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/search_oss/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/search_oss/index.ts similarity index 90% rename from x-pack/test_serverless/api_integration/test_suites/common/search_oss/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/search_oss/index.ts index 50299ed81a444..736d4a70763ee 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/search_oss/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/search_oss/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { // TODO: This `search` folder was renamed to `search_oss` to diff --git a/x-pack/test_serverless/api_integration/test_suites/common/search_oss/painless_err_req.ts b/x-pack/platform/test/serverless/api_integration/test_suites/search_oss/painless_err_req.ts similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/search_oss/painless_err_req.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/search_oss/painless_err_req.ts diff --git a/x-pack/test_serverless/api_integration/test_suites/common/search_oss/search.ts b/x-pack/platform/test/serverless/api_integration/test_suites/search_oss/search.ts similarity index 97% rename from x-pack/test_serverless/api_integration/test_suites/common/search_oss/search.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/search_oss/search.ts index 157837c89f0d9..4a8811a79ab46 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/search_oss/search.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/search_oss/search.ts @@ -7,8 +7,8 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import expect from '@kbn/expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import type { FtrProviderContext } from '../../ftr_provider_context'; import { painlessErrReq } from './painless_err_req'; import { verifyErrorResponse } from './verify_error'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/search_oss/verify_error.ts b/x-pack/platform/test/serverless/api_integration/test_suites/search_oss/verify_error.ts similarity index 100% rename from x-pack/test_serverless/api_integration/test_suites/common/search_oss/verify_error.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/search_oss/verify_error.ts diff --git a/x-pack/test_serverless/api_integration/test_suites/common/search_profiler/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/search_profiler/index.ts similarity index 87% rename from x-pack/test_serverless/api_integration/test_suites/common/search_profiler/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/search_profiler/index.ts index 1df060c658629..b947f351036bf 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/search_profiler/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/search_profiler/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Search profiler APIs', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/search_profiler/search_profiler.ts b/x-pack/platform/test/serverless/api_integration/test_suites/search_profiler/search_profiler.ts similarity index 93% rename from x-pack/test_serverless/api_integration/test_suites/common/search_profiler/search_profiler.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/search_profiler/search_profiler.ts index 6ccc81de5bd71..695135c6b9e8a 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/search_profiler/search_profiler.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/search_profiler/search_profiler.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { RoleCredentials } from '../../../shared/services'; const API_BASE_PATH = '/api/searchprofiler'; diff --git a/x-pack/test_serverless/api_integration/test_suites/common/search_xpack/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/search_xpack/index.ts similarity index 90% rename from x-pack/test_serverless/api_integration/test_suites/common/search_xpack/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/search_xpack/index.ts index e832bc22d2fda..42249e7ea4c0d 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/search_xpack/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/search_xpack/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { // TODO: This `search` folder was renamed to `search_xpack` to diff --git a/x-pack/test_serverless/api_integration/test_suites/common/search_xpack/search.ts b/x-pack/platform/test/serverless/api_integration/test_suites/search_xpack/search.ts similarity index 99% rename from x-pack/test_serverless/api_integration/test_suites/common/search_xpack/search.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/search_xpack/search.ts index 57c344eca8c20..299639e3a7401 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/search_xpack/search.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/search_xpack/search.ts @@ -9,9 +9,9 @@ import expect from '@kbn/expect'; import { parse as parseCookie } from 'tough-cookie'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { omit } from 'lodash'; -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; import { verifyErrorResponse } from '../search_oss/verify_error'; -import { RoleCredentials } from '../../../../shared/services'; +import { RoleCredentials } from '../../../shared/services'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/telemetry/index.ts b/x-pack/platform/test/serverless/api_integration/test_suites/telemetry/index.ts similarity index 87% rename from x-pack/test_serverless/api_integration/test_suites/common/telemetry/index.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/telemetry/index.ts index 691074318d224..fc70750ff9f52 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/telemetry/index.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/telemetry/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('telemetry', function () { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/telemetry/snapshot_telemetry.ts b/x-pack/platform/test/serverless/api_integration/test_suites/telemetry/snapshot_telemetry.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/telemetry/snapshot_telemetry.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/telemetry/snapshot_telemetry.ts index c9349c7b63899..2abb80142580f 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/telemetry/snapshot_telemetry.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/telemetry/snapshot_telemetry.ts @@ -21,9 +21,9 @@ import xpackSecurityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin import xpackChatTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_chat.json'; import { assertTelemetryPayload } from '@kbn/telemetry-tools'; import type { TelemetrySchemaObject } from '@kbn/telemetry-tools/src/schema_ftr_validations/schema_to_config_schema'; -import type { UsageStatsPayloadTestFriendly } from '../../../../shared/services/usage_api'; -import type { RoleCredentials } from '../../../../shared/services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import type { UsageStatsPayloadTestFriendly } from '../../../../api_integration/services/usage_api'; +import type { RoleCredentials } from '../../../shared/services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const usageApi = getService('usageAPI'); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/telemetry/telemetry_config.ts b/x-pack/platform/test/serverless/api_integration/test_suites/telemetry/telemetry_config.ts similarity index 96% rename from x-pack/test_serverless/api_integration/test_suites/common/telemetry/telemetry_config.ts rename to x-pack/platform/test/serverless/api_integration/test_suites/telemetry/telemetry_config.ts index 36d362fb55a92..16d4643db9df8 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/telemetry/telemetry_config.ts +++ b/x-pack/platform/test/serverless/api_integration/test_suites/telemetry/telemetry_config.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; import { expect as externalExpect } from 'expect'; -import { SupertestWithRoleScopeType } from '../../../services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../services'; +import { FtrProviderContext } from '../../ftr_provider_context'; export default function telemetryConfigTest({ getService }: FtrProviderContext) { const roleScopedSupertest = getService('roleScopedSupertest'); diff --git a/x-pack/platform/test/serverless/common/package_registry_config.yml b/x-pack/platform/test/serverless/shared/common/package_registry_config.yml similarity index 100% rename from x-pack/platform/test/serverless/common/package_registry_config.yml rename to x-pack/platform/test/serverless/shared/common/package_registry_config.yml diff --git a/x-pack/platform/test/serverless/config.base.ts b/x-pack/platform/test/serverless/shared/config.base.ts similarity index 98% rename from x-pack/platform/test/serverless/config.base.ts rename to x-pack/platform/test/serverless/shared/config.base.ts index b279f5a38327c..6e83e7cb213e3 100644 --- a/x-pack/platform/test/serverless/config.base.ts +++ b/x-pack/platform/test/serverless/shared/config.base.ts @@ -50,9 +50,9 @@ export default async () => { // "Fake" SAML provider const idpPath = resolve( __dirname, - '../security_api_integration/plugins/saml_provider/metadata.xml' + '../../security_api_integration/plugins/saml_provider/metadata.xml' ); - const samlIdPPlugin = resolve(__dirname, '../security_api_integration/plugins/saml_provider'); + const samlIdPPlugin = resolve(__dirname, '../../security_api_integration/plugins/saml_provider'); const jwksPath = require.resolve('@kbn/security-api-integration-helpers/oidc/jwks.json'); diff --git a/x-pack/platform/test/serverless/shared/ftr_provider_context.d.ts b/x-pack/platform/test/serverless/shared/ftr_provider_context.d.ts new file mode 100644 index 0000000000000..aa56557c09df8 --- /dev/null +++ b/x-pack/platform/test/serverless/shared/ftr_provider_context.d.ts @@ -0,0 +1,12 @@ +/* + * 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 { GenericFtrProviderContext } from '@kbn/test'; + +import { services } from './services'; + +export type FtrProviderContext = GenericFtrProviderContext; diff --git a/x-pack/platform/test/serverless/shared/services/alerting_api.ts b/x-pack/platform/test/serverless/shared/services/alerting_api.ts new file mode 100644 index 0000000000000..575ef9cf29faf --- /dev/null +++ b/x-pack/platform/test/serverless/shared/services/alerting_api.ts @@ -0,0 +1,1214 @@ +/* + * 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 type { + AggregationsAggregate, + QueryDslQueryContainer, + SearchResponse, +} from '@elastic/elasticsearch/lib/api/types'; +import { RoleCredentials } from '@kbn/ftr-common-functional-services'; +import { errors, type Client } from '@elastic/elasticsearch'; +import type { TryWithRetriesOptions } from '@kbn/ftr-common-functional-services'; +import { v4 as uuidv4 } from 'uuid'; +import moment from 'moment'; +import type { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status'; +import { FtrProviderContext } from '../ftr_provider_context'; + +export interface SloBurnRateRuleParams { + sloId: string; + windows: WindowSchema[]; + dependencies?: Dependency[]; +} + +interface WindowSchema { + id: string; + burnRateThreshold: number; + maxBurnRateThreshold: number; + longWindow: Duration; + shortWindow: Duration; + actionGroup: string; +} + +interface Dependency { + ruleId: string; + actionGroupsToSuppressOn: string[]; +} + +type DurationUnit = 'm' | 'h' | 'd' | 'w' | 'M'; + +interface Duration { + value: number; + unit: DurationUnit; +} + +interface CreateEsQueryRuleParams { + size: number; + thresholdComparator: string; + threshold: number[]; + timeWindowSize?: number; + timeWindowUnit?: string; + esQuery?: string; + timeField?: string; + searchConfiguration?: unknown; + indexName?: string; + excludeHitsFromPreviousRun?: boolean; + aggType?: string; + aggField?: string; + groupBy?: string; + termField?: string; + termSize?: number; + index?: string[]; +} + +const RETRY_COUNT = 10; +const RETRY_DELAY = 1000; +const generateUniqueKey = () => uuidv4().replace(/-/g, ''); + +export function AlertingApiProvider({ getService }: FtrProviderContext) { + const samlAuth = getService('samlAuth'); + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const es = getService('es'); + const retry = getService('retry'); + const logger = getService('log'); + const config = getService('config'); + const retryTimeout = config.get('timeouts.try'); + const requestTimeout = 30 * 1000; + + const helpers = { + async waitForAlertInIndex({ + esClient, + filter, + indexName, + ruleId, + num = 1, + retryOptions = { retryCount: RETRY_COUNT, retryDelay: RETRY_DELAY }, + }: { + esClient: Client; + filter: Date; + indexName: string; + ruleId: string; + num: number; + retryOptions?: TryWithRetriesOptions; + }): Promise>> { + return await retry.tryWithRetries( + `Alerting API - waitForAlertInIndex, retryOptions: ${JSON.stringify(retryOptions)}`, + async () => { + const response = await esClient.search({ + index: indexName, + query: { + bool: { + must: [ + { + term: { + 'kibana.alert.rule.uuid': ruleId, + }, + }, + { + range: { + '@timestamp': { + gte: filter.getTime().toString(), + }, + }, + }, + ], + }, + }, + }); + if (response.hits.hits.length < num) + throw new Error(`Only found ${response.hits.hits.length} / ${num} documents`); + + return response; + }, + retryOptions + ); + }, + + async waitForDocumentInIndexForTime({ + esClient, + indexName, + ruleId, + num = 1, + sort = 'desc', + timeout = 1000, + }: { + esClient: Client; + indexName: string; + ruleId: string; + num?: number; + sort?: 'asc' | 'desc'; + timeout?: number; + }): Promise { + return await retry.tryForTime(timeout, async () => { + const response = await esClient.search({ + index: indexName, + sort: `date:${sort}`, + query: { + bool: { + must: [ + { + term: { + 'ruleId.keyword': ruleId, + }, + }, + ], + }, + }, + }); + if (response.hits.hits.length < num) { + throw new Error(`Only found ${response.hits.hits.length} / ${num} documents`); + } + return response; + }); + }, + + async waitForDocumentInIndex({ + esClient, + indexName, + ruleId, + num = 1, + sort = 'desc', + retryOptions = { retryCount: RETRY_COUNT, retryDelay: RETRY_DELAY }, + }: { + esClient: Client; + indexName: string; + ruleId: string; + num?: number; + sort?: 'asc' | 'desc'; + retryOptions?: TryWithRetriesOptions; + }): Promise { + return await retry.tryWithRetries( + `Alerting API - waitForDocumentInIndex, retryOptions: ${JSON.stringify(retryOptions)}`, + async () => { + const response = await esClient.search({ + index: indexName, + sort: `date:${sort}`, + query: { + bool: { + must: [ + { + term: { + 'ruleId.keyword': ruleId, + }, + }, + ], + }, + }, + }); + if (response.hits.hits.length < num) { + throw new Error(`Only found ${response.hits.hits.length} / ${num} documents`); + } + return response; + }, + retryOptions + ); + }, + + async createIndexConnector({ + roleAuthc, + name, + indexName, + }: { + roleAuthc: RoleCredentials; + name: string; + indexName: string; + }) { + const { body } = await supertestWithoutAuth + .post(`/api/actions/connector`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ + name, + config: { + index: indexName, + refresh: true, + }, + connector_type_id: '.index', + }) + .expect(200); + return body; + }, + + async createSlackConnector({ roleAuthc, name }: { roleAuthc: RoleCredentials; name: string }) { + const { body } = await supertestWithoutAuth + .post(`/api/actions/connector`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ + name, + config: {}, + secrets: { + webhookUrl: 'http://test', + }, + connector_type_id: '.slack', + }) + .expect(200); + return body; + }, + + async createEsQueryRule({ + roleAuthc, + name, + ruleTypeId, + params, + actions = [], + tags = [], + schedule, + consumer, + notifyWhen, + enabled = true, + expectedStatusCode = 200, + }: { + roleAuthc: RoleCredentials; + ruleTypeId: string; + name: string; + params: CreateEsQueryRuleParams; + consumer: string; + actions?: any[]; + tags?: any[]; + schedule?: { interval: string }; + notifyWhen?: string; + enabled?: boolean; + expectedStatusCode?: number; + }) { + const { body } = await supertestWithoutAuth + .post(`/api/alerting/rule`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ + enabled, + params, + consumer, + schedule: schedule || { + interval: '1h', + }, + tags, + name, + rule_type_id: ruleTypeId, + actions, + ...(notifyWhen ? { notify_when: notifyWhen, throttle: '5m' } : {}), + }) + .expect(expectedStatusCode); + return body; + }, + + async createAnomalyRule({ + roleAuthc, + name = generateUniqueKey(), + actions = [], + tags = ['foo', 'bar'], + schedule, + consumer = 'alerts', + notifyWhen, + enabled = true, + ruleTypeId = 'apm.anomaly', + params, + }: { + roleAuthc: RoleCredentials; + name?: string; + consumer?: string; + actions?: any[]; + tags?: any[]; + schedule?: { interval: string }; + notifyWhen?: string; + enabled?: boolean; + ruleTypeId?: string; + params?: any; + }) { + const { body } = await supertestWithoutAuth + .post(`/api/alerting/rule`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ + enabled, + params: params || { + anomalySeverityType: 'critical', + anomalyDetectorTypes: ['txLatency'], + environment: 'ENVIRONMENT_ALL', + windowSize: 30, + windowUnit: 'm', + }, + consumer, + schedule: schedule || { + interval: '1m', + }, + tags, + name, + rule_type_id: ruleTypeId, + actions, + ...(notifyWhen ? { notify_when: notifyWhen, throttle: '5m' } : {}), + }) + .expect(200); + return body; + }, + + async createLatencyThresholdRule({ + roleAuthc, + name = generateUniqueKey(), + actions = [], + tags = ['foo', 'bar'], + schedule, + consumer = 'apm', + notifyWhen, + enabled = true, + ruleTypeId = 'apm.transaction_duration', + params, + }: { + roleAuthc: RoleCredentials; + name?: string; + consumer?: string; + actions?: any[]; + tags?: any[]; + schedule?: { interval: string }; + notifyWhen?: string; + enabled?: boolean; + ruleTypeId?: string; + params?: any; + }) { + const { body } = await supertestWithoutAuth + .post(`/api/alerting/rule`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ + enabled, + params: params || { + aggregationType: 'avg', + environment: 'ENVIRONMENT_ALL', + threshold: 1500, + windowSize: 5, + windowUnit: 'm', + }, + consumer, + schedule: schedule || { + interval: '1m', + }, + tags, + name, + rule_type_id: ruleTypeId, + actions, + ...(notifyWhen ? { notify_when: notifyWhen, throttle: '5m' } : {}), + }); + return body; + }, + + async createInventoryRule({ + roleAuthc, + name = generateUniqueKey(), + actions = [], + tags = ['foo', 'bar'], + schedule, + consumer = 'alerts', + notifyWhen, + enabled = true, + ruleTypeId = 'metrics.alert.inventory.threshold', + params, + }: { + roleAuthc: RoleCredentials; + name?: string; + consumer?: string; + actions?: any[]; + tags?: any[]; + schedule?: { interval: string }; + notifyWhen?: string; + enabled?: boolean; + ruleTypeId?: string; + params?: any; + }) { + const { body } = await supertestWithoutAuth + .post(`/api/alerting/rule`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ + enabled, + params: params || { + nodeType: 'host', + criteria: [ + { + metric: 'cpu', + comparator: '>', + threshold: [5], + timeSize: 1, + timeUnit: 'm', + customMetric: { + type: 'custom', + id: 'alert-custom-metric', + field: '', + aggregation: 'avg', + }, + }, + ], + sourceId: 'default', + }, + consumer, + schedule: schedule || { + interval: '1m', + }, + tags, + name, + rule_type_id: ruleTypeId, + actions, + ...(notifyWhen ? { notify_when: notifyWhen, throttle: '5m' } : {}), + }) + .expect(200); + return body; + }, + + async disableRule({ roleAuthc, ruleId }: { roleAuthc: RoleCredentials; ruleId: string }) { + const { body } = await supertestWithoutAuth + .post(`/api/alerting/rule/${ruleId}/_disable`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .expect(204); + return body; + }, + + async updateEsQueryRule({ + roleAuthc, + ruleId, + updates, + }: { + roleAuthc: RoleCredentials; + ruleId: string; + updates: any; + }) { + const { body: r } = await supertestWithoutAuth + .get(`/api/alerting/rule/${ruleId}`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .expect(200); + const body = await supertestWithoutAuth + .put(`/api/alerting/rule/${ruleId}`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ + ...{ + name: r.name, + schedule: r.schedule, + throttle: r.throttle, + tags: r.tags, + params: r.params, + notify_when: r.notifyWhen, + actions: r.actions.map((action: any) => ({ + group: action.group, + params: action.params, + id: action.id, + frequency: action.frequency, + })), + }, + ...updates, + }) + .expect(200); + return body; + }, + + async runRule({ roleAuthc, ruleId }: { roleAuthc: RoleCredentials; ruleId: string }) { + const response = await supertestWithoutAuth + .post(`/internal/alerting/rule/${ruleId}/_run_soon`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .expect(204); + return response; + }, + + async waitForNumRuleRuns({ + roleAuthc, + numOfRuns, + ruleId, + esClient, + testStart, + retryOptions = { retryCount: RETRY_COUNT, retryDelay: RETRY_DELAY }, + }: { + roleAuthc: RoleCredentials; + numOfRuns: number; + ruleId: string; + esClient: Client; + testStart: Date; + retryOptions?: TryWithRetriesOptions; + }) { + for (let i = 0; i < numOfRuns; i++) { + await retry.tryWithRetries( + `Alerting API - waitForNumRuleRuns, retryOptions: ${JSON.stringify(retryOptions)}`, + async () => { + await this.runRule({ roleAuthc, ruleId }); + await this.waiting.waitForExecutionEventLog({ + esClient, + filter: testStart, + ruleId, + num: i + 1, + }); + await this.waiting.waitForAllTasksIdle({ esClient, filter: testStart }); + }, + retryOptions + ); + } + }, + + async muteRule({ roleAuthc, ruleId }: { roleAuthc: RoleCredentials; ruleId: string }) { + const { body } = await supertestWithoutAuth + .post(`/api/alerting/rule/${ruleId}/_mute_all`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .expect(204); + return body; + }, + + async enableRule({ roleAuthc, ruleId }: { roleAuthc: RoleCredentials; ruleId: string }) { + const { body } = await supertestWithoutAuth + .post(`/api/alerting/rule/${ruleId}/_enable`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .expect(204); + return body; + }, + + async muteAlert({ + roleAuthc, + ruleId, + alertId, + }: { + roleAuthc: RoleCredentials; + ruleId: string; + alertId: string; + }) { + const { body } = await supertestWithoutAuth + .post(`/api/alerting/rule/${ruleId}/alert/${alertId}/_mute`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .expect(204); + return body; + }, + + async unmuteRule({ roleAuthc, ruleId }: { roleAuthc: RoleCredentials; ruleId: string }) { + const { body } = await supertestWithoutAuth + .post(`/api/alerting/rule/${ruleId}/_unmute_all`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .expect(204); + return body; + }, + + async snoozeRule({ roleAuthc, ruleId }: { roleAuthc: RoleCredentials; ruleId: string }) { + const { body } = await supertestWithoutAuth + .post(`/internal/alerting/rule/${ruleId}/_snooze`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .send({ + snooze_schedule: { + duration: 100000000, + rRule: { + count: 1, + dtstart: moment().format(), + tzid: 'UTC', + }, + }, + }) + .expect(204); + return body; + }, + + waiting: { + async waitForDocumentInIndex({ + esClient, + indexName, + ruleId, + num = 1, + sort = 'desc', + retryOptions = { retryCount: RETRY_COUNT, retryDelay: RETRY_DELAY }, + }: { + esClient: Client; + indexName: string; + ruleId: string; + num?: number; + sort?: 'asc' | 'desc'; + retryOptions?: TryWithRetriesOptions; + }): Promise { + return await retry.tryWithRetries( + `Alerting API - waiting.waitForDocumentInIndex, retryOptions: ${JSON.stringify( + retryOptions + )}`, + async () => { + const response = await esClient.search({ + index: indexName, + sort: `date:${sort}`, + query: { + bool: { + must: [ + { + term: { + 'ruleId.keyword': ruleId, + }, + }, + ], + }, + }, + }); + if (response.hits.hits.length < num) { + throw new Error(`Only found ${response.hits.hits.length} / ${num} documents`); + } + return response; + }, + retryOptions + ); + }, + + async getDocumentsInIndex({ + esClient, + indexName, + ruleId, + }: { + esClient: Client; + indexName: string; + ruleId: string; + }): Promise { + return await esClient.search({ + index: indexName, + query: { + bool: { + must: [ + { + term: { + 'ruleId.keyword': ruleId, + }, + }, + ], + }, + }, + }); + }, + + async waitForAllTasksIdle({ + esClient, + filter, + retryOptions = { retryCount: RETRY_COUNT, retryDelay: RETRY_DELAY }, + }: { + esClient: Client; + filter: Date; + retryOptions?: TryWithRetriesOptions; + }): Promise { + return await retry.tryWithRetries( + `Alerting API - waiting.waitForAllTasksIdle, retryOptions: ${JSON.stringify( + retryOptions + )}`, + async () => { + const response = await esClient.search({ + index: '.kibana_task_manager', + query: { + bool: { + must: [ + { + terms: { + 'task.scope': ['actions', 'alerting'], + }, + }, + { + range: { + 'task.scheduledAt': { + gte: filter.getTime().toString(), + }, + }, + }, + ], + must_not: [ + { + term: { + 'task.status': 'idle', + }, + }, + ], + }, + }, + }); + if (response.hits.hits.length !== 0) { + throw new Error(`Expected 0 hits but received ${response.hits.hits.length}`); + } + return response; + }, + retryOptions + ); + }, + + async waitForExecutionEventLog({ + esClient, + filter, + ruleId, + num = 1, + retryOptions = { retryCount: RETRY_COUNT, retryDelay: RETRY_DELAY }, + }: { + esClient: Client; + filter: Date; + ruleId: string; + num?: number; + retryOptions?: TryWithRetriesOptions; + }): Promise { + return await retry.tryWithRetries( + `Alerting API - waiting.waitForExecutionEventLog, retryOptions: ${JSON.stringify( + retryOptions + )}`, + async () => { + const response = await esClient.search({ + index: '.kibana-event-log*', + query: { + bool: { + filter: [ + { + term: { + 'rule.id': { + value: ruleId, + }, + }, + }, + { + term: { + 'event.provider': { + value: 'alerting', + }, + }, + }, + { + term: { + 'event.action': 'execute', + }, + }, + { + range: { + '@timestamp': { + gte: filter.getTime().toString(), + }, + }, + }, + ], + }, + }, + }); + if (response.hits.hits.length < num) { + throw new Error('No hits found'); + } + return response; + }, + retryOptions + ); + }, + + async createIndex({ esClient, indexName }: { esClient: Client; indexName: string }) { + return await esClient.indices.create( + { + index: indexName, + }, + { meta: true } + ); + }, + + async waitForAllTasks({ + esClient, + filter, + taskType, + attempts, + retryOptions = { retryCount: RETRY_COUNT, retryDelay: RETRY_DELAY }, + }: { + esClient: Client; + filter: Date; + taskType: string; + attempts: number; + retryOptions?: TryWithRetriesOptions; + }): Promise { + return await retry.tryWithRetries( + `Alerting API - waiting.waitForAllTasks, retryOptions: ${JSON.stringify(retryOptions)}`, + async () => { + const response = await esClient.search({ + index: '.kibana_task_manager', + query: { + bool: { + must: [ + { + term: { + 'task.status': 'idle', + }, + }, + { + term: { + 'task.attempts': attempts, + }, + }, + { + terms: { + 'task.scope': ['actions', 'alerting'], + }, + }, + { + term: { + 'task.taskType': taskType, + }, + }, + { + range: { + 'task.scheduledAt': { + gte: filter.getTime().toString(), + }, + }, + }, + ], + }, + }, + }); + if (response.hits.hits.length === 0) { + throw new Error('No hits found'); + } + return response; + }, + retryOptions + ); + }, + + async waitForDisabled({ + esClient, + ruleId, + filter, + retryOptions = { retryCount: RETRY_COUNT, retryDelay: RETRY_DELAY }, + }: { + esClient: Client; + ruleId: string; + filter: Date; + retryOptions?: TryWithRetriesOptions; + }): Promise { + return await retry.tryWithRetries( + `Alerting API - waiting.waitForDisabled, retryOptions: ${JSON.stringify(retryOptions)}`, + async () => { + const response = await esClient.search({ + index: '.kibana_task_manager', + query: { + bool: { + must: [ + { + term: { + 'task.id': `task:${ruleId}`, + }, + }, + { + terms: { + 'task.scope': ['actions', 'alerting'], + }, + }, + { + range: { + 'task.scheduledAt': { + gte: filter.getTime().toString(), + }, + }, + }, + { + term: { + 'task.enabled': true, + }, + }, + ], + }, + }, + }); + if (response.hits.hits.length !== 0) { + throw new Error(`Expected 0 hits but received ${response.hits.hits.length}`); + } + return response; + }, + retryOptions + ); + }, + }, + }; + + return { + helpers, + async waitForRuleStatus({ + ruleId, + expectedStatus, + roleAuthc, + spaceId, + timeout = retryTimeout, + }: { + ruleId: string; + expectedStatus: string; + roleAuthc: RoleCredentials; + spaceId?: string; + timeout?: number; + }) { + return await retry.tryForTime(timeout, async () => { + const response = await supertestWithoutAuth + .get(`${spaceId ? '/s/' + spaceId : ''}/api/alerting/rule/${ruleId}`) + .set(roleAuthc.apiKeyHeader) + .set(samlAuth.getInternalRequestHeader()) + .timeout(requestTimeout); + const { execution_status: executionStatus } = response.body || {}; + const { status } = executionStatus || {}; + if (status !== expectedStatus) { + throw new Error(`waitForStatus(${expectedStatus}): got ${status}`); + } + return executionStatus?.status; + }); + }, + + async waitForDocumentInIndex({ + indexName, + docCountTarget = 1, + ruleId, + }: { + indexName: string; + docCountTarget?: number; + ruleId?: string; + }): Promise>> { + return await retry.tryForTime(retryTimeout, async () => { + const response = await es.search({ + index: indexName, + rest_total_hits_as_int: true, + ...(ruleId + ? { + query: { + term: { + 'kibana.alert.rule.uuid': ruleId, + }, + }, + } + : {}), + }); + logger.debug(`Found ${response.hits.total} docs, looking for at least ${docCountTarget}.`); + + if ( + !response.hits.total || + (typeof response.hits.total === 'number' + ? response.hits.total < docCountTarget + : response.hits.total.value < docCountTarget) + ) { + throw new Error('No hits or not enough hits found'); + } + + return response; + }); + }, + + async waitForAlertInIndex({ + indexName, + ruleId, + filters = [], + }: { + indexName: string; + ruleId: string; + filters?: QueryDslQueryContainer[]; + }): Promise>> { + if (!ruleId) { + throw new Error(`'ruleId' is undefined`); + } + return await retry.tryForTime(retryTimeout, async () => { + const response = await es.search({ + index: indexName, + query: { + bool: { + filter: [ + { + term: { + 'kibana.alert.rule.uuid': ruleId, + }, + }, + ...filters, + ], + }, + }, + }); + if (response.hits.hits.length === 0) { + throw new Error('No hits found'); + } + return response; + }); + }, + + async createIndexConnector({ + name, + indexName, + roleAuthc, + spaceId, + }: { + name: string; + indexName: string; + roleAuthc: RoleCredentials; + spaceId?: string; + }) { + const { body } = await supertestWithoutAuth + .post(`${spaceId ? '/s/' + spaceId : ''}/api/actions/connector`) + .set(roleAuthc.apiKeyHeader) + .set(samlAuth.getInternalRequestHeader()) + .send({ + name, + config: { + index: indexName, + refresh: true, + }, + connector_type_id: '.index', + }); + return body.id as string; + }, + + async createRule({ + name, + ruleTypeId, + params, + actions = [], + tags = [], + schedule, + consumer, + roleAuthc, + spaceId, + }: { + ruleTypeId: string; + name: string; + params: CreateEsQueryRuleParams | SloBurnRateRuleParams | StatusRuleParams; + actions?: any[]; + tags?: any[]; + schedule?: { interval: string }; + consumer: string; + roleAuthc: RoleCredentials; + spaceId?: string; + }) { + const { body } = await supertestWithoutAuth + .post(`${spaceId ? '/s/' + spaceId : ''}/api/alerting/rule`) + .set(roleAuthc.apiKeyHeader) + .set(samlAuth.getInternalRequestHeader()) + .send({ + params, + consumer, + schedule: schedule || { + interval: '5m', + }, + tags, + name, + rule_type_id: ruleTypeId, + actions, + }); + return body; + }, + + async runRule(roleAuthc: RoleCredentials, ruleId: string) { + return await retry.tryForTime(retryTimeout, async () => { + try { + const response = await supertestWithoutAuth + .post(`/internal/alerting/rule/${ruleId}/_run_soon`) + .set(samlAuth.getInternalRequestHeader()) + .set(roleAuthc.apiKeyHeader) + .expect(204); + + if (response.status !== 204) { + throw new Error(`runRuleSoon got ${response.status} status`); + } + return response; + } catch (error) { + throw new Error(`[Rule] Running a rule ${ruleId} failed: ${error}`); + } + }); + }, + + async findInRules(roleAuthc: RoleCredentials, ruleId: string, spaceId?: string) { + const response = await supertestWithoutAuth + .get(`${spaceId ? '/s/' + spaceId : ''}/api/alerting/rules/_find`) + .set(roleAuthc.apiKeyHeader) + .set(samlAuth.getInternalRequestHeader()); + return response.body.data.find((obj: any) => obj.id === ruleId); + }, + + async searchRules(roleAuthc: RoleCredentials, filter: string, spaceId?: string) { + return supertestWithoutAuth + .get(`${spaceId ? '/s/' + spaceId : ''}/api/alerting/rules/_find`) + .query({ filter }) + .set(roleAuthc.apiKeyHeader) + .set(samlAuth.getInternalRequestHeader()); + }, + + async deleteRuleById({ roleAuthc, ruleId }: { roleAuthc: RoleCredentials; ruleId: string }) { + return supertestWithoutAuth + .delete(`/api/alerting/rule/${ruleId}`) + .set(roleAuthc.apiKeyHeader) + .set(samlAuth.getInternalRequestHeader()); + }, + + async deleteRules({ roleAuthc, filter = '' }: { roleAuthc: RoleCredentials; filter?: string }) { + const response = await this.searchRules(roleAuthc, filter); + return Promise.all( + response.body.data.map((rule: any) => this.deleteRuleById({ roleAuthc, ruleId: rule.id })) + ); + }, + + async deleteAllActionConnectors({ roleAuthc }: { roleAuthc: RoleCredentials }): Promise { + const res = await supertestWithoutAuth + .get(`/api/actions/connectors`) + .set(roleAuthc.apiKeyHeader) + .set(samlAuth.getInternalRequestHeader()); + + const body = res.body as Array<{ id: string; connector_type_id: string; name: string }>; + return Promise.all( + body.map(({ id }) => { + return this.deleteActionConnector({ + roleAuthc, + actionId: id, + }); + }) + ); + }, + + async deleteActionConnector({ + roleAuthc, + actionId, + }: { + roleAuthc: RoleCredentials; + actionId: string; + }) { + return supertestWithoutAuth + .delete(`/api/actions/connector/${actionId}`) + .set(roleAuthc.apiKeyHeader) + .set(samlAuth.getInternalRequestHeader()); + }, + + async cleanUpAlerts({ + roleAuthc, + ruleId, + consumer, + alertIndexName, + connectorIndexName, + }: { + roleAuthc: RoleCredentials; + ruleId?: string; + consumer?: string; + alertIndexName?: string; + connectorIndexName?: string; + }) { + return Promise.allSettled([ + // Delete the rule by ID + ruleId ? this.deleteRuleById({ roleAuthc, ruleId }) : this.deleteRules({ roleAuthc }), + // Delete all documents in the alert index if specified + alertIndexName + ? es.deleteByQuery({ + index: alertIndexName, + conflicts: 'proceed', + query: { match_all: {} }, + }) + : Promise.resolve(), + // Delete event logs for the specified consumer if provided + consumer + ? es.deleteByQuery({ + index: '.kibana-event-log-*', + query: { term: { 'kibana.alert.rule.consumer': consumer } }, + }) + : Promise.resolve(), + // Delete connector index if provided + connectorIndexName + ? es.indices.delete({ index: connectorIndexName }).catch((e) => { + if (e instanceof errors.ResponseError && e.statusCode === 404) { + return; + } + + throw e; + }) + : Promise.resolve(), + // Delete all action connectors + this.deleteAllActionConnectors({ roleAuthc }), + ]); + }, + }; +} diff --git a/x-pack/platform/test/serverless/shared/services/deployment_agnostic_services.ts b/x-pack/platform/test/serverless/shared/services/deployment_agnostic_services.ts new file mode 100644 index 0000000000000..0f9cecac78d2f --- /dev/null +++ b/x-pack/platform/test/serverless/shared/services/deployment_agnostic_services.ts @@ -0,0 +1,31 @@ +/* + * 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 { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { services as platformApiIntegrationServices } from '../../../api_integration/services'; + +export const services = { + // picking only services that work for any FTR config, e.g. 'samlAuth' requires SAML setup in config file + // common functional services + console: commonFunctionalServices.console, + deployment: commonFunctionalServices.deployment, + es: commonFunctionalServices.es, + esArchiver: commonFunctionalServices.esArchiver, + esDeleteAllIndices: commonFunctionalServices.esDeleteAllIndices, + esSupertest: commonFunctionalServices.esSupertest, + indexPatterns: commonFunctionalServices.indexPatterns, + kibanaServer: commonFunctionalServices.kibanaServer, + randomness: commonFunctionalServices.randomness, + retry: commonFunctionalServices.retry, + security: commonFunctionalServices.security, + supertestWithoutAuth: commonFunctionalServices.supertestWithoutAuth, + // platform services + indexManagement: platformApiIntegrationServices.indexManagement, + ingestPipelines: platformApiIntegrationServices.ingestPipelines, + ml: platformApiIntegrationServices.ml, + usageAPI: platformApiIntegrationServices.usageAPI, +}; diff --git a/x-pack/platform/test/serverless/shared/services/index.ts b/x-pack/platform/test/serverless/shared/services/index.ts new file mode 100644 index 0000000000000..9d50c9838c424 --- /dev/null +++ b/x-pack/platform/test/serverless/shared/services/index.ts @@ -0,0 +1,37 @@ +/* + * 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 { services as platformDeploymentAgnosticServices } from '../../../api_integration_deployment_agnostic/services'; +import { services as commonDeploymentAgnosticServices } from './deployment_agnostic_services'; +import { SupertestProvider } from './supertest'; +import { SvlCommonApiServiceProvider } from './svl_common_api'; +import { SvlReportingServiceProvider } from './svl_reporting'; +import { PlatformSecurityUtilsProvider } from './platform_security_utils'; +import { AlertingApiProvider } from './alerting_api'; + +export type { + InternalRequestHeader, + RoleCredentials, + SupertestWithoutAuthProviderType, +} from '@kbn/ftr-common-functional-services'; + +export const services = { + ...commonDeploymentAgnosticServices, + svlUserManager: platformDeploymentAgnosticServices.samlAuth, + samlAuth: platformDeploymentAgnosticServices.samlAuth, + roleScopedSupertest: platformDeploymentAgnosticServices.roleScopedSupertest, + customRoleScopedSupertest: platformDeploymentAgnosticServices.customRoleScopedSupertest, + dataViewApi: platformDeploymentAgnosticServices.dataViewApi, + // custom svl services + alertingApi: AlertingApiProvider, + supertest: SupertestProvider, + svlCommonApi: SvlCommonApiServiceProvider, + svlReportingApi: SvlReportingServiceProvider, + platformSecurityUtils: PlatformSecurityUtilsProvider, +}; + +export type { SupertestWithRoleScopeType } from '../../../api_integration_deployment_agnostic/services'; diff --git a/x-pack/platform/test/serverless/shared/services/platform_security_utils.ts b/x-pack/platform/test/serverless/shared/services/platform_security_utils.ts new file mode 100644 index 0000000000000..d6626022e4cab --- /dev/null +++ b/x-pack/platform/test/serverless/shared/services/platform_security_utils.ts @@ -0,0 +1,35 @@ +/* + * 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 { FtrProviderContext } from '../ftr_provider_context'; + +export function PlatformSecurityUtilsProvider({ getService }: FtrProviderContext) { + const es = getService('es'); + const log = getService('log'); + + return { + // call it from 'samlAuth' service when tests are migrated to deployment-agnostic + async clearAllRoles() { + const existingRoles = await es.security.getRole(); + const esRolesNames = Object.entries(existingRoles) + .filter(([roleName, esRole]) => { + return !esRole.metadata?._reserved; + }) + .map(([roleName]) => roleName); + + if (esRolesNames.length > 0) { + await Promise.all( + esRolesNames.map(async (roleName) => { + await es.security.deleteRole({ name: roleName }); + }) + ); + } else { + log.debug('No Roles to delete.'); + } + }, + }; +} diff --git a/x-pack/platform/test/serverless/shared/services/supertest.ts b/x-pack/platform/test/serverless/shared/services/supertest.ts new file mode 100644 index 0000000000000..89e354f28bac2 --- /dev/null +++ b/x-pack/platform/test/serverless/shared/services/supertest.ts @@ -0,0 +1,19 @@ +/* + * 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 { format as formatUrl } from 'url'; +import supertest from 'supertest'; +import { FtrProviderContext } from '../ftr_provider_context'; +/** + * Returns supertest.SuperTest instance that will not persist cookie between API requests. + */ +export function SupertestProvider({ getService }: FtrProviderContext) { + const config = getService('config'); + const kbnUrl = formatUrl(config.get('servers.kibana')); + + return supertest(kbnUrl); +} diff --git a/x-pack/platform/test/serverless/shared/services/svl_common_api.ts b/x-pack/platform/test/serverless/shared/services/svl_common_api.ts new file mode 100644 index 0000000000000..7ec8cbb53081c --- /dev/null +++ b/x-pack/platform/test/serverless/shared/services/svl_common_api.ts @@ -0,0 +1,52 @@ +/* + * 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 { FtrProviderContext } from '../ftr_provider_context'; + +const COMMON_REQUEST_HEADERS = { + 'kbn-xsrf': 'some-xsrf-token', +}; + +const INTERNAL_REQUEST_HEADERS = { + ...COMMON_REQUEST_HEADERS, + 'x-elastic-internal-origin': 'kibana', +}; + +export type InternalRequestHeader = typeof INTERNAL_REQUEST_HEADERS; + +export function SvlCommonApiServiceProvider({}: FtrProviderContext) { + return { + // call it from 'samlAuth' service when tests are migrated to deployment-agnostic + getCommonRequestHeader() { + return COMMON_REQUEST_HEADERS; + }, + // call it from 'samlAuth' service when tests are migrated to deployment-agnostic + getInternalRequestHeader(): InternalRequestHeader { + return INTERNAL_REQUEST_HEADERS; + }, + + assertResponseStatusCode(expectedStatus: number, actualStatus: number, responseBody: object) { + expect(actualStatus).to.eql( + expectedStatus, + `Expected status code ${expectedStatus}, got ${actualStatus} with body '${JSON.stringify( + responseBody + )}'` + ); + }, + + assertApiNotFound(body: unknown, status: number) { + expect(body).to.eql({ + statusCode: 404, + error: 'Not Found', + message: 'Not Found', + }); + expect(status).to.eql(404); + }, + }; +} diff --git a/x-pack/platform/test/serverless/shared/services/svl_reporting.ts b/x-pack/platform/test/serverless/shared/services/svl_reporting.ts new file mode 100644 index 0000000000000..eb094a4516dbb --- /dev/null +++ b/x-pack/platform/test/serverless/shared/services/svl_reporting.ts @@ -0,0 +1,133 @@ +/* + * 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 { INTERNAL_ROUTES } from '@kbn/reporting-common'; +import type { ReportingJobResponse } from '@kbn/reporting-plugin/server/types'; +import rison from '@kbn/rison'; +import { CookieCredentials } from '@kbn/ftr-common-functional-services'; +import { FtrProviderContext } from '../ftr_provider_context'; +import { InternalRequestHeader } from '.'; + +const API_HEADER: [string, string] = ['kbn-xsrf', 'reporting']; + +/** + * Services to handle report job lifecycle phases for tests + */ +export function SvlReportingServiceProvider({ getService }: FtrProviderContext) { + const log = getService('log'); + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const retry = getService('retry'); + const config = getService('config'); + + return { + /** + * Use the internal API to create any kind of report job + */ + async createReportJobInternal( + jobType: string, + job: object, + cookieCredentials: CookieCredentials, + internalReqHeader: InternalRequestHeader + ) { + const requestPath = `${INTERNAL_ROUTES.GENERATE_PREFIX}/${jobType}`; + log.debug(`POST request to ${requestPath}`); + + const { body }: { status: number; body: ReportingJobResponse } = await supertestWithoutAuth + .post(requestPath) + .set(internalReqHeader) + .set(cookieCredentials) + .send({ jobParams: rison.encode(job) }) + .expect(200); + + log.info(`ReportingAPI.createReportJobInternal created report job` + ` ${body.job.id}`); + + return { + job: body.job, + path: body.path, + }; + }, + + /* + * If a test requests a report, it must wait for the job to finish before deleting the report. + * Otherwise, report task success metrics will be affected. + */ + async waitForJobToFinish( + downloadReportPath: string, + cookieCredentials: CookieCredentials, + internalReqHeader: InternalRequestHeader, + options?: { timeout?: number } + ) { + await retry.waitForWithTimeout( + `job ${downloadReportPath} finished`, + options?.timeout ?? config.get('timeouts.kibanaReportCompletion'), + async () => { + const response = await supertestWithoutAuth + .get(`${downloadReportPath}?elasticInternalOrigin=true`) + .responseType('blob') + .set(...API_HEADER) + .set(internalReqHeader) + .set(cookieCredentials); + + if (response.status === 500) { + throw new Error(`Report at path ${downloadReportPath} has failed`); + } + + if (response.status === 503) { + log.debug(`Report at path ${downloadReportPath} is pending`); + + // add a delay before retrying + await new Promise((resolve) => setTimeout(resolve, 2500)); + + return false; + } + + log.debug(`Report at path ${downloadReportPath} returned code ${response.status}`); + + if (response.status === 200) { + log.debug(`Report at path ${downloadReportPath} is complete`); + return true; + } + + throw new Error(`unexpected status code ${response.status}`); + } + ); + }, + + /* + * This function is only used in the API tests, functional tests we have to click the download link in the UI + */ + async getCompletedJobOutput( + downloadReportPath: string, + cookieCredentials: CookieCredentials, + internalReqHeader: InternalRequestHeader + ) { + const response = await supertestWithoutAuth + .get(`${downloadReportPath}?elasticInternalOrigin=true`) + .set(internalReqHeader) + .set(cookieCredentials); + return response.text as unknown; + }, + + /* + * Ensures reports are cleaned up through the delete report API + */ + async deleteReport( + reportId: string, + cookieCredentials: CookieCredentials, + internalReqHeader: InternalRequestHeader + ) { + log.debug(`ReportingAPI.deleteReport ${INTERNAL_ROUTES.JOBS.DELETE_PREFIX}/${reportId}`); + const response = await supertestWithoutAuth + .delete(INTERNAL_ROUTES.JOBS.DELETE_PREFIX + `/${reportId}`) + .set(internalReqHeader) + .set(cookieCredentials) + .set('kbn-xsrf', 'xxx') + .expect(200); + return response.text as unknown; + }, + }; +} diff --git a/x-pack/platform/test/serverless/shared/types/index.ts b/x-pack/platform/test/serverless/shared/types/index.ts new file mode 100644 index 0000000000000..9690df7ac64c0 --- /dev/null +++ b/x-pack/platform/test/serverless/shared/types/index.ts @@ -0,0 +1,20 @@ +/* + * 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 { ServerlessProjectType } from '@kbn/es'; +import { InheritedServices } from '../../api_integration/services'; + +export interface CreateTestConfigOptions { + serverlessProject: ServerlessProjectType; + esServerArgs?: string[]; + kbnServerArgs?: string[]; + testFiles: string[]; + junit: { reportName: string }; + suiteTags?: { include?: string[]; exclude?: string[] }; + services?: TServices; + apps?: Record; +} diff --git a/x-pack/platform/test/tsconfig.json b/x-pack/platform/test/tsconfig.json index 2306327340ee4..add5d5af4c9d1 100644 --- a/x-pack/platform/test/tsconfig.json +++ b/x-pack/platform/test/tsconfig.json @@ -151,6 +151,9 @@ "@kbn/datemath", "@kbn/global-search-plugin", "@kbn/global-search-test-plugin", - "@kbn/remote-clusters-plugin" + "@kbn/data-usage-plugin", + "@kbn/data-view-field-editor-plugin", + "@kbn/response-ops-rule-params", + "@kbn/remote-clusters-plugin", ] } diff --git a/x-pack/solutions/security/test/defend_workflows_cypress/serverless_config.base.ts b/x-pack/solutions/security/test/defend_workflows_cypress/serverless_config.base.ts index 82f76fca10f66..78b4fd2b4a50c 100644 --- a/x-pack/solutions/security/test/defend_workflows_cypress/serverless_config.base.ts +++ b/x-pack/solutions/security/test/defend_workflows_cypress/serverless_config.base.ts @@ -9,7 +9,7 @@ import { FtrConfigProviderContext } from '@kbn/test'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const svlSharedConfig = await readConfigFile( - require.resolve('@kbn/test-suites-xpack-platform/serverless/config.base') + require.resolve('@kbn/test-suites-xpack-platform/serverless/shared/config.base') ); return { diff --git a/x-pack/solutions/security/test/osquery_cypress/serverless_config.base.ts b/x-pack/solutions/security/test/osquery_cypress/serverless_config.base.ts index 82f76fca10f66..78b4fd2b4a50c 100644 --- a/x-pack/solutions/security/test/osquery_cypress/serverless_config.base.ts +++ b/x-pack/solutions/security/test/osquery_cypress/serverless_config.base.ts @@ -9,7 +9,7 @@ import { FtrConfigProviderContext } from '@kbn/test'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const svlSharedConfig = await readConfigFile( - require.resolve('@kbn/test-suites-xpack-platform/serverless/config.base') + require.resolve('@kbn/test-suites-xpack-platform/serverless/shared/config.base') ); return { diff --git a/x-pack/test/api_integration/deployment_agnostic/services/index.ts b/x-pack/test/api_integration/deployment_agnostic/services/index.ts deleted file mode 100644 index dd636a14de8e3..0000000000000 --- a/x-pack/test/api_integration/deployment_agnostic/services/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 { services as platformDeploymentAgnosticServices } from '@kbn/test-suites-xpack-platform/api_integration_deployment_agnostic/services'; -import { SupertestWithRoleScope } from '@kbn/test-suites-xpack-platform/api_integration_deployment_agnostic/services/role_scoped_supertest'; - -export type { - InternalRequestHeader, - RoleCredentials, - SupertestWithoutAuthProviderType, -} from '@kbn/ftr-common-functional-services'; - -export const services = { - ...platformDeploymentAgnosticServices, - // these services are left for compatibility with existing tests in x-pack/test and should not be used in new tests -}; - -export type SupertestWithRoleScopeType = SupertestWithRoleScope; -export type DeploymentAgnosticCommonServices = typeof services; diff --git a/x-pack/test/api_integration/deployment_agnostic/services/logs_synthtrace_es_client.ts b/x-pack/test/api_integration/deployment_agnostic/services/logs_synthtrace_es_client.ts deleted file mode 100644 index 2ad02231c4490..0000000000000 --- a/x-pack/test/api_integration/deployment_agnostic/services/logs_synthtrace_es_client.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 { createLogger, LogLevel, LogsSynthtraceEsClient } from '@kbn/apm-synthtrace'; -import { DeploymentAgnosticFtrProviderContext } from '../ftr_provider_context'; - -export function LogsSynthtraceEsClientProvider({ - getService, -}: DeploymentAgnosticFtrProviderContext) { - return new LogsSynthtraceEsClient({ - client: getService('es'), - logger: createLogger(LogLevel.info), - refreshAfterIndex: true, - }); -} diff --git a/x-pack/test/api_integration/deployment_agnostic/services/synthtrace.ts b/x-pack/test/api_integration/deployment_agnostic/services/synthtrace.ts deleted file mode 100644 index eda492ff37a43..0000000000000 --- a/x-pack/test/api_integration/deployment_agnostic/services/synthtrace.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 { ApmSynthtraceKibanaClient, createLogger, LogLevel } from '@kbn/apm-synthtrace'; -import url, { format, UrlObject } from 'url'; - -import { getLogsSynthtraceEsClient } from '../../../common/utils/synthtrace/logs_es_client'; -import { getApmSynthtraceEsClient } from '../../../common/utils/synthtrace/apm_es_client'; -import type { DeploymentAgnosticFtrProviderContext } from '../ftr_provider_context'; - -function getSynthtraceKibanaClient(kibanaServerUrl: string) { - const kibanaServerUrlWithAuth = url - .format({ - ...url.parse(kibanaServerUrl), - }) - .slice(0, -1); - - const kibanaClient = new ApmSynthtraceKibanaClient({ - target: kibanaServerUrlWithAuth, - logger: createLogger(LogLevel.debug), - }); - - return kibanaClient; -} - -export function SynthtraceProvider({ getService }: DeploymentAgnosticFtrProviderContext) { - const client = getService('es'); - const config = getService('config'); - - const servers = config.get('servers'); - const kibanaServer = servers.kibana as UrlObject; - const kibanaServerUrl = format(kibanaServer); - const apmSynthtraceKibanaClient = getSynthtraceKibanaClient(kibanaServerUrl); - - return { - apmSynthtraceKibanaClient, - createLogsSynthtraceEsClient: () => getLogsSynthtraceEsClient(client), - async createApmSynthtraceEsClient() { - const packageVersion = (await apmSynthtraceKibanaClient.installApmPackage()).version; - return getApmSynthtraceEsClient({ client, packageVersion }); - }, - }; -} diff --git a/x-pack/test/security_solution_api_integration/test_suites/ai4dsoc/cases/search_ai_lake_tier/dummy_test.ts b/x-pack/test/security_solution_api_integration/test_suites/ai4dsoc/cases/search_ai_lake_tier/dummy_test.ts index dd086547eabaf..c5c60428c8a8f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/ai4dsoc/cases/search_ai_lake_tier/dummy_test.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/ai4dsoc/cases/search_ai_lake_tier/dummy_test.ts @@ -6,9 +6,9 @@ */ import { RoleCredentials, InternalRequestHeader } from '@kbn/ftr-common-functional-services'; -import { DeploymentAgnosticFtrProviderContext } from '../../../../../api_integration/deployment_agnostic/ftr_provider_context'; +import { FtrProviderContext } from '../../../../ftr_provider_context'; -export default function ({ getService }: DeploymentAgnosticFtrProviderContext) { +export default function ({ getService }: FtrProviderContext) { const samlAuth = getService('samlAuth'); const supertestWithoutAuth = getService('supertestWithoutAuth'); let roleAuthc: RoleCredentials; diff --git a/x-pack/test_serverless/README.md b/x-pack/test_serverless/README.md index 4842648e7c5fa..f7ae8b8698de9 100644 --- a/x-pack/test_serverless/README.md +++ b/x-pack/test_serverless/README.md @@ -2,10 +2,10 @@ The tests and helper methods (services, page objects) defined here in `x-pack/test_serverless` cover the serverless functionality introduced by the - `serverless`, `serverless_observability`, `serverless_search`, `security_solution_serverless` and `serverless_chat` plugins. +`serverless`, `serverless_observability`, `serverless_search`, `security_solution_serverless` and `serverless_chat` plugins. - For how to set up Docker for serverless ES images, please refer to - [src/platform/packages/shared/kbn-es/README](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es/README.mdx). +For how to set up Docker for serverless ES images, please refer to +[src/platform/packages/shared/kbn-es/README](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es/README.mdx). ## Serverless testing structure and conventions @@ -14,6 +14,7 @@ The tests and helper methods (services, page objects) defined here in The serverless test structure corresponds to what we have in `x-pack/test` with API tests in `api_integration` and UI tests in `functional`, each with their set of helper methods and sub-directories for + - `common` functionality shared across serverless projects (core, shared UX, ...) - `observability` project specific functionality - `search` project specific functionality @@ -56,9 +57,9 @@ configurations. **If you add a new `api_integration` or `functional` `common` sub-directory, remember to add it to the corresponding `common_configs` of all projects (`x-pack/test_serverless/[api_integration|functional]/test_suites/[chat|observability|search|security]/common_configs`).** -In case a common test needs to be skipped for one of the projects +In case a common test needs to be skipped for one of the projects (in both regular pipelines that start KBN in serverless mode [against serverless ES] & pipelines creating serverless projects in MKI [Cloud]), -there are the following suite tags available to do so: +there are the following suite tags available to do so: `skipSvlChat`, `skipSvlOblt`, `skipSvlSearch`, `skipSvlSec`, which can be added like this to a test suite: ``` @@ -75,7 +76,7 @@ specific test directory and not to `common` with three skips. Note, that `common` tests are invoked up to four times in a full test run: once per project to make sure the covered shared functionality works correctly in every project. So when writing tests there, be mindful about the test run time. -See also the README files for [Serverless Common API Integration Tests](https://github.com/elastic/kibana/blob/main/x-pack/test_serverless/api_integration/test_suites/common/README.md) and [Serverless Common Functional Tests](https://github.com/elastic/kibana/blob/main/x-pack/test_serverless/functional/test_suites/common/README.md). +See also the README files for [Serverless Common API Integration Tests](https://github.com/elastic/kibana/blob/main/x-pack/platform/test/serverless/api_integration/test_suites/README.md) and [Serverless Common Functional Tests](https://github.com/elastic/kibana/blob/main/x-pack/test_serverless/functional/test_suites/common/README.md). ### Shared services and page objects @@ -101,7 +102,7 @@ following namespaces: As outlined above, serverless tests are separated from stateful tests (except the reuse of helper methods), which includes a new base configuration. All -tests that should run in a serverless environment have to be added to the +tests that should run in a serverless environment have to be added to the `x-pack/test_serverless`. Tests in this area should be clearly designed for the serverless environment, @@ -115,18 +116,19 @@ a project-supported SAML role. FTR provides `svlUserManager` service to do SAML the SAML cookie in the browser context and generates api key to use in the api integration tests. See examples below. General recommendations: + - use the minimal required role to access tested functionality - when feature logic depends on both project type & role, make sure to add separate tests - avoid using basic authentication, unless it is the actual test case - run the tests against real project(s) on MKI to validate it is stable - #### Functional UI test example Recommendations: + - in each test file top level `describe` suite should start with `loginWithRole` call in `before` hook - no need to log out, you can change role by calling `loginWithRole` again. -- for the common tests you can use `loginWithPrivilegedRole` to login as Editor/Developer +- for the common tests you can use `loginWithPrivilegedRole` to login as Editor/Developer ``` describe("my test suite", async function() { @@ -155,6 +157,7 @@ Kibana provides both public and internal APIs, each requiring authentication wit - Internal APIs: Direct HTTP requests to internal APIs are generally not expected. However, for testing purposes, authentication should be performed using the Cookie header. This approach simulates client-side behavior during browser interactions, mirroring how internal APIs are indirectly invoked. Recommendations: + - use `roleScopedSupertest` service to create a supertest instance scoped to a specific role and predefined request headers - `roleScopedSupertest.getSupertestWithRoleScope()` authenticates requests with an API key by default - pass `useCookieHeader: true` to use Cookie header for request authentication @@ -231,6 +234,7 @@ When running tests locally against MKI, ensure that the `.ftr/role_users.json` f When using QAF to create a project with a custom native role, ensure that the role name `custom_role_worker_1` is configured as a Kibana role. While the test user is automatically assigned to the custom role, you must update the role's privileges before performing actions such as logging in via the browser, generating a cookie header, or creating an API key within each test suite. FTR UI test example: + ``` // First, set privileges for the custom role await samlAuth.setCustomRole({ @@ -254,6 +258,7 @@ await samlAuth.deleteCustomRole(); ``` FTR api_integration test example: + ``` // First, set privileges for the custom role await samlAuth.setCustomRole({ @@ -296,6 +301,7 @@ config (`config.feature_flags.ts`) and index (`index.feature_flags.ts`) files next to the regular `config.ts` and `index.ts`. These extra files are used to cover all feature flag tests of the respective area. If you want to add feature flag specific tests: + - Add your feature flag(s) to the `kbnServerArgs` in the `config.feature_flags.ts` file - Load your test file(s) in the `index.feature_flags.ts` file @@ -306,9 +312,11 @@ This docker image can then be used to create a project in serverless QA and the feature flags tests can be pointed to the project. ## Run tests + Similar to how functional tests are run in `x-pack/test`, you can point the functional tests server and test runner to config files in this `x-pack/test_serverless` directory, e.g. from the `x-pack` directory run: + ``` node scripts/functional_tests_server.js --config test_serverless/api_integration/test_suites/search/config.ts @@ -316,16 +324,20 @@ node scripts/functional_test_runner.js --config test_serverless/api_integration/ ``` ## Run tests on MKI + There is no need to start servers locally, you just need to create MKI project and copy urls for Elasticsearch and Kibana. Make sure to update urls with username/password and port 443 for Elasticsearch. FTR has no control over MKI and can't update your projects so make sure your `config.ts` does not specify any custom arguments for Kibana or Elasticsearch. Otherwise, it will be ignored. You can run the tests from the `x-pack` directory: + ``` TEST_CLOUD=1 TEST_CLOUD_HOST_NAME="CLOUD_HOST_NAME" TEST_ES_URL="https://elastic:PASSWORD@ES_HOSTNAME:443" TEST_KIBANA_URL="https://elastic:PASSWORD@KIBANA_HOSTNAME" node scripts/functional_test_runner --config test_serverless/api_integration/test_suites/search/config.ts --exclude-tag=skipMKI ``` Steps to follow to run on QA environment: + - Go to `CLOUD_HOST_NAME` and create a project. - Go to `CLOUD_HOST_NAME/account/keys` and create Cloud specific API Key. - We need the key from step 2 to obtain basic auth credentials for ES and Kibana. Make a POST request to the following endpoint. + ``` POST CLOUD_HOST_NAME/api/v1/serverless/projects///_reset-internal-credentials Authorization: ApiKey @@ -333,13 +345,16 @@ Steps to follow to run on QA environment: ``` In response you should get credentials. + ``` { "password": "testing-internal_pwd", "username": "testing-internal" } ``` + We would use these credentials for `TEST_ES_URL="https://USERNAME:PASSWORD@ES_HOSTNAME:443"` and `TEST_KIBANA_URL="https://USERNAME:PASSWORD@KIBANA_HOSTNAME"` + - Now we need to create a user with the roles we want to test. Go to members page - `CLOUD_HOST_NAME/account/members` and click `[Invite member]`. - Select the access level you want to grant and your project type. For example, to create a user with viewer role, toggle `[Instanse access]`, select project (should correspond to your project type, i.e Security), select `Viewer` role. - Create `.ftr/role_users.json` in the root of Kibana repo. Add record for created user. @@ -352,14 +367,16 @@ Steps to follow to run on QA environment: } ``` - Now run the tests from the `x-pack` directory + ``` TEST_CLOUD=1 TEST_CLOUD_HOST_NAME="CLOUD_HOST_NAME" TEST_ES_URL="https://testing-internal:testing-internal_pwd@ES_HOSTNAME:443" TEST_KIBANA_URL="https://testing-internal:testing-internal_pwd@KIBANA_HOSTNAME:443" node scripts/functional_test_runner.js --config test_serverless/functional/test_suites/security/common_configs/config.group1.ts --exclude-tag=skipMKI ``` - ## Skipping tests for MKI run + The tests that are listed in the the regular `config.ts` generally should work in both Kibana CI and MKI. However some tests might not work properly against MKI projects by design. Tag the tests with `skipMKI` to be excluded for MKI run. It works only for the `describe` block: + ``` describe("my test suite", async function() { this.tags(['skipMKI']); @@ -382,5 +399,5 @@ export set FLEET_PACKAGE_REGISTRY_PORT=12345 To unset the variable, and run the tests against the real endpoint again, execute ``` -unset FLEET_PACKAGE_REGISTRY_PORT +unset FLEET_PACKAGE_REGISTRY_PORT ``` diff --git a/x-pack/test_serverless/api_integration/services/default_fleet_setup.ts b/x-pack/test_serverless/api_integration/services/default_fleet_setup.ts new file mode 100644 index 0000000000000..dc6af90fc621d --- /dev/null +++ b/x-pack/test_serverless/api_integration/services/default_fleet_setup.ts @@ -0,0 +1,69 @@ +/* + * 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 { FtrProviderContext } from '../ftr_provider_context'; + +const defaultFleetServerHostId = 'default-fleet-server'; +const defaultElasticsearchOutputId = 'es-default-output'; + +export async function expectDefaultFleetServer({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const retry = getService('retry'); + let defaultFleetServerHostUrl: string = ''; + + await retry.waitForWithTimeout('get default fleet server', 30_000, async () => { + const { body, status } = await supertest.get( + `/api/fleet/fleet_server_hosts/${defaultFleetServerHostId}` + ); + if (status === 200 && body.item.host_urls.length > 0) { + defaultFleetServerHostUrl = body.item.host_urls[0]; + return true; + } else { + throw new Error(`Expected default Fleet Server id ${defaultFleetServerHostId} to exist`); + } + }); + return defaultFleetServerHostUrl; +} + +export async function expectDefaultElasticsearchOutput({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const retry = getService('retry'); + let defaultEsOutputUrl: string = ''; + + await retry.waitForWithTimeout('get default Elasticsearch output', 30_000, async () => { + const { body, status } = await supertest.get( + `/api/fleet/outputs/${defaultElasticsearchOutputId}` + ); + if (status === 200 && body.item.hosts.length > 0) { + defaultEsOutputUrl = body.item.hosts[0]; + return true; + } else { + throw new Error( + `Expected default Elasticsearch output id ${defaultElasticsearchOutputId} to exist` + ); + } + }); + return defaultEsOutputUrl; +} + +export const kbnServerArgs = [ + '--xpack.cloud.serverless.project_id=ftr_fake_project_id', + `--xpack.fleet.fleetServerHosts=[${JSON.stringify({ + id: defaultFleetServerHostId, + name: 'Default Fleet Server', + is_default: true, + host_urls: ['https://localhost:8220'], + })}]`, + `--xpack.fleet.outputs=[${JSON.stringify({ + id: defaultElasticsearchOutputId, + name: 'Default Output', + type: 'elasticsearch', + is_default: true, + is_default_monitoring: true, + hosts: ['https://localhost:9200'], + })}]`, +]; diff --git a/x-pack/test_serverless/api_integration/test_suites/chat/common_configs/config.group1.ts b/x-pack/test_serverless/api_integration/test_suites/chat/common_configs/config.group1.ts deleted file mode 100644 index 85ceaebcb2048..0000000000000 --- a/x-pack/test_serverless/api_integration/test_suites/chat/common_configs/config.group1.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 { FtrConfigProviderContext } from '@kbn/test'; - -export default async function ({ readConfigFile }: FtrConfigProviderContext) { - const baseTestConfig = await readConfigFile(require.resolve('../config.ts')); - - return { - ...baseTestConfig.getAll(), - testFiles: [ - require.resolve('../../common/core'), - require.resolve('../../common/elasticsearch_api'), - ], - junit: { - reportName: 'Serverless Chat API Integration Tests - Common Group 1', - }, - }; -} diff --git a/x-pack/test_serverless/api_integration/test_suites/common/README.md b/x-pack/test_serverless/api_integration/test_suites/common/README.md deleted file mode 100644 index 291928ab9e7b4..0000000000000 --- a/x-pack/test_serverless/api_integration/test_suites/common/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Kibana Serverless Common API Integration Tests - -The `common` tests in this directory are not project specific and are running -in two or more of the projects. You can use tags to exclude one of the -projects: `skipSvlChat`, `skipSvlOblt`, `skipSvlSearch`, `skipSvlSec`. If no such tag is added, -the test will run in all projects that load this test file in a common config. -Tests that are designed to only run in one of the projects should be added to -the project specific test directory and not to `common` with three skips. - -For more information about serverless tests please refer to -[x-pack/test_serverless/README](https://github.com/elastic/kibana/blob/main/x-pack/test_serverless/README.md). - -## Organizing common tests - -- Common tests don't have dedicated config files as they run as part of project -configs. -- There's no top level index file and tests are organized in sub-directories in -order to better group them based on test run time. -- **If you add a new `common` sub-directory, remember to add it to the `common_configs` of applicable projects (`x-pack/test_serverless/api_integration/test_suites/[chat|observability|search|security]/common_configs`)** - - - - - diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.group1.ts b/x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.group1.ts deleted file mode 100644 index c3feabb61e1d3..0000000000000 --- a/x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.group1.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 { FtrConfigProviderContext } from '@kbn/test'; - -export default async function ({ readConfigFile }: FtrConfigProviderContext) { - const baseTestConfig = await readConfigFile(require.resolve('../config.ts')); - - return { - ...baseTestConfig.getAll(), - testFiles: [ - require.resolve('../../common/alerting'), - require.resolve('../../common/data_view_field_editor'), - require.resolve('../../common/data_views'), - require.resolve('../../common/elasticsearch_api'), - require.resolve('../../common/index_management'), - require.resolve('../../common/kql_telemetry'), - require.resolve('../../common/management'), - require.resolve('../../common/platform_security'), - require.resolve('../../common/scripts_tests'), - require.resolve('../../common/search_oss'), - require.resolve('../../common/search_profiler'), - require.resolve('../../common/search_xpack'), - require.resolve('../../common/core'), - require.resolve('../../common/reporting'), - require.resolve('../../common/grok_debugger'), - require.resolve('../../common/painless_lab'), - require.resolve('../../common/console'), - require.resolve('../../common/saved_objects_management'), - require.resolve('../../common/telemetry'), - require.resolve('../../common/data_usage'), - require.resolve('../../common/favorites'), - ], - junit: { - reportName: 'Serverless Observability API Integration Tests - Common Group 1', - }, - }; -} diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.logs_essentials.group1.ts b/x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.logs_essentials.group1.ts deleted file mode 100644 index 09a983c67723a..0000000000000 --- a/x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.logs_essentials.group1.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 { FtrConfigProviderContext } from '@kbn/test'; - -export default async function ({ readConfigFile }: FtrConfigProviderContext) { - const baseTestConfig = await readConfigFile(require.resolve('../config.logs_essentials.ts')); - - return { - ...baseTestConfig.getAll(), - testFiles: [require.resolve('../../common/telemetry')], - junit: { - reportName: 'Serverless Observability Logs Essentials API Integration Tests - Common Group 1', - }, - }; -} diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/fleet/config.ts b/x-pack/test_serverless/api_integration/test_suites/observability/fleet/config.ts index 799db90f5055d..9f8a1a36ea71e 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/fleet/config.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/fleet/config.ts @@ -5,9 +5,9 @@ * 2.0. */ +import { kbnServerArgs } from '../../../services/default_fleet_setup'; import { createTestConfig } from '../../../config.base'; import { services } from '../apm_api_integration/common/services'; -import { kbnServerArgs } from '../../common/fleet/default_setup'; export default createTestConfig({ serverlessProject: 'oblt', diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/fleet/fleet.ts b/x-pack/test_serverless/api_integration/test_suites/observability/fleet/fleet.ts index e939747deb1d0..6c1272751f959 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/fleet/fleet.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/fleet/fleet.ts @@ -6,12 +6,12 @@ */ import expect from 'expect'; -import type { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; import { expectDefaultElasticsearchOutput, expectDefaultFleetServer, -} from '../../common/fleet/default_setup'; +} from '../../../services/default_fleet_setup'; +import type { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function (ctx: FtrProviderContext) { const svlCommonApi = ctx.getService('svlCommonApi'); diff --git a/x-pack/test_serverless/api_integration/test_suites/search/common_configs/config.group1.ts b/x-pack/test_serverless/api_integration/test_suites/search/common_configs/config.group1.ts deleted file mode 100644 index dd0222a24582d..0000000000000 --- a/x-pack/test_serverless/api_integration/test_suites/search/common_configs/config.group1.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { FtrConfigProviderContext } from '@kbn/test'; - -export default async function ({ readConfigFile }: FtrConfigProviderContext) { - const baseTestConfig = await readConfigFile(require.resolve('../config.ts')); - - return { - ...baseTestConfig.getAll(), - testFiles: [ - require.resolve('../../common/alerting'), - require.resolve('../../common/data_view_field_editor'), - require.resolve('../../common/data_views'), - require.resolve('../../common/elasticsearch_api'), - require.resolve('../../common/index_management'), - require.resolve('../../common/kql_telemetry'), - require.resolve('../../common/management'), - require.resolve('../../common/platform_security'), - require.resolve('../../common/scripts_tests'), - require.resolve('../../common/search_oss'), - require.resolve('../../common/search_profiler'), - require.resolve('../../common/search_xpack'), - require.resolve('../../common/core'), - require.resolve('../../common/reporting'), - require.resolve('../../common/console'), - require.resolve('../../common/saved_objects_management'), - require.resolve('../../common/telemetry'), - require.resolve('../../common/data_usage'), - require.resolve('../../common/favorites'), - ], - junit: { - reportName: 'Serverless Search API Integration Tests - Common Group 1', - }, - }; -} diff --git a/x-pack/test_serverless/api_integration/test_suites/security/common_configs/config.group1.ts b/x-pack/test_serverless/api_integration/test_suites/security/common_configs/config.group1.ts deleted file mode 100644 index 29888d8031980..0000000000000 --- a/x-pack/test_serverless/api_integration/test_suites/security/common_configs/config.group1.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 { FtrConfigProviderContext } from '@kbn/test'; - -export default async function ({ readConfigFile }: FtrConfigProviderContext) { - const baseTestConfig = await readConfigFile(require.resolve('../config.ts')); - - return { - ...baseTestConfig.getAll(), - testFiles: [ - require.resolve('../../common/alerting'), - require.resolve('../../common/data_view_field_editor'), - require.resolve('../../common/data_views'), - require.resolve('../../common/elasticsearch_api'), - require.resolve('../../common/index_management'), - require.resolve('../../common/kql_telemetry'), - require.resolve('../../common/management'), - require.resolve('../../common/platform_security'), - require.resolve('../../common/scripts_tests'), - require.resolve('../../common/search_oss'), - require.resolve('../../common/search_profiler'), - require.resolve('../../common/search_xpack'), - require.resolve('../../common/core'), - require.resolve('../../common/reporting'), - require.resolve('../../common/grok_debugger'), - require.resolve('../../common/painless_lab'), - require.resolve('../../common/console'), - require.resolve('../../common/saved_objects_management'), - require.resolve('../../common/telemetry'), - require.resolve('../../common/data_usage'), - require.resolve('../../common/favorites'), - ], - junit: { - reportName: 'Serverless Security API Integration Tests - Common Group 1', - }, - }; -} diff --git a/x-pack/test_serverless/api_integration/test_suites/security/fleet/config.ts b/x-pack/test_serverless/api_integration/test_suites/security/fleet/config.ts index eeb86e176a506..eb5b1046ed575 100644 --- a/x-pack/test_serverless/api_integration/test_suites/security/fleet/config.ts +++ b/x-pack/test_serverless/api_integration/test_suites/security/fleet/config.ts @@ -5,8 +5,8 @@ * 2.0. */ +import { kbnServerArgs } from '../../../services/default_fleet_setup'; import { createTestConfig } from '../../../config.base'; -import { kbnServerArgs } from '../../common/fleet/default_setup'; export default createTestConfig({ serverlessProject: 'security', diff --git a/x-pack/test_serverless/api_integration/test_suites/security/fleet/fleet.ts b/x-pack/test_serverless/api_integration/test_suites/security/fleet/fleet.ts index d812e43dfa62a..9502d83b8ec99 100644 --- a/x-pack/test_serverless/api_integration/test_suites/security/fleet/fleet.ts +++ b/x-pack/test_serverless/api_integration/test_suites/security/fleet/fleet.ts @@ -6,12 +6,12 @@ */ import expect from 'expect'; -import { RoleCredentials } from '../../../../shared/services'; -import { FtrProviderContext } from '../../../ftr_provider_context'; import { expectDefaultElasticsearchOutput, expectDefaultFleetServer, -} from '../../common/fleet/default_setup'; +} from '../../../services/default_fleet_setup'; +import { RoleCredentials } from '../../../../shared/services'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function (ctx: FtrProviderContext) { const svlCommonApi = ctx.getService('svlCommonApi'); diff --git a/x-pack/test_serverless/functional/test_suites/common/data_usage/main.ts b/x-pack/test_serverless/functional/test_suites/common/data_usage/main.ts index 042e9fde0267a..20b3d6475c99b 100644 --- a/x-pack/test_serverless/functional/test_suites/common/data_usage/main.ts +++ b/x-pack/test_serverless/functional/test_suites/common/data_usage/main.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; import http from 'http'; import { InterceptResponseFactory } from '@kbn/ftr-common-functional-ui-services'; +import { setupMockServer } from '@kbn/test-suites-xpack-platform/serverless/api_integration/test_suites/data_usage/mock_api'; import { FtrProviderContext } from '../../../ftr_provider_context'; -import { setupMockServer } from '../../../../api_integration/test_suites/common/data_usage/mock_api'; export default ({ getPageObjects, getService }: FtrProviderContext) => { const pageObjects = getPageObjects([ diff --git a/x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.agentless.ts b/x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.agentless.ts index 6d389c8bb99e2..c2b521fb07fc5 100644 --- a/x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.agentless.ts +++ b/x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.agentless.ts @@ -6,9 +6,9 @@ */ import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils'; +import { kbnServerArgs as fleetKbnServerArgs } from '../../../api_integration/services/default_fleet_setup'; import { CLOUD_SECURITY_POSTURE_PACKAGE_VERSION } from './constants'; import { createTestConfig } from '../../config.base'; -import { kbnServerArgs as fleetKbnServerArgs } from '../../../api_integration/test_suites/common/fleet/default_setup'; // TODO: Remove the agentless default config once Serverless API is merged and default policy is deleted export default createTestConfig({ diff --git a/x-pack/test_serverless/tsconfig.json b/x-pack/test_serverless/tsconfig.json index e1915ba4b8a3f..2612f2df9a546 100644 --- a/x-pack/test_serverless/tsconfig.json +++ b/x-pack/test_serverless/tsconfig.json @@ -29,9 +29,6 @@ "@kbn/repo-info", "@kbn/cypress-config", "@kbn/dev-proc-runner", - "@kbn/telemetry-plugin", - "@kbn/telemetry-collection-xpack-plugin", - "@kbn/telemetry-tools", "@kbn/ftr-common-functional-services", "@kbn/apm-plugin", "@kbn/server-route-repository", @@ -42,16 +39,10 @@ "@kbn/cases-plugin", "@kbn/core-http-common", "@kbn/data-views-plugin", - "@kbn/core-saved-objects-server", "@kbn/rison", - "@kbn/discover-plugin", - "@kbn/data-plugin", "@kbn/std", - "@kbn/data-view-field-editor-plugin", - "@kbn/data-plugin", "@kbn/dev-utils", "@kbn/es-archiver", - "@kbn/rule-data-utils", "@kbn/rison", "@kbn/serverless-common-settings", "@kbn/serverless-observability-settings", @@ -62,30 +53,23 @@ "@kbn/management-settings-ids", "@kbn/apm-synthtrace", "@kbn/apm-synthtrace-client", - "@kbn/reporting-export-types-csv-common", "@kbn/mock-idp-utils", "@kbn/index-management-plugin", "@kbn/transform-plugin", "@kbn/slo-schema", "@kbn/core", - "@kbn/alerting-plugin", "@kbn/ftr-common-functional-ui-services", "@kbn/saved-objects-management-plugin", "@kbn/es", "@kbn/reporting-common", - "@kbn/es-query", "@kbn/slo-plugin", - "@kbn/es-query", "@kbn/synthetics-plugin", "@kbn/dataset-quality-plugin", "@kbn/search-types", - "@kbn/config-schema", - "@kbn/features-plugin", "@kbn/test-suites-src", "@kbn/console-plugin", "@kbn/cloud-security-posture-common", "@kbn/core-saved-objects-import-export-server-internal", - "@kbn/security-plugin-types-common", "@kbn/data-usage-plugin", "@kbn/scout-info", "@kbn/streams-schema", @@ -97,5 +81,6 @@ "@kbn/telemetry-collection-manager-plugin", "@kbn/security-solution-plugin", "@kbn/test-suites-xpack-observability", + "@kbn/security-plugin-types-common", ] }