diff --git a/.buildkite/ftr_platform_stateful_configs.yml b/.buildkite/ftr_platform_stateful_configs.yml index e95ac08313ca5..f6d8aecb64082 100644 --- a/.buildkite/ftr_platform_stateful_configs.yml +++ b/.buildkite/ftr_platform_stateful_configs.yml @@ -2,6 +2,8 @@ disabled: # Stateful base config for deployment-agnostic tests - x-pack/test/api_integration/deployment_agnostic/default_configs/stateful.config.base.ts - x-pack/test/api_integration/deployment_agnostic/default_configs/feature_flag.stateful.config.base.ts + - x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/serverless.config.base.ts + - x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/stateful.config.base.ts # Base config files, only necessary to inform config finding script - src/platform/test/functional/config.base.js @@ -51,7 +53,6 @@ disabled: # Gen AI suites, running with their own pipeline - x-pack/test/functional_gen_ai/inference/config.ts - defaultQueue: 'n2-4-spot' enabled: - src/platform/test/accessibility/config.ts @@ -327,9 +328,9 @@ enabled: - x-pack/test/security_functional/user_profiles.config.ts - x-pack/test/security_functional/expired_session.config.ts - x-pack/test/session_view/basic/config.ts - - x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts - - x-pack/test/spaces_api_integration/security_and_spaces/config_trial.ts - - x-pack/test/spaces_api_integration/spaces_only/config.ts + - x-pack/platform/test/spaces_api_integration/security_and_spaces/config_basic.ts + - x-pack/platform/test/spaces_api_integration/security_and_spaces/config_trial.ts + - x-pack/platform/test/spaces_api_integration/spaces_only/config.ts - x-pack/platform/test/task_manager_claimer_update_by_query/config.ts - x-pack/test/ui_capabilities/security_and_spaces/config.ts - x-pack/test/ui_capabilities/spaces_only/config.ts diff --git a/.buildkite/ftr_security_serverless_configs.yml b/.buildkite/ftr_security_serverless_configs.yml index 17a5551f9b3e4..73116ced22b01 100644 --- a/.buildkite/ftr_security_serverless_configs.yml +++ b/.buildkite/ftr_security_serverless_configs.yml @@ -132,5 +132,5 @@ enabled: - x-pack/test/security_solution_api_integration/test_suites/ai4dsoc/nlp_cleanup_task/search_ai_lake_tier/configs/serverless.config.ts # serverless config files that run deployment-agnostic tests - x-pack/test/api_integration/deployment_agnostic/configs/serverless/security.serverless.config.ts - - x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.config.ts - - x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.copy_to_space.config.ts + - x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.config.ts + - x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.copy_to_space.config.ts diff --git a/.buildkite/ftr_security_stateful_configs.yml b/.buildkite/ftr_security_stateful_configs.yml index b5cc825bf28a8..2ef9baa6ba6d0 100644 --- a/.buildkite/ftr_security_stateful_configs.yml +++ b/.buildkite/ftr_security_stateful_configs.yml @@ -115,11 +115,11 @@ enabled: - x-pack/solutions/security/test/cloud_security_posture_functional/config.ts - x-pack/solutions/security/test/cloud_security_posture_functional/config.agentless.ts - x-pack/solutions/security/test/cloud_security_posture_functional/data_views/config.ts - - x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/config.ts - - x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_basic.ts - - x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_trial.ts - - x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_trial.ts - - x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_basic.ts + - x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/config.ts + - x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_basic.ts + - x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_trial.ts + - x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_trial.ts + - x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_basic.ts - x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group1/config.ts - x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group2/config.ts - x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group2/config_non_dedicated_task_runner.ts diff --git a/.eslintrc.js b/.eslintrc.js index c86967aeeca5c..d2f0d38f32030 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2113,7 +2113,7 @@ module.exports = { 'x-pack/test/security_functional/**/*.{js,mjs,ts,tsx}', 'x-pack/platform/plugins/shared/spaces/**/*.{js,mjs,ts,tsx}', - 'x-pack/test/spaces_api_integration/**/*.{js,mjs,ts,tsx}', + 'x-pack/platform/test/spaces_api_integration/**/*.{js,mjs,ts,tsx}', ], rules: { '@typescript-eslint/consistent-type-imports': 1, diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7f513dac9840f..aeb89eeaf90ce 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -997,6 +997,7 @@ x-pack/platform/test/plugin_api_integration/plugins/feature_usage_test @elastic/ x-pack/platform/test/plugin_api_integration/plugins/sample_task_plugin @elastic/response-ops x-pack/platform/test/plugin_api_perf/plugins/task_manager_performance @elastic/response-ops x-pack/platform/test/saved_object_api_integration/common/plugins/saved_object_test_plugin @elastic/kibana-security +x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin @elastic/kibana-security x-pack/platform/test/task_manager_claimer_update_by_query/plugins/sample_task_plugin_mget @elastic/response-ops x-pack/solutions/chat/packages/wc-framework-types-browser @elastic/search-kibana @elastic/workchat-eng x-pack/solutions/chat/packages/wc-framework-types-common @elastic/search-kibana @elastic/workchat-eng @@ -1124,7 +1125,6 @@ x-pack/test/security_api_integration/plugins/oidc_provider @elastic/kibana-secur x-pack/test/security_api_integration/plugins/saml_provider @elastic/kibana-security x-pack/test/security_api_integration/plugins/user_profiles_consumer @elastic/kibana-security x-pack/test/security_functional/plugins/test_endpoints @elastic/kibana-security -x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin @elastic/kibana-security x-pack/test/ui_capabilities/common/plugins/foo_plugin @elastic/kibana-security x-pack/test/usage_collection/plugins/application_usage_test @elastic/kibana-core x-pack/test/usage_collection/plugins/stack_management_usage_test @elastic/kibana-management @@ -1889,6 +1889,7 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/test/apm_api_integration @elastic/appex-qa # temporarily due to SKA tests relocation /x-pack/test/common/utils/observability @elastic/appex-qa # temporarily due to SKA tests relocation /x-pack/test/common/utils/uptime @elastic/appex-qa # temporarily due to SKA tests relocation +/x-pack/platform/test/serverless @elastic/appex-qa # Core /src/platform/test/api_integration/fixtures/kbn_archiver/management/saved_objects/relationships.json @elastic/kibana-core @elastic/kibana-data-discovery @@ -2089,7 +2090,7 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi /x-pack/platform/test/functional/apps/spaces/ @elastic/kibana-security /x-pack/test/security_api_integration/ @elastic/kibana-security /x-pack/test/security_functional/ @elastic/kibana-security -/x-pack/test/spaces_api_integration/ @elastic/kibana-security +/x-pack/platform/test/spaces_api_integration/ @elastic/kibana-security /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 diff --git a/package.json b/package.json index 38aebdb2d473c..daff2018f4103 100644 --- a/package.json +++ b/package.json @@ -966,7 +966,7 @@ "@kbn/snapshot-restore-plugin": "link:x-pack/platform/plugins/private/snapshot_restore", "@kbn/sort-predicates": "link:src/platform/packages/shared/kbn-sort-predicates", "@kbn/spaces-plugin": "link:x-pack/platform/plugins/shared/spaces", - "@kbn/spaces-test-plugin": "link:x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin", + "@kbn/spaces-test-plugin": "link:x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin", "@kbn/spaces-utils": "link:src/platform/packages/shared/kbn-spaces-utils", "@kbn/sse-example-plugin": "link:examples/sse_example", "@kbn/sse-utils": "link:src/platform/packages/shared/kbn-sse-utils", diff --git a/scripts/archive_migration_functions.sh b/scripts/archive_migration_functions.sh index 34f797d20dd6f..4c8b34c210d0f 100755 --- a/scripts/archive_migration_functions.sh +++ b/scripts/archive_migration_functions.sh @@ -379,7 +379,7 @@ save_kbn() { set -x node scripts/kbn_archiver.js --config "$test_config" save "$new_archive" --type $standard_list --space "$space" set +x - # node scripts/kbn_archiver.js --config x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts save x-pack/test/functional/fixtures/kbn_archiver/saved_objects/default_space --type search,index-pattern,visualization,dashboard,lens,map,graph-workspace,query,tag,url,canvas-workpad + # node scripts/kbn_archiver.js --config x-pack/platform/test/spaces_api_integration/security_and_spaces/config_basic.ts save x-pack/test/functional/fixtures/kbn_archiver/saved_objects/default_space --type search,index-pattern,visualization,dashboard,lens,map,graph-workspace,query,tag,url,canvas-workpad } load_kbn() { diff --git a/tsconfig.base.json b/tsconfig.base.json index 1624f7188c276..1faddd24fbe7a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1956,8 +1956,8 @@ "@kbn/sort-predicates/*": ["src/platform/packages/shared/kbn-sort-predicates/*"], "@kbn/spaces-plugin": ["x-pack/platform/plugins/shared/spaces"], "@kbn/spaces-plugin/*": ["x-pack/platform/plugins/shared/spaces/*"], - "@kbn/spaces-test-plugin": ["x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin"], - "@kbn/spaces-test-plugin/*": ["x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/*"], + "@kbn/spaces-test-plugin": ["x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin"], + "@kbn/spaces-test-plugin/*": ["x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/*"], "@kbn/spaces-utils": ["src/platform/packages/shared/kbn-spaces-utils"], "@kbn/spaces-utils/*": ["src/platform/packages/shared/kbn-spaces-utils/*"], "@kbn/sse-example-plugin": ["examples/sse_example"], diff --git a/x-pack/platform/test/api_integration/config.ts b/x-pack/platform/test/api_integration/config.ts index f9aebccd3a493..dbfb5a834ff3e 100644 --- a/x-pack/platform/test/api_integration/config.ts +++ b/x-pack/platform/test/api_integration/config.ts @@ -11,7 +11,7 @@ import { services } from './services'; export async function getApiIntegrationConfig({ readConfigFile }: FtrConfigProviderContext) { const xPackFunctionalTestsConfig = await readConfigFile( - require.resolve('@kbn/test-suites-xpack/functional/config.base') + require.resolve('../functional/config.base.ts') ); return { diff --git a/x-pack/platform/test/fleet_multi_cluster/config.ts b/x-pack/platform/test/fleet_multi_cluster/config.ts index 15ef751bc9d60..e1f89a53853d4 100644 --- a/x-pack/platform/test/fleet_multi_cluster/config.ts +++ b/x-pack/platform/test/fleet_multi_cluster/config.ts @@ -12,7 +12,7 @@ import { RemoteEsProvider } from './services/remote_es/remote_es'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const xpackFunctionalConfig = await readConfigFile( - require.resolve('@kbn/test-suites-xpack/functional/config.base') + require.resolve('../api_integration/config.ts') ); return { diff --git a/x-pack/platform/test/serverless/common/package_registry_config.yml b/x-pack/platform/test/serverless/common/package_registry_config.yml new file mode 100644 index 0000000000000..1885fa5c2ebe5 --- /dev/null +++ b/x-pack/platform/test/serverless/common/package_registry_config.yml @@ -0,0 +1,2 @@ +package_paths: + - /packages/package-storage diff --git a/x-pack/platform/test/serverless/config.base.ts b/x-pack/platform/test/serverless/config.base.ts new file mode 100644 index 0000000000000..c56a8a2012c09 --- /dev/null +++ b/x-pack/platform/test/serverless/config.base.ts @@ -0,0 +1,205 @@ +/* + * 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 { resolve } from 'path'; +import { format as formatUrl } from 'url'; +import Fs from 'fs'; + +import { REPO_ROOT } from '@kbn/repo-info'; +import { + esTestConfig, + kbnTestConfig, + kibanaTestSuperuserServerless, + getDockerFileMountPath, +} from '@kbn/test'; +import { CA_CERT_PATH, kibanaDevServiceAccount } from '@kbn/dev-utils'; +import { MOCK_IDP_REALM_NAME } from '@kbn/mock-idp-utils'; +import path from 'path'; +import { fleetPackageRegistryDockerImage, defineDockerServersConfig } from '@kbn/test'; + +export default async () => { + const packageRegistryConfig = path.join(__dirname, './common/package_registry_config.yml'); + const dockerArgs: string[] = ['-v', `${packageRegistryConfig}:/package-registry/config.yml`]; + + /** + * This is used by CI to set the docker registry port + * you can also define this environment variable locally when running tests which + * will spin up a local docker package registry locally for you + * if this is defined it takes precedence over the `packageRegistryOverride` variable + */ + const dockerRegistryPort: string | undefined = process.env.FLEET_PACKAGE_REGISTRY_PORT; + + const servers = { + kibana: { + ...kbnTestConfig.getUrlParts(kibanaTestSuperuserServerless), + protocol: process.env.TEST_CLOUD ? 'https' : 'http', + certificateAuthorities: process.env.TEST_CLOUD ? undefined : [Fs.readFileSync(CA_CERT_PATH)], + }, + elasticsearch: { + ...esTestConfig.getUrlParts(), + protocol: 'https', + certificateAuthorities: process.env.TEST_CLOUD ? undefined : [Fs.readFileSync(CA_CERT_PATH)], + }, + }; + + // "Fake" SAML provider + const idpPath = resolve( + __dirname, + '../../../test/security_api_integration/plugins/saml_provider/metadata.xml' + ); + const samlIdPPlugin = resolve( + __dirname, + '../../../test/security_api_integration/plugins/saml_provider' + ); + + const jwksPath = require.resolve('@kbn/security-api-integration-helpers/oidc/jwks.json'); + + return { + servers, + dockerServers: defineDockerServersConfig({ + registry: { + enabled: !!dockerRegistryPort, + image: fleetPackageRegistryDockerImage, + portInContainer: 8080, + port: dockerRegistryPort, + args: dockerArgs, + waitForLogLine: 'package manifests loaded', + waitForLogLineTimeoutMs: 60 * 4 * 1000, // 4 minutes + }, + }), + browser: { + acceptInsecureCerts: true, + }, + esTestCluster: { + from: 'serverless', + files: [idpPath, jwksPath], + serverArgs: [ + 'xpack.security.authc.realms.file.file1.order=-100', + `xpack.security.authc.realms.native.native1.enabled=false`, + `xpack.security.authc.realms.native.native1.order=-97`, + + 'xpack.security.authc.realms.jwt.jwt1.allowed_audiences=elasticsearch', + `xpack.security.authc.realms.jwt.jwt1.allowed_issuer=https://kibana.elastic.co/jwt/`, + `xpack.security.authc.realms.jwt.jwt1.allowed_signature_algorithms=[RS256]`, + `xpack.security.authc.realms.jwt.jwt1.allowed_subjects=elastic-agent`, + `xpack.security.authc.realms.jwt.jwt1.claims.principal=sub`, + 'xpack.security.authc.realms.jwt.jwt1.client_authentication.type=shared_secret', + 'xpack.security.authc.realms.jwt.jwt1.order=-98', + `xpack.security.authc.realms.jwt.jwt1.pkc_jwkset_path=${getDockerFileMountPath(jwksPath)}`, + `xpack.security.authc.realms.jwt.jwt1.token_type=access_token`, + 'serverless.indices.validate_dot_prefixes=true', + // controller cluster-settings + `cluster.service.slow_task_logging_threshold=15s`, + `cluster.service.slow_task_thread_dump_timeout=5s`, + `serverless.search.enable_replicas_for_instant_failover=true`, + ], + ssl: true, // SSL is required for SAML realm + }, + + kbnTestServer: { + buildArgs: [], + env: { + KBN_PATH_CONF: resolve(REPO_ROOT, 'config'), + }, + sourceArgs: ['--no-base-path', '--env.name=development'], + serverArgs: [ + `--server.restrictInternalApis=true`, + `--server.port=${servers.kibana.port}`, + `--server.prototypeHardening=true`, + '--status.allowAnonymous=true', + `--migrations.zdt.runOnRoles=${JSON.stringify(['ui'])}`, + // We shouldn't embed credentials into the URL since Kibana requests to Elasticsearch should + // either include `kibanaServerTestUser` credentials, or credentials provided by the test + // user, or none at all in case anonymous access is used. + `--elasticsearch.hosts=${formatUrl( + Object.fromEntries( + Object.entries(servers.elasticsearch).filter(([key]) => key.toLowerCase() !== 'auth') + ) + )}`, + `--elasticsearch.serviceAccountToken=${kibanaDevServiceAccount.token}`, + `--elasticsearch.ssl.certificateAuthorities=${CA_CERT_PATH}`, + '--telemetry.sendUsageTo=staging', + `--logging.appenders.deprecation=${JSON.stringify({ + type: 'console', + layout: { + type: 'json', + }, + })}`, + `--logging.loggers=${JSON.stringify([ + { + name: 'elasticsearch.deprecation', + level: 'all', + appenders: ['deprecation'], + }, + ])}`, + // Add meta info to the logs so FTR logs are more actionable + `--logging.appenders.default=${JSON.stringify({ + type: 'console', + layout: { + type: 'pattern', + pattern: '[%date][%level][%logger] %message %meta', + }, + })}`, + `--logging.appenders.console=${JSON.stringify({ + type: 'console', + layout: { + type: 'pattern', + pattern: '[%date][%level][%logger] %message %meta', + }, + })}`, + // This ensures that we register the Security SAML API endpoints. + // In the real world the SAML config is injected by control plane. + `--plugin-path=${samlIdPPlugin}`, + // Ensure that SAML is used as the default authentication method whenever a user navigates to Kibana. In other + // words, Kibana should attempt to authenticate the user using the provider with the lowest order if the Login + // Selector is disabled (which is how Serverless Kibana is configured). By declaring `cloud-basic` with a higher + // order, we indicate that basic authentication can still be used, but only if explicitly requested when the + // user navigates to `/login` page directly and enters username and password in the login form. + '--xpack.security.authc.selector.enabled=false', + `--xpack.security.authc.providers=${JSON.stringify({ + saml: { 'cloud-saml-kibana': { order: 0, realm: MOCK_IDP_REALM_NAME } }, + basic: { 'cloud-basic': { order: 1 } }, + })}`, + '--xpack.encryptedSavedObjects.encryptionKey="wuGNaIhoMpk5sO4UBxgr3NyW1sFcLgIf"', + `--server.publicBaseUrl=${servers.kibana.protocol}://${servers.kibana.hostname}:${servers.kibana.port}`, + // configure security reponse header report-to settings to mimic MKI configuration + `--csp.report_to=${JSON.stringify(['violations-endpoint'])}`, + `--permissionsPolicy.report_to=${JSON.stringify(['violations-endpoint'])}`, + // normally below is injected by control plane + '--xpack.cloud.id=ftr_fake_cloud_id', + `--xpack.cloud.serverless.project_id=fakeprojectid`, + `--xpack.cloud.base_url=https://fake-cloud.elastic.co`, + `--xpack.cloud.projects_url=/projects/`, + `--xpack.cloud.profile_url=/user/settings/`, + `--xpack.cloud.billing_url=/billing/overview/`, + `--xpack.cloud.deployments_url=/deployments`, + `--xpack.cloud.organization_url=/account/`, + `--xpack.cloud.users_and_roles_url=/account/members/`, + ], + }, + + security: { disableTestUser: true }, + + // Used by FTR to recognize serverless project and change its behavior accordingly + serverless: true, + + services: {}, // define later + + // overriding default timeouts from src/platform/packages/shared/kbn-test/src/functional_test_runner/lib/config/schema.ts + // so we can easily adjust them for serverless where needed + timeouts: { + find: 10 * 1000, + try: 120 * 1000, + waitFor: 20 * 1000, + esRequestTimeout: 30 * 1000, + kibanaReportCompletion: 600 * 1000, + kibanaStabilize: 15 * 1000, + navigateStatusPageCheck: 250, + waitForExists: 2500, + }, + }; +}; diff --git a/x-pack/test/spaces_api_integration/common/config.ts b/x-pack/platform/test/spaces_api_integration/common/config.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/config.ts rename to x-pack/platform/test/spaces_api_integration/common/config.ts diff --git a/x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json b/x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json similarity index 100% rename from x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json rename to x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json diff --git a/x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/default_space.json b/x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/default_space.json similarity index 100% rename from x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/default_space.json rename to x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/default_space.json diff --git a/x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_1.json b/x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/space_1.json similarity index 100% rename from x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_1.json rename to x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/space_1.json diff --git a/x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_2.json b/x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/space_2.json similarity index 100% rename from x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_2.json rename to x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/space_2.json diff --git a/x-pack/test/spaces_api_integration/common/ftr_provider_context.d.ts b/x-pack/platform/test/spaces_api_integration/common/ftr_provider_context.d.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/ftr_provider_context.d.ts rename to x-pack/platform/test/spaces_api_integration/common/ftr_provider_context.d.ts diff --git a/x-pack/test/spaces_api_integration/common/lib/authentication.ts b/x-pack/platform/test/spaces_api_integration/common/lib/authentication.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/lib/authentication.ts rename to x-pack/platform/test/spaces_api_integration/common/lib/authentication.ts diff --git a/x-pack/test/spaces_api_integration/common/lib/create_users_and_roles.ts b/x-pack/platform/test/spaces_api_integration/common/lib/create_users_and_roles.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/lib/create_users_and_roles.ts rename to x-pack/platform/test/spaces_api_integration/common/lib/create_users_and_roles.ts diff --git a/x-pack/test/spaces_api_integration/common/lib/saved_object_test_cases.ts b/x-pack/platform/test/spaces_api_integration/common/lib/saved_object_test_cases.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/lib/saved_object_test_cases.ts rename to x-pack/platform/test/spaces_api_integration/common/lib/saved_object_test_cases.ts diff --git a/x-pack/test/spaces_api_integration/common/lib/space_test_utils.ts b/x-pack/platform/test/spaces_api_integration/common/lib/space_test_utils.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/lib/space_test_utils.ts rename to x-pack/platform/test/spaces_api_integration/common/lib/space_test_utils.ts diff --git a/x-pack/test/spaces_api_integration/common/lib/spaces.ts b/x-pack/platform/test/spaces_api_integration/common/lib/spaces.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/lib/spaces.ts rename to x-pack/platform/test/spaces_api_integration/common/lib/spaces.ts diff --git a/x-pack/test/spaces_api_integration/common/lib/types.ts b/x-pack/platform/test/spaces_api_integration/common/lib/types.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/lib/types.ts rename to x-pack/platform/test/spaces_api_integration/common/lib/types.ts diff --git a/x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/kibana.jsonc b/x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/kibana.jsonc similarity index 100% rename from x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/kibana.jsonc rename to x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/kibana.jsonc diff --git a/x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/server/index.ts b/x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/server/index.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/server/index.ts rename to x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/server/index.ts diff --git a/x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/server/plugin.ts b/x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/server/plugin.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/server/plugin.ts rename to x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/server/plugin.ts diff --git a/x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/tsconfig.json b/x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/tsconfig.json similarity index 81% rename from x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/tsconfig.json rename to x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/tsconfig.json index 201ae6ddf08eb..34d55f55ded60 100644 --- a/x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin/tsconfig.json +++ b/x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "isolatedModules": true diff --git a/x-pack/test/spaces_api_integration/common/services.ts b/x-pack/platform/test/spaces_api_integration/common/services.ts similarity index 63% rename from x-pack/test/spaces_api_integration/common/services.ts rename to x-pack/platform/test/spaces_api_integration/common/services.ts index 0e9428124bc2b..fed15b9019419 100644 --- a/x-pack/test/spaces_api_integration/common/services.ts +++ b/x-pack/platform/test/spaces_api_integration/common/services.ts @@ -6,11 +6,16 @@ */ import { services as apiIntegrationServices } from '../../api_integration/services'; -import { services as commonServices } from '../../common/services'; import { RoleScopedSupertestProvider } from '../deployment_agnostic/services/role_scoped_supertest'; export const services = { - ...commonServices, + es: apiIntegrationServices.es, + esArchiver: apiIntegrationServices.esArchiver, + kibanaServer: apiIntegrationServices.kibanaServer, + retry: apiIntegrationServices.retry, + supertest: apiIntegrationServices.supertest, + supertestWithoutAuth: apiIntegrationServices.supertestWithoutAuth, usageAPI: apiIntegrationServices.usageAPI, + spaces: apiIntegrationServices.spaces, roleScopedSupertest: RoleScopedSupertestProvider, }; diff --git a/x-pack/test/spaces_api_integration/common/services/basic_auth_supertest.ts b/x-pack/platform/test/spaces_api_integration/common/services/basic_auth_supertest.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/services/basic_auth_supertest.ts rename to x-pack/platform/test/spaces_api_integration/common/services/basic_auth_supertest.ts diff --git a/x-pack/test/spaces_api_integration/common/services/test_data_loader.ts b/x-pack/platform/test/spaces_api_integration/common/services/test_data_loader.ts similarity index 100% rename from x-pack/test/spaces_api_integration/common/services/test_data_loader.ts rename to x-pack/platform/test/spaces_api_integration/common/services/test_data_loader.ts diff --git a/x-pack/test/spaces_api_integration/common/suites/copy_to_space.agnostic.ts b/x-pack/platform/test/spaces_api_integration/common/suites/copy_to_space.agnostic.ts similarity index 99% rename from x-pack/test/spaces_api_integration/common/suites/copy_to_space.agnostic.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/copy_to_space.agnostic.ts index b98c53118fd64..54797a116f7b1 100644 --- a/x-pack/test/spaces_api_integration/common/suites/copy_to_space.agnostic.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/copy_to_space.agnostic.ts @@ -82,15 +82,18 @@ const UUID_PATTERN = new RegExp( const SPACE_DATA_TO_LOAD: Array<{ spaceName: string | null; dataUrl: string }> = [ { spaceName: null, - dataUrl: 'x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/default_space.json', + dataUrl: + 'x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/default_space.json', }, { spaceName: SPACE_1.id, - dataUrl: 'x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_1.json', + dataUrl: + 'x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/space_1.json', }, { spaceName: SPACE_2.id, - dataUrl: 'x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_2.json', + dataUrl: + 'x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/space_2.json', }, ]; diff --git a/x-pack/test/spaces_api_integration/common/suites/create.agnostic.ts b/x-pack/platform/test/spaces_api_integration/common/suites/create.agnostic.ts similarity index 96% rename from x-pack/test/spaces_api_integration/common/suites/create.agnostic.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/create.agnostic.ts index d4e90d9938c5a..04d31b114d747 100644 --- a/x-pack/test/spaces_api_integration/common/suites/create.agnostic.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/create.agnostic.ts @@ -127,12 +127,12 @@ export function createTestSuiteFactory({ getService }: DeploymentAgnosticFtrProv beforeEach(() => esArchiver.load( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ) ); afterEach(() => esArchiver.unload( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ) ); diff --git a/x-pack/test/spaces_api_integration/common/suites/delete.agnostic.ts b/x-pack/platform/test/spaces_api_integration/common/suites/delete.agnostic.ts similarity index 97% rename from x-pack/test/spaces_api_integration/common/suites/delete.agnostic.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/delete.agnostic.ts index 4d2b597c41d50..f0185893124df 100644 --- a/x-pack/test/spaces_api_integration/common/suites/delete.agnostic.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/delete.agnostic.ts @@ -232,12 +232,12 @@ export function deleteTestSuiteFactory({ getService }: DeploymentAgnosticFtrProv beforeEach(async () => { await esArchiver.load( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ); }); afterEach(() => esArchiver.unload( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ) ); diff --git a/x-pack/test/spaces_api_integration/common/suites/disable_legacy_url_aliases.ts b/x-pack/platform/test/spaces_api_integration/common/suites/disable_legacy_url_aliases.ts similarity index 92% rename from x-pack/test/spaces_api_integration/common/suites/disable_legacy_url_aliases.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/disable_legacy_url_aliases.ts index 02f20cc0a8b8e..91e38f3ee1d2c 100644 --- a/x-pack/test/spaces_api_integration/common/suites/disable_legacy_url_aliases.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/disable_legacy_url_aliases.ts @@ -11,13 +11,13 @@ import type { Agent as SuperTestAgent } from 'supertest'; import type { LegacyUrlAlias } from '@kbn/core-saved-objects-base-server-internal'; import { MAIN_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server'; import expect from '@kbn/expect'; -import { getUrlPrefix } from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/saved_object_test_utils'; + +import { getUrlPrefix } from '../../../saved_object_api_integration/common/lib/saved_object_test_utils'; import type { ExpectResponseBody, TestDefinition, TestSuite, -} from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/types'; - +} from '../../../saved_object_api_integration/common/lib/types'; import { SPACES } from '../lib/spaces'; export interface DisableLegacyUrlAliasesTestDefinition extends TestDefinition { @@ -105,12 +105,12 @@ export function disableLegacyUrlAliasesTestSuiteFactory( describeFn(description, () => { before(() => esArchiver.load( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ) ); after(() => esArchiver.unload( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ) ); diff --git a/x-pack/test/spaces_api_integration/common/suites/get.agnostic.ts b/x-pack/platform/test/spaces_api_integration/common/suites/get.agnostic.ts similarity index 95% rename from x-pack/test/spaces_api_integration/common/suites/get.agnostic.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/get.agnostic.ts index 170b5eb328d53..e9b065dc75321 100644 --- a/x-pack/test/spaces_api_integration/common/suites/get.agnostic.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/get.agnostic.ts @@ -133,13 +133,13 @@ export function getTestSuiteFactory(context: DeploymentAgnosticFtrProviderContex before(async () => { supertest = await roleScopedSupertest.getSupertestWithRoleScope(user!); await esArchiver.load( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ); }); after(async () => { await supertest.destroy(); await esArchiver.unload( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ); }); diff --git a/x-pack/test/spaces_api_integration/common/suites/get_all.agnostic.ts b/x-pack/platform/test/spaces_api_integration/common/suites/get_all.agnostic.ts similarity index 97% rename from x-pack/test/spaces_api_integration/common/suites/get_all.agnostic.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/get_all.agnostic.ts index 9dbe6d7c1f0e9..eab672258540e 100644 --- a/x-pack/test/spaces_api_integration/common/suites/get_all.agnostic.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/get_all.agnostic.ts @@ -175,12 +175,12 @@ export function getAllTestSuiteFactory(context: DeploymentAgnosticFtrProviderCon before(async () => { supertest = await roleScopedSupertest.getSupertestWithRoleScope(user!); await esArchiver.load( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ); }); after(async () => { await esArchiver.unload( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ); await supertest.destroy(); diff --git a/x-pack/test/spaces_api_integration/common/suites/get_shareable_references.ts b/x-pack/platform/test/spaces_api_integration/common/suites/get_shareable_references.ts similarity index 96% rename from x-pack/test/spaces_api_integration/common/suites/get_shareable_references.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/get_shareable_references.ts index 508b74e842b2e..ea1fcef3e6100 100644 --- a/x-pack/test/spaces_api_integration/common/suites/get_shareable_references.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/get_shareable_references.ts @@ -13,16 +13,16 @@ import type { } from '@kbn/core/server'; import expect from '@kbn/expect'; import { deepFreeze } from '@kbn/std'; + import { expectResponses, getUrlPrefix, -} from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/saved_object_test_utils'; +} from '../../../saved_object_api_integration/common/lib/saved_object_test_utils'; import type { ExpectResponseBody, TestDefinition, TestSuite, -} from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/types'; - +} from '../../../saved_object_api_integration/common/lib/types'; import { MULTI_NAMESPACE_SAVED_OBJECT_TEST_CASES as CASES } from '../lib/saved_object_test_cases'; import { SPACES } from '../lib/spaces'; @@ -262,12 +262,12 @@ export function getShareableReferencesTestSuiteFactory(esArchiver: any, supertes describeFn(description, () => { before(() => esArchiver.load( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ) ); after(() => esArchiver.unload( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ) ); diff --git a/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.agnostic.ts b/x-pack/platform/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.agnostic.ts similarity index 98% rename from x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.agnostic.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.agnostic.ts index 2edbcaddcfae3..5e0b7cd3096f4 100644 --- a/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.agnostic.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.agnostic.ts @@ -51,15 +51,18 @@ const NON_EXISTENT_SPACE_ID = 'non_existent_space'; const SPACE_DATA_TO_LOAD: Array<{ spaceName: string | null; dataUrl: string }> = [ { spaceName: null, - dataUrl: 'x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/default_space.json', + dataUrl: + 'x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/default_space.json', }, { spaceName: SPACE_1.id, - dataUrl: 'x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_1.json', + dataUrl: + 'x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/space_1.json', }, { spaceName: SPACE_2.id, - dataUrl: 'x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_2.json', + dataUrl: + 'x-pack/platform/test/spaces_api_integration/common/fixtures/kbn_archiver/space_2.json', }, ]; diff --git a/x-pack/test/spaces_api_integration/common/suites/update.agnostic.ts b/x-pack/platform/test/spaces_api_integration/common/suites/update.agnostic.ts similarity index 95% rename from x-pack/test/spaces_api_integration/common/suites/update.agnostic.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/update.agnostic.ts index b3e1972912f23..e625f217d807a 100644 --- a/x-pack/test/spaces_api_integration/common/suites/update.agnostic.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/update.agnostic.ts @@ -86,13 +86,13 @@ export function updateTestSuiteFactory(context: DeploymentAgnosticFtrProviderCon before(async () => { supertest = await roleScopedSupertest.getSupertestWithRoleScope(user!); await esArchiver.load( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ); }); after(async () => { await supertest.destroy(); await esArchiver.unload( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ); }); diff --git a/x-pack/test/spaces_api_integration/common/suites/update_objects_spaces.ts b/x-pack/platform/test/spaces_api_integration/common/suites/update_objects_spaces.ts similarity index 94% rename from x-pack/test/spaces_api_integration/common/suites/update_objects_spaces.ts rename to x-pack/platform/test/spaces_api_integration/common/suites/update_objects_spaces.ts index 6b4483b056b64..63d122162981b 100644 --- a/x-pack/test/spaces_api_integration/common/suites/update_objects_spaces.ts +++ b/x-pack/platform/test/spaces_api_integration/common/suites/update_objects_spaces.ts @@ -14,16 +14,16 @@ import type { SavedObjectsUpdateObjectsSpacesResponse } from '@kbn/core/server'; import { SavedObjectsErrorHelpers } from '@kbn/core/server'; import { ALL_SAVED_OBJECT_INDICES } from '@kbn/core-saved-objects-server'; import expect from '@kbn/expect'; + import { expectResponses, getUrlPrefix, -} from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/saved_object_test_utils'; +} from '../../../saved_object_api_integration/common/lib/saved_object_test_utils'; import type { ExpectResponseBody, TestDefinition, TestSuite, -} from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/types'; - +} from '../../../saved_object_api_integration/common/lib/types'; import { SPACES } from '../lib/spaces'; export interface UpdateObjectsSpacesTestDefinition extends TestDefinition { @@ -150,12 +150,12 @@ export function updateObjectsSpacesTestSuiteFactory( describeFn(description, () => { before(() => esArchiver.load( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ) ); after(() => esArchiver.unload( - 'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' + 'x-pack/platform/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces' ) ); diff --git a/x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/fixtures/package_registry_config.yml b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/fixtures/package_registry_config.yml new file mode 100644 index 0000000000000..1885fa5c2ebe5 --- /dev/null +++ b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/fixtures/package_registry_config.yml @@ -0,0 +1,2 @@ +package_paths: + - /packages/package-storage diff --git a/x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/serverless.config.base.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/serverless.config.base.ts new file mode 100644 index 0000000000000..5701c4055b454 --- /dev/null +++ b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/serverless.config.base.ts @@ -0,0 +1,142 @@ +/* + * 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 path from 'path'; + +import type { ServerlessProjectType } from '@kbn/es'; +import { ScoutTestRunConfigCategory } from '@kbn/scout-info'; +import type { Config, FtrConfigProviderContext } from '@kbn/test'; +import { defineDockerServersConfig, fleetPackageRegistryDockerImage } from '@kbn/test'; + +import type { DeploymentAgnosticCommonServices } from '../services'; +import { services } from '../services'; + +interface CreateTestConfigOptions { + serverlessProject: ServerlessProjectType; + esServerArgs?: string[]; + kbnServerArgs?: string[]; + services?: T; + testFiles: string[]; + junit: { reportName: string }; + suiteTags?: { include?: string[]; exclude?: string[] }; + tier?: 'oblt_logs_essentials'; +} + +// include settings from elasticsearch controller +// https://github.com/elastic/elasticsearch-controller/blob/main/helm/values.yaml +const esServerArgsFromController = { + es: [], + oblt: [ + 'xpack.apm_data.enabled=true', + // for ML, data frame analytics are not part of this project type + 'xpack.ml.dfa.enabled=false', + ], + security: ['xpack.security.authc.api_key.cache.max_keys=70000'], + chat: [], +}; + +// include settings from kibana controller +// https://github.com/elastic/kibana-controller/blob/main/internal/controllers/kibana/config/config_settings.go +const kbnServerArgsFromController = { + es: [ + // useful for testing (also enabled in MKI QA) + '--coreApp.allowDynamicConfigOverrides=true', + ], + oblt: [ + '--coreApp.allowDynamicConfigOverrides=true', + // defined in MKI control plane + '--xpack.uptime.service.manifestUrl=mockDevUrl', + ], + security: [ + '--coreApp.allowDynamicConfigOverrides=true', + // 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'])}`, + ], + chat: [], +}; + +export function createServerlessTestConfig( + options: CreateTestConfigOptions +) { + return async ({ readConfigFile }: FtrConfigProviderContext): Promise => { + if (options.esServerArgs || options.kbnServerArgs) { + throw new Error( + `FTR doesn't provision custom ES/Kibana server arguments into the serverless project on MKI. + It may lead to unexpected test failures on Cloud. Please contact #appex-qa.` + ); + } + + const packageRegistryConfig = path.join(__dirname, './fixtures/package_registry_config.yml'); + const dockerArgs: string[] = ['-v', `${packageRegistryConfig}:/package-registry/config.yml`]; + + /** + * This is used by CI to set the docker registry port + * you can also define this environment variable locally when running tests which + * will spin up a local docker package registry locally for you + * if this is defined it takes precedence over the `packageRegistryOverride` variable + */ + const dockerRegistryPort: string | undefined = process.env.FLEET_PACKAGE_REGISTRY_PORT; + + const svlSharedConfig = await readConfigFile( + require.resolve('../../../serverless/config.base.ts') + ); + + return { + ...svlSharedConfig.getAll(), + + testConfigCategory: ScoutTestRunConfigCategory.API_TEST, + services: { + // services can be customized, but must extend DeploymentAgnosticCommonServices + ...(options.services || services), + }, + dockerServers: defineDockerServersConfig({ + registry: { + enabled: !!dockerRegistryPort, + image: fleetPackageRegistryDockerImage, + portInContainer: 8080, + port: dockerRegistryPort, + args: dockerArgs, + waitForLogLine: 'package manifests loaded', + waitForLogLineTimeoutMs: 60 * 4 * 1000, // 4 minutes + }, + }), + esTestCluster: { + ...svlSharedConfig.get('esTestCluster'), + serverArgs: [ + ...svlSharedConfig.get('esTestCluster.serverArgs'), + // custom native roles are enabled only for search and security projects + ...(options.serverlessProject !== 'oblt' + ? ['xpack.security.authc.native_roles.enabled=true'] + : []), + ...esServerArgsFromController[options.serverlessProject], + ...(options.tier && options.tier === 'oblt_logs_essentials' + ? [ + 'serverless.project_type=observability', + 'serverless.observability.tier=logs_essentials', + ] + : []), + ], + }, + kbnTestServer: { + ...svlSharedConfig.get('kbnTestServer'), + serverArgs: [ + ...svlSharedConfig.get('kbnTestServer.serverArgs'), + ...kbnServerArgsFromController[options.serverlessProject], + `--serverless=${options.serverlessProject}`, + ...(dockerRegistryPort + ? [`--xpack.fleet.registryUrl=http://localhost:${dockerRegistryPort}`] + : []), + ], + }, + testFiles: options.testFiles, + junit: options.junit, + suiteTags: { + include: options.suiteTags?.include, + exclude: [...(options.suiteTags?.exclude || []), 'skipServerless'], + }, + }; + }; +} diff --git a/x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/stateful.config.base.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/stateful.config.base.ts new file mode 100644 index 0000000000000..859cd561e0bc2 --- /dev/null +++ b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/default_configs/stateful.config.base.ts @@ -0,0 +1,167 @@ +/* + * 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 path from 'path'; + +import { STATEFUL_ROLES_ROOT_PATH } from '@kbn/es'; +import { + MOCK_IDP_ATTRIBUTE_EMAIL, + MOCK_IDP_ATTRIBUTE_NAME, + MOCK_IDP_ATTRIBUTE_PRINCIPAL, + MOCK_IDP_ATTRIBUTE_ROLES, + MOCK_IDP_ENTITY_ID, + MOCK_IDP_REALM_NAME, +} from '@kbn/mock-idp-utils'; +import { REPO_ROOT } from '@kbn/repo-info'; +import { ScoutTestRunConfigCategory } from '@kbn/scout-info'; +import type { FtrConfigProviderContext } from '@kbn/test'; +import { + defineDockerServersConfig, + esTestConfig, + fleetPackageRegistryDockerImage, + kbnTestConfig, + systemIndicesSuperuser, +} from '@kbn/test'; + +import type { DeploymentAgnosticCommonServices } from '../services'; +import { services } from '../services'; + +interface CreateTestConfigOptions { + esServerArgs?: string[]; + kbnServerArgs?: string[]; + services?: T; + testFiles: string[]; + junit: { reportName: string }; + suiteTags?: { include?: string[]; exclude?: string[] }; +} + +export function createStatefulTestConfig( + options: CreateTestConfigOptions +) { + return async ({ readConfigFile }: FtrConfigProviderContext) => { + if (options.esServerArgs || options.kbnServerArgs) { + throw new Error( + `FTR doesn't provision custom ES/Kibana server arguments into the ESS deployment. + It may lead to unexpected test failures on Cloud. Please contact #appex-qa.` + ); + } + + // if config is executed on CI or locally + const isRunOnCI = process.env.CI; + + const packageRegistryConfig = path.join(__dirname, './fixtures/package_registry_config.yml'); + const dockerArgs: string[] = ['-v', `${packageRegistryConfig}:/package-registry/config.yml`]; + + /** + * This is used by CI to set the docker registry port + * you can also define this environment variable locally when running tests which + * will spin up a local docker package registry locally for you + * if this is defined it takes precedence over the `packageRegistryOverride` variable + */ + const dockerRegistryPort: string | undefined = process.env.FLEET_PACKAGE_REGISTRY_PORT; + + const xPackAPITestsConfig = await readConfigFile( + require.resolve('../../../api_integration/config.ts') + ); + + // TODO: move to kbn-es because currently metadata file has hardcoded entityID and Location + const idpPath = require.resolve( + '@kbn/security-api-integration-helpers/saml/idp_metadata_mock_idp.xml' + ); + const samlIdPPlugin = path.resolve( + __dirname, + '../../../../../test/security_api_integration/plugins/saml_provider' + ); + + const servers = { + kibana: { + ...kbnTestConfig.getUrlParts(systemIndicesSuperuser), + protocol: process.env.TEST_CLOUD ? 'https' : 'http', + }, + elasticsearch: { + ...esTestConfig.getUrlParts(), + protocol: process.env.TEST_CLOUD ? 'https' : 'http', + }, + }; + + const kbnUrl = `${servers.kibana.protocol}://${servers.kibana.hostname}:${servers.kibana.port}`; + + return { + servers, + testConfigCategory: ScoutTestRunConfigCategory.API_TEST, + dockerServers: defineDockerServersConfig({ + registry: { + enabled: !!dockerRegistryPort, + image: fleetPackageRegistryDockerImage, + portInContainer: 8080, + port: dockerRegistryPort, + args: dockerArgs, + waitForLogLine: 'package manifests loaded', + waitForLogLineTimeoutMs: 60 * 4 * 1000, // 4 minutes + }, + }), + testFiles: options.testFiles, + security: { disableTestUser: true }, + // services can be customized, but must extend DeploymentAgnosticCommonServices + services: options.services || services, + junit: options.junit, + suiteTags: { + include: options.suiteTags?.include, + exclude: [...(options.suiteTags?.exclude || []), 'skipStateful'], + }, + + esTestCluster: { + ...xPackAPITestsConfig.get('esTestCluster'), + serverArgs: [ + ...xPackAPITestsConfig.get('esTestCluster.serverArgs'), + 'xpack.security.authc.token.enabled=true', + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.order=0`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.idp.metadata.path=${idpPath}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.idp.entity_id=${MOCK_IDP_ENTITY_ID}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.sp.entity_id=${kbnUrl}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.sp.acs=${kbnUrl}/api/security/saml/callback`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.sp.logout=${kbnUrl}/logout`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.principal=${MOCK_IDP_ATTRIBUTE_PRINCIPAL}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.groups=${MOCK_IDP_ATTRIBUTE_ROLES}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.name=${MOCK_IDP_ATTRIBUTE_NAME}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.mail=${MOCK_IDP_ATTRIBUTE_EMAIL}`, + ], + files: [ + // Passing the roles that are equivalent to the ones we have in serverless + path.resolve(REPO_ROOT, STATEFUL_ROLES_ROOT_PATH, 'roles.yml'), + ], + }, + kbnTestServer: { + ...xPackAPITestsConfig.get('kbnTestServer'), + serverArgs: [ + ...xPackAPITestsConfig.get('kbnTestServer.serverArgs'), + // if the config is run locally, explicitly enable mock-idp-plugin for UI role selector + ...(isRunOnCI ? [] : ['--mock_idp_plugin.enabled=true']), + // This ensures that we register the Security SAML API endpoints. + // In the real world the SAML config is injected by control plane. + `--plugin-path=${samlIdPPlugin}`, + '--xpack.cloud.id=ftr_fake_cloud_id', + // Ensure that SAML is used as the default authentication method whenever a user navigates to Kibana. In other + // words, Kibana should attempt to authenticate the user using the provider with the lowest order if the Login + // Selector is disabled (replicating Serverless configuration). By declaring `cloud-basic` with a higher + // order, we indicate that basic authentication can still be used, but only if explicitly requested when the + // user navigates to `/login` page directly and enters username and password in the login form. + '--xpack.security.authc.selector.enabled=false', + `--xpack.security.authc.providers=${JSON.stringify({ + saml: { 'cloud-saml-kibana': { order: 0, realm: MOCK_IDP_REALM_NAME } }, + basic: { 'cloud-basic': { order: 1 } }, + })}`, + `--server.publicBaseUrl=${servers.kibana.protocol}://${servers.kibana.hostname}:${servers.kibana.port}`, + ...(dockerRegistryPort + ? [`--xpack.fleet.registryUrl=http://localhost:${dockerRegistryPort}`] + : []), + // @ts-expect-error + ...(options?.kbnTestServer?.serverArgs ?? []), + ], + }, + }; + }; +} diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/ftr_provider_context.d.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/ftr_provider_context.d.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/ftr_provider_context.d.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/ftr_provider_context.d.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/copy_to_space.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/copy_to_space.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/copy_to_space.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/copy_to_space.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/index_basic.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/index_basic.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/index_basic.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/index_basic.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/index_trial.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/index_trial.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/index_trial.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/copy_to_space/index_trial.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/create.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/create.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/create.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/create.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/delete.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/delete.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/delete.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/delete.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/get.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/get.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/get.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/get.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/get_all.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/get_all.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/get_all.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/get_all.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index.serverless.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index.serverless.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index.serverless.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index.serverless.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index_basic.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index_basic.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index_basic.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index_basic.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index_trial.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index_trial.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index_trial.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/index_trial.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/resolve_copy_to_space_conflicts.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/resolve_copy_to_space_conflicts.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/resolve_copy_to_space_conflicts.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/resolve_copy_to_space_conflicts.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/update.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/update.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/update.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/apis/update.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.config.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.config.ts similarity index 78% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.config.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.config.ts index e9e47d92c2d45..b60a3d7523877 100644 --- a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.config.ts +++ b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.config.ts @@ -5,11 +5,10 @@ * 2.0. */ -import { createServerlessTestConfig } from '../../../api_integration/deployment_agnostic/default_configs/serverless.config.base'; +import { createServerlessTestConfig } from '../default_configs/serverless.config.base'; import { services } from '../services'; export default createServerlessTestConfig({ - // @ts-expect-error services, serverlessProject: 'security', testFiles: [require.resolve('./apis/index.serverless')], diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.copy_to_space.config.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.copy_to_space.config.ts similarity index 68% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.copy_to_space.config.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.copy_to_space.config.ts index c5fc1f4e95d90..b3947f8750f87 100644 --- a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.copy_to_space.config.ts +++ b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/serverless.copy_to_space.config.ts @@ -5,11 +5,10 @@ * 2.0. */ -import { createServerlessTestConfig } from '../../../api_integration/deployment_agnostic/default_configs/serverless.config.base'; +import { createServerlessTestConfig } from '../default_configs/serverless.config.base'; import { services } from '../services'; export default createServerlessTestConfig({ - // @ts-expect-error roleScopedSupertest service accepts a user not just a user role and is different from the one in the common services services, serverlessProject: 'security', testFiles: [require.resolve('./apis/copy_to_space/index_trial')], diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_basic.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_basic.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_basic.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_basic.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_trial.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_trial.ts similarity index 67% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_trial.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_trial.ts index 791d39fca5e18..6afeb2d1061fe 100644 --- a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_trial.ts +++ b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_trial.ts @@ -5,11 +5,10 @@ * 2.0. */ -import { createStatefulTestConfig } from '../../../api_integration/deployment_agnostic/default_configs/stateful.config.base'; +import { createStatefulTestConfig } from '../default_configs/stateful.config.base'; import { services } from '../services'; export default createStatefulTestConfig({ - // @ts-expect-error roleScopedSupertest service accepts a user not just a user role and is different from the one in the common services services, testFiles: [require.resolve('./apis/index_trial')], junit: { diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_basic.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_basic.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_basic.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_basic.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_trial.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_trial.ts similarity index 67% rename from x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_trial.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_trial.ts index 995035b733491..39ce864280219 100644 --- a/x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_trial.ts +++ b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_trial.ts @@ -5,11 +5,10 @@ * 2.0. */ -import { createStatefulTestConfig } from '../../../api_integration/deployment_agnostic/default_configs/stateful.config.base'; +import { createStatefulTestConfig } from '../default_configs/stateful.config.base'; import { services } from '../services'; export default createStatefulTestConfig({ - // @ts-expect-error roleScopedSupertest service accepts a user not just a user role and is different from the one in the common services services, testFiles: [require.resolve('./apis/copy_to_space/index_trial')], junit: { diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/services/index.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/services/index.ts similarity index 82% rename from x-pack/test/spaces_api_integration/deployment_agnostic/services/index.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/services/index.ts index 656aab1cab731..b1d12284436b0 100644 --- a/x-pack/test/spaces_api_integration/deployment_agnostic/services/index.ts +++ b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/services/index.ts @@ -6,15 +6,16 @@ */ import { RoleScopedSupertestProvider } from './role_scoped_supertest'; -import { services as deploymentAgnosticServices } from '../../../api_integration/deployment_agnostic/services'; import { services as apiIntegrationServices } from '../../../api_integration/services'; -import { services as commonServices } from '../../../common/services'; +import { services as deploymentAgnosticServices } from '../../../api_integration_deployment_agnostic/services'; export type { SupertestWithRoleScopeType } from './role_scoped_supertest'; export const services = { - ...commonServices, ...deploymentAgnosticServices, usageAPI: apiIntegrationServices.usageAPI, + spaces: apiIntegrationServices.spaces, roleScopedSupertest: RoleScopedSupertestProvider, }; + +export type DeploymentAgnosticCommonServices = typeof services; diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/services/role_scoped_supertest.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/services/role_scoped_supertest.ts similarity index 95% rename from x-pack/test/spaces_api_integration/deployment_agnostic/services/role_scoped_supertest.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/services/role_scoped_supertest.ts index f9f07023ec6e8..984649f46c660 100644 --- a/x-pack/test/spaces_api_integration/deployment_agnostic/services/role_scoped_supertest.ts +++ b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/services/role_scoped_supertest.ts @@ -5,8 +5,8 @@ * 2.0. */ -import type { RequestHeadersOptions } from '../../../api_integration/deployment_agnostic/services/role_scoped_supertest'; -import { SupertestWithRoleScope } from '../../../api_integration/deployment_agnostic/services/role_scoped_supertest'; +import type { RequestHeadersOptions } from '../../../api_integration_deployment_agnostic/services/role_scoped_supertest'; +import { SupertestWithRoleScope } from '../../../api_integration_deployment_agnostic/services/role_scoped_supertest'; import { getRoleDefinitionForUser, isBuiltInRole } from '../../common/lib/authentication'; import type { TestDefinitionAuthentication as User } from '../../common/lib/types'; import { SupertestWithBasicAuth } from '../../common/services/basic_auth_supertest'; diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/copy_to_space.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/copy_to_space.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/copy_to_space.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/copy_to_space.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/create.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/create.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/create.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/create.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/delete.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/delete.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/delete.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/delete.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/get.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/get.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/get.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/get.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/get_all.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/get_all.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/get_all.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/get_all.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/index.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/index.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/index.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/index.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/resolve_copy_to_space_conflicts.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/resolve_copy_to_space_conflicts.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/resolve_copy_to_space_conflicts.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/resolve_copy_to_space_conflicts.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/update.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/update.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/update.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/apis/update.ts diff --git a/x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/config.ts b/x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/config.ts similarity index 100% rename from x-pack/test/spaces_api_integration/deployment_agnostic/spaces_only/config.ts rename to x-pack/platform/test/spaces_api_integration/deployment_agnostic/spaces_only/config.ts diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/disable_legacy_url_aliases.ts b/x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/disable_legacy_url_aliases.ts similarity index 93% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/disable_legacy_url_aliases.ts rename to x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/disable_legacy_url_aliases.ts index 86a5bca94f133..2498ce166bcce 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/disable_legacy_url_aliases.ts +++ b/x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/disable_legacy_url_aliases.ts @@ -5,9 +5,8 @@ * 2.0. */ -import { getTestScenarios } from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/saved_object_test_utils'; -import type { TestUser } from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/types'; - +import { getTestScenarios } from '../../../saved_object_api_integration/common/lib/saved_object_test_utils'; +import type { TestUser } from '../../../saved_object_api_integration/common/lib/types'; import type { FtrProviderContext } from '../../common/ftr_provider_context'; import { SPACES } from '../../common/lib/spaces'; import type { DisableLegacyUrlAliasesTestDefinition } from '../../common/suites/disable_legacy_url_aliases'; diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/get_all.ts b/x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/get_all.ts similarity index 100% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/get_all.ts rename to x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/get_all.ts diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/get_shareable_references.ts b/x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/get_shareable_references.ts similarity index 92% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/get_shareable_references.ts rename to x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/get_shareable_references.ts index 1c84d27ab77d3..093e01dd8fbbf 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/get_shareable_references.ts +++ b/x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/get_shareable_references.ts @@ -5,9 +5,8 @@ * 2.0. */ -import { getTestScenarios } from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/saved_object_test_utils'; -import type { TestUser } from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/types'; - +import { getTestScenarios } from '../../../saved_object_api_integration/common/lib/saved_object_test_utils'; +import type { TestUser } from '../../../saved_object_api_integration/common/lib/types'; import type { FtrProviderContext } from '../../common/ftr_provider_context'; import { SPACES } from '../../common/lib/spaces'; import type { diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/index.ts b/x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/index.ts similarity index 100% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/index.ts rename to x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/index.ts diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts b/x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts similarity index 96% rename from x-pack/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts rename to x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts index d595e19e0d057..ab7e4db5908f6 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts +++ b/x-pack/platform/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts @@ -8,9 +8,8 @@ import { getTestScenarios, testCaseFailures, -} from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/saved_object_test_utils'; -import type { TestUser } from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/types'; - +} from '../../../saved_object_api_integration/common/lib/saved_object_test_utils'; +import type { TestUser } from '../../../saved_object_api_integration/common/lib/types'; import type { FtrProviderContext } from '../../common/ftr_provider_context'; import { MULTI_NAMESPACE_SAVED_OBJECT_TEST_CASES as CASES } from '../../common/lib/saved_object_test_cases'; import { SPACES } from '../../common/lib/spaces'; diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts b/x-pack/platform/test/spaces_api_integration/security_and_spaces/config_basic.ts similarity index 100% rename from x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts rename to x-pack/platform/test/spaces_api_integration/security_and_spaces/config_basic.ts diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/config_trial.ts b/x-pack/platform/test/spaces_api_integration/security_and_spaces/config_trial.ts similarity index 100% rename from x-pack/test/spaces_api_integration/security_and_spaces/config_trial.ts rename to x-pack/platform/test/spaces_api_integration/security_and_spaces/config_trial.ts diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/disable_legacy_url_aliases.ts b/x-pack/platform/test/spaces_api_integration/spaces_only/apis/disable_legacy_url_aliases.ts similarity index 100% rename from x-pack/test/spaces_api_integration/spaces_only/apis/disable_legacy_url_aliases.ts rename to x-pack/platform/test/spaces_api_integration/spaces_only/apis/disable_legacy_url_aliases.ts diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/get_shareable_references.ts b/x-pack/platform/test/spaces_api_integration/spaces_only/apis/get_shareable_references.ts similarity index 94% rename from x-pack/test/spaces_api_integration/spaces_only/apis/get_shareable_references.ts rename to x-pack/platform/test/spaces_api_integration/spaces_only/apis/get_shareable_references.ts index 302caecfae0d6..15fef24ad0d69 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/get_shareable_references.ts +++ b/x-pack/platform/test/spaces_api_integration/spaces_only/apis/get_shareable_references.ts @@ -5,8 +5,7 @@ * 2.0. */ -import { getTestScenarios } from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/saved_object_test_utils'; - +import { getTestScenarios } from '../../../saved_object_api_integration/common/lib/saved_object_test_utils'; import type { FtrProviderContext } from '../../common/ftr_provider_context'; import { SPACES } from '../../common/lib/spaces'; import type { GetShareableReferencesTestCase } from '../../common/suites/get_shareable_references'; diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/index.ts b/x-pack/platform/test/spaces_api_integration/spaces_only/apis/index.ts similarity index 100% rename from x-pack/test/spaces_api_integration/spaces_only/apis/index.ts rename to x-pack/platform/test/spaces_api_integration/spaces_only/apis/index.ts diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts b/x-pack/platform/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts similarity index 98% rename from x-pack/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts rename to x-pack/platform/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts index 77dbcdd4967a3..c45aa9edc6741 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts +++ b/x-pack/platform/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts @@ -8,8 +8,7 @@ import { getTestScenarios, testCaseFailures, -} from '@kbn/test-suites-xpack-platform/saved_object_api_integration/common/lib/saved_object_test_utils'; - +} from '../../../saved_object_api_integration/common/lib/saved_object_test_utils'; import type { FtrProviderContext } from '../../common/ftr_provider_context'; import { MULTI_NAMESPACE_SAVED_OBJECT_TEST_CASES as CASES } from '../../common/lib/saved_object_test_cases'; import { SPACES } from '../../common/lib/spaces'; diff --git a/x-pack/test/spaces_api_integration/spaces_only/config.ts b/x-pack/platform/test/spaces_api_integration/spaces_only/config.ts similarity index 100% rename from x-pack/test/spaces_api_integration/spaces_only/config.ts rename to x-pack/platform/test/spaces_api_integration/spaces_only/config.ts diff --git a/x-pack/test/spaces_api_integration/spaces_only/telemetry/index.ts b/x-pack/platform/test/spaces_api_integration/spaces_only/telemetry/index.ts similarity index 100% rename from x-pack/test/spaces_api_integration/spaces_only/telemetry/index.ts rename to x-pack/platform/test/spaces_api_integration/spaces_only/telemetry/index.ts diff --git a/x-pack/test/spaces_api_integration/spaces_only/telemetry/telemetry.ts b/x-pack/platform/test/spaces_api_integration/spaces_only/telemetry/telemetry.ts similarity index 100% rename from x-pack/test/spaces_api_integration/spaces_only/telemetry/telemetry.ts rename to x-pack/platform/test/spaces_api_integration/spaces_only/telemetry/telemetry.ts diff --git a/x-pack/platform/test/tsconfig.json b/x-pack/platform/test/tsconfig.json index 14554165192a5..72aa6ce80eed7 100644 --- a/x-pack/platform/test/tsconfig.json +++ b/x-pack/platform/test/tsconfig.json @@ -115,5 +115,8 @@ "@kbn/reporting-export-types-pdf-common", "@kbn/reporting-export-types-png-common", "@kbn/reporting-server", + "@kbn/lens-plugin", + "@kbn/mock-idp-utils", + "@kbn/es", ] } diff --git a/yarn.lock b/yarn.lock index 2615b3c6d3000..acbeba3d02b70 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7693,7 +7693,7 @@ version "0.0.0" uid "" -"@kbn/spaces-test-plugin@link:x-pack/test/spaces_api_integration/common/plugins/spaces_test_plugin": +"@kbn/spaces-test-plugin@link:x-pack/platform/test/spaces_api_integration/common/plugins/spaces_test_plugin": version "0.0.0" uid ""