From 0894c8b0d9ea98a8c99ec329a560800110325975 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Thu, 29 Aug 2024 13:47:25 -0500 Subject: [PATCH] Revert "[FTR] Refactor test/common/services/* -> packages/kbn-ftr-common-functional-[ui-]services/* (#189051)" This reverts commit 09a365850e18822b4474fac1a1c033ab6da511a8. --- .../development-functional-tests.asciidoc | 10 ++-- .../index.ts | 9 ---- .../services/all.ts | 14 ----- .../tsconfig.json | 7 --- .../index.ts | 1 - .../services/all.ts | 2 - .../services/ftr_provider_context.ts | 8 +-- scripts/saved_objs_info.js | 2 +- test/analytics/services/index.ts | 7 +-- .../apis/console/autocomplete_entities.ts | 46 ++++++++++------- .../api_integration/apis/console/helpers.ts | 4 +- test/api_integration/services/index.ts | 7 ++- test/common/config.js | 2 + test/common/ftr_provider_context.ts | 14 +++++ .../common}/services/bsearch.ts | 3 +- test/common/services/console.ts | 15 ++++++ .../common}/services/deployment.ts | 2 +- .../common}/services/es_delete_all_indices.ts | 2 +- test/common/services/index.ts | 43 +++++++--------- .../common}/services/index_patterns.ts | 7 ++- .../common}/services/randomness.ts | 2 +- .../services/saved_object_info/index.ts | 0 .../saved_object_info/saved_object_info.ts | 2 +- .../saved_objects_info_svc.md | 0 .../services/saved_object_info/use_with_jq.md | 0 .../services/saved_object_info/utils.ts | 0 .../common}/services/security/index.ts | 2 +- .../common}/services/security/role.ts | 0 .../services/security/role_mappings.ts | 0 .../common}/services/security/security.ts | 2 +- .../services/security/system_indices_user.ts | 2 +- .../common}/services/security/test_user.ts | 5 +- .../common}/services/security/user.ts | 0 .../apps/discover/ftr_provider_context.d.ts | 8 +-- test/functional/services/index.ts | 4 +- test/health_gateway/services/index.ts | 6 +-- test/server_integration/config.base.js | 4 +- test/server_integration/services/types.d.ts | 9 +--- test/tsconfig.json | 3 ++ .../apis/cloud_security_posture/helper.ts | 2 +- .../apis/telemetry/telemetry.ts | 2 +- x-pack/test/common/services/bsearch_secure.ts | 4 +- x-pack/test/common/services/index.ts | 6 +-- .../fleet_api_integration/apis/test_users.ts | 2 +- x-pack/test/fleet_cypress/services.ts | 7 +-- x-pack/test/osquery_cypress/services.ts | 8 +-- .../helpers/create_or_update_user.ts | 2 +- .../common/create_profiling_users/index.ts | 2 +- .../test/saved_objects_field_count/config.ts | 5 -- .../security_solution_serverless_utils.ts | 2 +- .../config/services/types.ts | 2 +- .../entity_analytics/utils/users_and_roles.ts | 2 +- .../tests/host_details.ts | 2 +- .../tests/hosts.ts | 2 +- .../tests/uncommon_processes.ts | 2 +- .../tests/network_details.ts | 2 +- .../tests/network_dns.ts | 2 +- .../tests/network_top_n_flow.ts | 2 +- .../trial_license_complete_tier/tests/tls.ts | 3 +- .../tests/overview_host.ts | 2 +- .../tests/overview_network.ts | 2 +- .../tests/authentications.ts | 2 +- .../tests/users.ts | 3 +- .../tests/events.ts | 3 +- .../tests/timeline_details.ts | 3 +- .../tsconfig.json | 2 +- .../threat_intelligence_cypress/config.ts | 5 +- .../upgrade_assistant_integration/config.js | 7 +-- .../common/console/autocomplete_entities.ts | 51 +++++++++++++------ .../shared/services/bsearch_secure.ts | 4 +- 70 files changed, 185 insertions(+), 214 deletions(-) rename packages/kbn-ftr-common-functional-services/services/console.ts => test/api_integration/apis/console/helpers.ts (95%) create mode 100644 test/common/ftr_provider_context.ts rename {packages/kbn-ftr-common-functional-services => test/common}/services/bsearch.ts (98%) create mode 100644 test/common/services/console.ts rename {packages/kbn-ftr-common-functional-services => test/common}/services/deployment.ts (96%) rename {packages/kbn-ftr-common-functional-services => test/common}/services/es_delete_all_indices.ts (97%) rename {packages/kbn-ftr-common-functional-services => test/common}/services/index_patterns.ts (91%) rename {packages/kbn-ftr-common-functional-services => test/common}/services/randomness.ts (97%) rename {packages/kbn-ftr-common-functional-services => test/common}/services/saved_object_info/index.ts (100%) rename {packages/kbn-ftr-common-functional-services => test/common}/services/saved_object_info/saved_object_info.ts (97%) rename {packages/kbn-ftr-common-functional-services => test/common}/services/saved_object_info/saved_objects_info_svc.md (100%) rename {packages/kbn-ftr-common-functional-services => test/common}/services/saved_object_info/use_with_jq.md (100%) rename {packages/kbn-ftr-common-functional-services => test/common}/services/saved_object_info/utils.ts (100%) rename {packages/kbn-ftr-common-functional-ui-services => test/common}/services/security/index.ts (83%) rename {packages/kbn-ftr-common-functional-ui-services => test/common}/services/security/role.ts (100%) rename {packages/kbn-ftr-common-functional-ui-services => test/common}/services/security/role_mappings.ts (100%) rename {packages/kbn-ftr-common-functional-ui-services => test/common}/services/security/security.ts (95%) rename {packages/kbn-ftr-common-functional-ui-services => test/common}/services/security/system_indices_user.ts (97%) rename {packages/kbn-ftr-common-functional-ui-services => test/common}/services/security/test_user.ts (96%) rename {packages/kbn-ftr-common-functional-ui-services => test/common}/services/security/user.ts (100%) diff --git a/docs/developer/contributing/development-functional-tests.asciidoc b/docs/developer/contributing/development-functional-tests.asciidoc index 88163ebb6804b..23d43480eb090 100644 --- a/docs/developer/contributing/development-functional-tests.asciidoc +++ b/docs/developer/contributing/development-functional-tests.asciidoc @@ -203,7 +203,7 @@ Tests should run at the positive security boundary condition, meaning that they The functional UI tests now default to logging in with a user named `test_user` and the roles of this user can be changed dynamically without logging in and out. -In order to achieve this a new service was introduced called `createTestUserService` (see `packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts`). The purpose of this test user service is to create roles defined in the test config files and setRoles() or restoreDefaults(). +In order to achieve this a new service was introduced called `createTestUserService` (see `test/common/services/security/test_user.ts`). The purpose of this test user service is to create roles defined in the test config files and setRoles() or restoreDefaults(). An example of how to set the role like how its defined below: @@ -366,14 +366,14 @@ await testSubjects.click(‘containerButton’); ** `find.allByCssSelector()` **retry:**::: -// * Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/retry/retry.ts[packages/kbn-ftr-common-functional-services/services/retry/retry.ts] +// * Source: {kibana-blob}test/common/services/retry/retry.ts[test/common/services/retry/retry.ts] * Helpers for retrying operations * Popular methods: ** `retry.try(fn, onFailureBlock)` - Execute `fn` in a loop until it succeeds or the default timeout elapses. The optional `onFailureBlock` is executed before each retry attempt. ** `retry.tryForTime(ms, fn, onFailureBlock)` - Execute `fn` in a loop until it succeeds or `ms` milliseconds elapses. The optional `onFailureBlock` is executed before each retry attempt. **kibanaServer:**::: -// * Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/kibana_server/kibana_server.ts[packages/kbn-ftr-common-functional-services/services/kibana_server/kibana_server.ts] +// * Source: {kibana-blob}test/common/services/kibana_server/kibana_server.js[test/common/services/kibana_server/kibana_server.js] * Helpers for interacting with {kib}'s server * Commonly used methods: ** `kibanaServer.uiSettings.update()` @@ -381,7 +381,7 @@ await testSubjects.click(‘containerButton’); ** `kibanaServer.status.getOverallState()` **esArchiver:**::: -// * Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/es_archiver.ts[packages/kbn-ftr-common-functional-services/services/es_archiver.ts] +// * Source: {kibana-blob}test/common/services/es_archiver.ts[test/common/services/es_archiver.ts] * Load/unload archives created with the `esArchiver` * Popular methods: ** `esArchiver.load(path)` @@ -393,7 +393,7 @@ Full list of services that are used in functional tests can be found here: {kiba **Low-level utilities:**::: * es -// ** Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/es.ts[packages/kbn-ftr-common-functional-services/services/es.ts] +// ** Source: {kibana-blob}test/common/services/es.ts[test/common/services/es.ts] ** {es} client ** Higher level options: `kibanaServer.uiSettings` or `esArchiver` * remote diff --git a/packages/kbn-ftr-common-functional-services/index.ts b/packages/kbn-ftr-common-functional-services/index.ts index 36d76c7e2ffd7..3cc6df44adf01 100644 --- a/packages/kbn-ftr-common-functional-services/index.ts +++ b/packages/kbn-ftr-common-functional-services/index.ts @@ -10,7 +10,6 @@ import { ProvidedType } from '@kbn/test'; export { services as commonFunctionalServices } from './services/all'; import { KibanaServerProvider } from './services/kibana_server'; -export { KibanaServerProvider } from './services/kibana_server'; export type KibanaServer = ProvidedType; export { RetryService } from './services/retry'; @@ -19,7 +18,6 @@ import { EsArchiverProvider } from './services/es_archiver'; export type EsArchiver = ProvidedType; import { EsProvider } from './services/es'; -export { EsProvider } from './services/es'; export type Es = ProvidedType; import { SupertestWithoutAuthProvider } from './services/supertest_without_auth'; @@ -31,10 +29,3 @@ import { SamlAuthProvider } from './services/saml_auth/saml_auth_provider'; export type SamlAuthProviderType = ProvidedType; export type { FtrProviderContext } from './services/ftr_provider_context'; -export { runSavedObjInfoSvc } from './services/saved_object_info'; - -export type { BsearchService, SendOptions } from './services/bsearch'; -export { SavedObjectInfoService } from './services/saved_object_info'; -export { DeploymentService } from './services/deployment'; -export { IndexPatternsService } from './services/index_patterns'; -export { RandomnessService } from './services/randomness'; diff --git a/packages/kbn-ftr-common-functional-services/services/all.ts b/packages/kbn-ftr-common-functional-services/services/all.ts index c6c0fb792bb81..49308faeb3dd0 100644 --- a/packages/kbn-ftr-common-functional-services/services/all.ts +++ b/packages/kbn-ftr-common-functional-services/services/all.ts @@ -10,13 +10,6 @@ import { EsArchiverProvider } from './es_archiver'; import { EsProvider } from './es'; import { KibanaServerProvider } from './kibana_server'; import { RetryService } from './retry'; -import { BsearchService } from './bsearch'; -import { ConsoleProvider } from './console'; -import { DeploymentService } from './deployment'; -import { EsDeleteAllIndicesProvider } from './es_delete_all_indices'; -import { IndexPatternsService } from './index_patterns'; -import { SavedObjectInfoService } from './saved_object_info'; -import { RandomnessService } from './randomness'; import { SupertestWithoutAuthProvider } from './supertest_without_auth'; import { SamlAuthProvider } from './saml_auth'; @@ -25,13 +18,6 @@ export const services = { kibanaServer: KibanaServerProvider, esArchiver: EsArchiverProvider, retry: RetryService, - bsearch: BsearchService, - console: ConsoleProvider, - deployment: DeploymentService, - esDeleteAllIndices: EsDeleteAllIndicesProvider, - indexPatterns: IndexPatternsService, - savedObjectInfo: SavedObjectInfoService, - randomness: RandomnessService, supertestWithoutAuth: SupertestWithoutAuthProvider, samlAuth: SamlAuthProvider, }; diff --git a/packages/kbn-ftr-common-functional-services/tsconfig.json b/packages/kbn-ftr-common-functional-services/tsconfig.json index 490eed5f7ac0e..56a442ad2f5a9 100644 --- a/packages/kbn-ftr-common-functional-services/tsconfig.json +++ b/packages/kbn-ftr-common-functional-services/tsconfig.json @@ -16,15 +16,8 @@ "@kbn/es-archiver", "@kbn/test", "@kbn/expect", - "@kbn/search-types", - "@kbn/core-http-common", - "@kbn/bfetch-plugin", - "@kbn/data-plugin", - "@kbn/dev-cli-runner", - "@kbn/dev-cli-errors", "@kbn/repo-info", "@kbn/es", - "@kbn/data-views-plugin" ], "exclude": [ "target/**/*", diff --git a/packages/kbn-ftr-common-functional-ui-services/index.ts b/packages/kbn-ftr-common-functional-ui-services/index.ts index f5f5b9df5b8ae..cd383a03e5f5d 100644 --- a/packages/kbn-ftr-common-functional-ui-services/index.ts +++ b/packages/kbn-ftr-common-functional-ui-services/index.ts @@ -22,4 +22,3 @@ export { } from './services/remote/network_profiles'; export type { TimeoutOpt } from './types'; export { TestSubjects } from './services/test_subjects'; -export { SecurityService } from './services/security'; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/all.ts b/packages/kbn-ftr-common-functional-ui-services/services/all.ts index 610697c69dfbf..bffa7468e14ea 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/all.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/all.ts @@ -12,7 +12,6 @@ import { FindProvider } from './find'; import { TestSubjects } from './test_subjects'; import { BrowserProvider } from './browser'; import { ToastsService } from './toasts'; -import { SecurityServiceProvider } from './security'; export const services = { retryOnStale: RetryOnStaleProvider, @@ -21,5 +20,4 @@ export const services = { testSubjects: TestSubjects, browser: BrowserProvider, toasts: ToastsService, - security: SecurityServiceProvider, }; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts b/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts index 6f589ac6d1bb4..992fe27059e45 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts @@ -7,18 +7,12 @@ */ import { GenericFtrProviderContext, GenericFtrService } from '@kbn/test'; -import { - RetryService, - EsProvider, - KibanaServerProvider, -} from '@kbn/ftr-common-functional-services'; +import { RetryService } from '@kbn/ftr-common-functional-services'; import { services as commonFunctionalUiServices } from './all'; const services = { ...commonFunctionalUiServices, retry: RetryService, - es: EsProvider, - kibanaServer: KibanaServerProvider, }; export type FtrProviderContext = GenericFtrProviderContext; diff --git a/scripts/saved_objs_info.js b/scripts/saved_objs_info.js index 229565921ba90..f17a2897b83da 100644 --- a/scripts/saved_objs_info.js +++ b/scripts/saved_objs_info.js @@ -7,4 +7,4 @@ */ require('../src/setup_node_env'); -require('@kbn/ftr-common-functional-services').runSavedObjInfoSvc(); +require('@kbn/test-suites-src/common/services/saved_object_info').runSavedObjInfoSvc(); diff --git a/test/analytics/services/index.ts b/test/analytics/services/index.ts index 0d3465986249a..0c75df9bc2050 100644 --- a/test/analytics/services/index.ts +++ b/test/analytics/services/index.ts @@ -7,17 +7,14 @@ */ import { GenericFtrProviderContext } from '@kbn/test'; -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; - +import { services as commonServices } from '../../common/services'; import { services as functionalServices } from '../../functional/services'; import { pageObjects } from '../../functional/page_objects'; import { KibanaEBTServerProvider, KibanaEBTUIProvider } from './kibana_ebt'; export const services = { - ...commonFunctionalServices, - ...commonFunctionalUIServices, + ...commonServices, ...functionalServices, kibana_ebt_server: KibanaEBTServerProvider, kibana_ebt_ui: KibanaEBTUIProvider, diff --git a/test/api_integration/apis/console/autocomplete_entities.ts b/test/api_integration/apis/console/autocomplete_entities.ts index 1993ef1f7fe19..a410e50950cd1 100644 --- a/test/api_integration/apis/console/autocomplete_entities.ts +++ b/test/api_integration/apis/console/autocomplete_entities.ts @@ -8,11 +8,25 @@ import expect from '@kbn/expect'; import type { FtrProviderContext } from '../../ftr_provider_context'; +import { helpers } from './helpers'; export default ({ getService }: FtrProviderContext) => { - const console = getService('console'); - const supertest = getService('supertest'); + const { + createIndex, + createAlias, + createLegacyTemplate, + createIndexTemplate, + createComponentTemplate, + createDataStream, + deleteIndex, + deleteAlias, + deleteLegacyTemplate, + deleteIndexTemplate, + deleteComponentTemplate, + deleteDataStream, + } = helpers(getService); + const supertest = getService('supertest'); const sendRequest = (query: object) => supertest.get('/api/console/autocomplete_entities').query(query); @@ -26,26 +40,22 @@ export default ({ getService }: FtrProviderContext) => { before(async () => { // Setup indices, aliases, templates, and data streams - await console.createIndex(indexName); - await console.createAlias(indexName, aliasName); - await console.createComponentTemplate(componentTemplateName); - await console.createIndexTemplate( - indexTemplateName, - [dataStreamName], - [componentTemplateName] - ); - await console.createDataStream(dataStreamName); - await console.createLegacyTemplate(legacyTemplateName); + await createIndex(indexName); + await createAlias(indexName, aliasName); + await createComponentTemplate(componentTemplateName); + await createIndexTemplate(indexTemplateName, [dataStreamName], [componentTemplateName]); + await createDataStream(dataStreamName); + await createLegacyTemplate(legacyTemplateName); }); after(async () => { // Cleanup indices, aliases, templates, and data streams - await console.deleteAlias(indexName, aliasName); - await console.deleteIndex(indexName); - await console.deleteDataStream(dataStreamName); - await console.deleteIndexTemplate(indexTemplateName); - await console.deleteComponentTemplate(componentTemplateName); - await console.deleteLegacyTemplate(legacyTemplateName); + await deleteAlias(indexName, aliasName); + await deleteIndex(indexName); + await deleteDataStream(dataStreamName); + await deleteIndexTemplate(indexTemplateName); + await deleteComponentTemplate(componentTemplateName); + await deleteLegacyTemplate(legacyTemplateName); }); it('should not succeed if no settings are provided in query params', async () => { diff --git a/packages/kbn-ftr-common-functional-services/services/console.ts b/test/api_integration/apis/console/helpers.ts similarity index 95% rename from packages/kbn-ftr-common-functional-services/services/console.ts rename to test/api_integration/apis/console/helpers.ts index 1ca5128d83f7c..cfd1365f212fa 100644 --- a/packages/kbn-ftr-common-functional-services/services/console.ts +++ b/test/api_integration/apis/console/helpers.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -import type { FtrProviderContext } from './ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; -export function ConsoleProvider({ getService }: FtrProviderContext) { +export function helpers(getService: FtrProviderContext['getService']) { const client = getService('es'); const createIndex = async (indexName: string) => { diff --git a/test/api_integration/services/index.ts b/test/api_integration/services/index.ts index f72460b7ffc5f..42a2616b781ac 100644 --- a/test/api_integration/services/index.ts +++ b/test/api_integration/services/index.ts @@ -6,13 +6,12 @@ * Side Public License, v 1. */ -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; +import { services as commonServices } from '../../common/services'; + import { KibanaSupertestProvider, ElasticsearchSupertestProvider } from './supertest'; export const services = { - ...commonFunctionalServices, - ...commonFunctionalUIServices, + ...commonServices, supertest: KibanaSupertestProvider, esSupertest: ElasticsearchSupertestProvider, }; diff --git a/test/common/config.js b/test/common/config.js index 8f2d6b7e14018..163703a693356 100644 --- a/test/common/config.js +++ b/test/common/config.js @@ -9,6 +9,7 @@ import path from 'path'; import { format as formatUrl } from 'url'; import { esTestConfig, kbnTestConfig, kibanaServerTestUser } from '@kbn/test'; +import { services } from './services'; export default function () { const servers = { @@ -84,5 +85,6 @@ export default function () { })}`, ], }, + services, }; } diff --git a/test/common/ftr_provider_context.ts b/test/common/ftr_provider_context.ts new file mode 100644 index 0000000000000..6d21aedfe1d5e --- /dev/null +++ b/test/common/ftr_provider_context.ts @@ -0,0 +1,14 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { GenericFtrProviderContext, GenericFtrService } from '@kbn/test'; + +import { services } from './services'; + +export type FtrProviderContext = GenericFtrProviderContext; +export class FtrService extends GenericFtrService {} diff --git a/packages/kbn-ftr-common-functional-services/services/bsearch.ts b/test/common/services/bsearch.ts similarity index 98% rename from packages/kbn-ftr-common-functional-services/services/bsearch.ts rename to test/common/services/bsearch.ts index b36834dedbca5..81063813cec5f 100644 --- a/packages/kbn-ftr-common-functional-services/services/bsearch.ts +++ b/test/common/services/bsearch.ts @@ -12,7 +12,7 @@ import type SuperTest from 'supertest'; import type { IEsSearchResponse } from '@kbn/search-types'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { BFETCH_ROUTE_VERSION_LATEST } from '@kbn/bfetch-plugin/common'; -import { FtrService } from './ftr_provider_context'; +import { FtrService } from '../ftr_provider_context'; /** * Function copied from here: @@ -62,7 +62,6 @@ export interface SendOptions { * }); * expect(response).eql({ ... your value ... }); */ - export class BsearchService extends FtrService { private readonly retry = this.ctx.getService('retry'); diff --git a/test/common/services/console.ts b/test/common/services/console.ts new file mode 100644 index 0000000000000..a864952fa081b --- /dev/null +++ b/test/common/services/console.ts @@ -0,0 +1,15 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { FtrProviderContext } from '../ftr_provider_context'; +import { helpers } from '../../api_integration/apis/console/helpers'; +export function ConsoleProvider({ getService }: FtrProviderContext) { + return { + helpers: helpers(getService), + }; +} diff --git a/packages/kbn-ftr-common-functional-services/services/deployment.ts b/test/common/services/deployment.ts similarity index 96% rename from packages/kbn-ftr-common-functional-services/services/deployment.ts rename to test/common/services/deployment.ts index 28474a6bc60e2..e61d6b360da19 100644 --- a/packages/kbn-ftr-common-functional-services/services/deployment.ts +++ b/test/common/services/deployment.ts @@ -11,7 +11,7 @@ import { Agent } from 'https'; import fetch from 'node-fetch'; import { getUrl } from '@kbn/test'; -import { FtrService } from './ftr_provider_context'; +import { FtrService } from '../ftr_provider_context'; export class DeploymentService extends FtrService { private readonly config = this.ctx.getService('config'); diff --git a/packages/kbn-ftr-common-functional-services/services/es_delete_all_indices.ts b/test/common/services/es_delete_all_indices.ts similarity index 97% rename from packages/kbn-ftr-common-functional-services/services/es_delete_all_indices.ts rename to test/common/services/es_delete_all_indices.ts index cf3f93d9ef6aa..5f0ecba2cbde8 100644 --- a/packages/kbn-ftr-common-functional-services/services/es_delete_all_indices.ts +++ b/test/common/services/es_delete_all_indices.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { FtrProviderContext } from './ftr_provider_context'; +import { FtrProviderContext } from '../ftr_provider_context'; export function EsDeleteAllIndicesProvider({ getService }: FtrProviderContext) { const log = getService('log'); diff --git a/test/common/services/index.ts b/test/common/services/index.ts index 18855d9dee114..ccc786d4ccc6e 100644 --- a/test/common/services/index.ts +++ b/test/common/services/index.ts @@ -7,26 +7,17 @@ */ import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; +import { DeploymentService } from './deployment'; +import { RandomnessService } from './randomness'; +import { SecurityServiceProvider } from './security'; +import { EsDeleteAllIndicesProvider } from './es_delete_all_indices'; +import { SavedObjectInfoService } from './saved_object_info'; +import { IndexPatternsService } from './index_patterns'; +import { BsearchService } from './bsearch'; +import { ConsoleProvider } from './console'; // pick only services that work for any FTR config, e.g. 'samlAuth' requires SAML setup in config file -const { - es, - esArchiver, - kibanaServer, - retry, - supertestWithoutAuth, - deployment, - randomness, - esDeleteAllIndices, - savedObjectInfo, - indexPatterns, - bsearch, - console, -} = commonFunctionalServices; - -// pick what was there previously -const { security } = commonFunctionalUIServices; +const { es, esArchiver, kibanaServer, retry, supertestWithoutAuth } = commonFunctionalServices; export const services = { es, @@ -34,12 +25,12 @@ export const services = { kibanaServer, retry, supertestWithoutAuth, - deployment, - randomness, - security, - esDeleteAllIndices, - savedObjectInfo, - indexPatterns, - bsearch, - console, + deployment: DeploymentService, + randomness: RandomnessService, + security: SecurityServiceProvider, + esDeleteAllIndices: EsDeleteAllIndicesProvider, + savedObjectInfo: SavedObjectInfoService, + indexPatterns: IndexPatternsService, + bsearch: BsearchService, + console: ConsoleProvider, }; diff --git a/packages/kbn-ftr-common-functional-services/services/index_patterns.ts b/test/common/services/index_patterns.ts similarity index 91% rename from packages/kbn-ftr-common-functional-services/services/index_patterns.ts rename to test/common/services/index_patterns.ts index 6113040b927b3..3fe02863b8568 100644 --- a/packages/kbn-ftr-common-functional-services/services/index_patterns.ts +++ b/test/common/services/index_patterns.ts @@ -6,11 +6,10 @@ * Side Public License, v 1. */ -import type { DataViewSpec } from '@kbn/data-plugin/common'; - -import { INITIAL_REST_VERSION } from '@kbn/data-views-plugin/server/constants'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; -import { FtrService } from './ftr_provider_context'; +import { INITIAL_REST_VERSION } from '@kbn/data-views-plugin/server/constants'; +import { DataViewSpec } from '@kbn/data-plugin/common'; +import { FtrService } from '../ftr_provider_context'; export class IndexPatternsService extends FtrService { private readonly kibanaServer = this.ctx.getService('kibanaServer'); diff --git a/packages/kbn-ftr-common-functional-services/services/randomness.ts b/test/common/services/randomness.ts similarity index 97% rename from packages/kbn-ftr-common-functional-services/services/randomness.ts rename to test/common/services/randomness.ts index d3ea0c74ff5de..c799c34539f15 100644 --- a/packages/kbn-ftr-common-functional-services/services/randomness.ts +++ b/test/common/services/randomness.ts @@ -9,7 +9,7 @@ import Chance from 'chance'; import { ToolingLog } from '@kbn/tooling-log'; -import { FtrService } from './ftr_provider_context'; +import { FtrService } from '../ftr_provider_context'; let __CACHED_SEED__: number | undefined; function getSeed(log: ToolingLog) { diff --git a/packages/kbn-ftr-common-functional-services/services/saved_object_info/index.ts b/test/common/services/saved_object_info/index.ts similarity index 100% rename from packages/kbn-ftr-common-functional-services/services/saved_object_info/index.ts rename to test/common/services/saved_object_info/index.ts diff --git a/packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_object_info.ts b/test/common/services/saved_object_info/saved_object_info.ts similarity index 97% rename from packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_object_info.ts rename to test/common/services/saved_object_info/saved_object_info.ts index 289c730cac17a..a1b98cbd408bf 100644 --- a/packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_object_info.ts +++ b/test/common/services/saved_object_info/saved_object_info.ts @@ -13,7 +13,7 @@ import { flow, pipe } from 'fp-ts/function'; import * as TE from 'fp-ts/lib/TaskEither'; import * as T from 'fp-ts/lib/Task'; import { ToolingLog } from '@kbn/tooling-log'; -import { FtrService } from '../ftr_provider_context'; +import { FtrService } from '../../ftr_provider_context'; import { print } from './utils'; const pluck = diff --git a/packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_objects_info_svc.md b/test/common/services/saved_object_info/saved_objects_info_svc.md similarity index 100% rename from packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_objects_info_svc.md rename to test/common/services/saved_object_info/saved_objects_info_svc.md diff --git a/packages/kbn-ftr-common-functional-services/services/saved_object_info/use_with_jq.md b/test/common/services/saved_object_info/use_with_jq.md similarity index 100% rename from packages/kbn-ftr-common-functional-services/services/saved_object_info/use_with_jq.md rename to test/common/services/saved_object_info/use_with_jq.md diff --git a/packages/kbn-ftr-common-functional-services/services/saved_object_info/utils.ts b/test/common/services/saved_object_info/utils.ts similarity index 100% rename from packages/kbn-ftr-common-functional-services/services/saved_object_info/utils.ts rename to test/common/services/saved_object_info/utils.ts diff --git a/packages/kbn-ftr-common-functional-ui-services/services/security/index.ts b/test/common/services/security/index.ts similarity index 83% rename from packages/kbn-ftr-common-functional-ui-services/services/security/index.ts rename to test/common/services/security/index.ts index 308b2f8b075a0..d34246c0c4411 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/security/index.ts +++ b/test/common/services/security/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { SecurityService, SecurityServiceProvider } from './security'; +export { SecurityServiceProvider } from './security'; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/security/role.ts b/test/common/services/security/role.ts similarity index 100% rename from packages/kbn-ftr-common-functional-ui-services/services/security/role.ts rename to test/common/services/security/role.ts diff --git a/packages/kbn-ftr-common-functional-ui-services/services/security/role_mappings.ts b/test/common/services/security/role_mappings.ts similarity index 100% rename from packages/kbn-ftr-common-functional-ui-services/services/security/role_mappings.ts rename to test/common/services/security/role_mappings.ts diff --git a/packages/kbn-ftr-common-functional-ui-services/services/security/security.ts b/test/common/services/security/security.ts similarity index 95% rename from packages/kbn-ftr-common-functional-ui-services/services/security/security.ts rename to test/common/services/security/security.ts index 5a5ff531acd5e..a182f225f2388 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/security/security.ts +++ b/test/common/services/security/security.ts @@ -9,7 +9,7 @@ import { Role } from './role'; import { User } from './user'; import { RoleMappings } from './role_mappings'; -import { FtrProviderContext } from '../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; import { createTestUserService, TestUserSupertestProvider, TestUser } from './test_user'; import { createSystemIndicesUser } from './system_indices_user'; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/security/system_indices_user.ts b/test/common/services/security/system_indices_user.ts similarity index 97% rename from packages/kbn-ftr-common-functional-ui-services/services/security/system_indices_user.ts rename to test/common/services/security/system_indices_user.ts index 9d6016ebb17e9..52e166c645093 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/security/system_indices_user.ts +++ b/test/common/services/security/system_indices_user.ts @@ -13,7 +13,7 @@ import { createEsClientForFtrConfig, createRemoteEsClientForFtrConfig, } from '@kbn/test'; -import { FtrProviderContext } from '../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; const SYSTEM_INDICES_SUPERUSER_ROLE = 'system_indices_superuser'; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts b/test/common/services/security/test_user.ts similarity index 96% rename from packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts rename to test/common/services/security/test_user.ts index 10a6da9f707dd..f3012304a95bd 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts +++ b/test/common/services/security/test_user.ts @@ -9,11 +9,10 @@ import { format as formatUrl } from 'url'; import supertest from 'supertest'; -import type { Browser } from '../browser'; -import type { TestSubjects } from '../test_subjects'; +import { type Browser, TestSubjects } from '@kbn/ftr-common-functional-ui-services'; import { Role } from './role'; import { User } from './user'; -import { FtrService, FtrProviderContext } from '../ftr_provider_context'; +import { FtrService, FtrProviderContext } from '../../ftr_provider_context'; const TEST_USER_NAME = 'test_user'; const TEST_USER_PASSWORD = 'changeme'; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/security/user.ts b/test/common/services/security/user.ts similarity index 100% rename from packages/kbn-ftr-common-functional-ui-services/services/security/user.ts rename to test/common/services/security/user.ts diff --git a/test/functional/apps/discover/ftr_provider_context.d.ts b/test/functional/apps/discover/ftr_provider_context.d.ts index b006a98a73d7c..5bf34af1bf9f3 100644 --- a/test/functional/apps/discover/ftr_provider_context.d.ts +++ b/test/functional/apps/discover/ftr_provider_context.d.ts @@ -7,13 +7,7 @@ */ import { GenericFtrProviderContext } from '@kbn/test'; -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { services as functionalServces } from '../../services'; +import { services } from '../../services'; import { pageObjects } from '../../page_objects'; -const services = { - ...functionalServces, - ...commonFunctionalServices, -}; - export type FtrProviderContext = GenericFtrProviderContext; diff --git a/test/functional/services/index.ts b/test/functional/services/index.ts index 01df9b5fdcbbf..83672889eff75 100644 --- a/test/functional/services/index.ts +++ b/test/functional/services/index.ts @@ -7,7 +7,7 @@ */ import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { services as commonServiceProviders } from '../../common/services'; import { AppsMenuService } from './apps_menu'; import { @@ -57,7 +57,7 @@ import { ESQLService } from './esql'; import { DataViewsService } from './data_views'; export const services = { - ...commonFunctionalServices, + ...commonServiceProviders, ...commonFunctionalUIServices, filterBar: FilterBarService, queryBar: QueryBarService, diff --git a/test/health_gateway/services/index.ts b/test/health_gateway/services/index.ts index 5a89fb849f952..b9c44e227adae 100644 --- a/test/health_gateway/services/index.ts +++ b/test/health_gateway/services/index.ts @@ -6,13 +6,11 @@ * Side Public License, v 1. */ -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; +import { services as commonServices } from '../../common/services'; import { HealthGatewayService } from './health_gateway'; export const services = { - ...commonFunctionalServices, - ...commonFunctionalUIServices, + ...commonServices, healthGateway: HealthGatewayService, }; diff --git a/test/server_integration/config.base.js b/test/server_integration/config.base.js index 61243595505eb..71006c258c423 100644 --- a/test/server_integration/config.base.js +++ b/test/server_integration/config.base.js @@ -12,15 +12,13 @@ import { ElasticsearchSupertestProvider, } from './services'; -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; - export default async function ({ readConfigFile }) { const commonConfig = await readConfigFile(require.resolve('../common/config')); const functionalConfig = await readConfigFile(require.resolve('../functional/config.base.js')); return { services: { - ...commonFunctionalServices, + ...commonConfig.get('services'), supertest: createKibanaSupertestProvider(), supertestWithoutAuth: KibanaSupertestWithoutAuthProvider, esSupertest: ElasticsearchSupertestProvider, diff --git a/test/server_integration/services/types.d.ts b/test/server_integration/services/types.d.ts index 204c0ae0106e5..2df95f0297f90 100644 --- a/test/server_integration/services/types.d.ts +++ b/test/server_integration/services/types.d.ts @@ -7,14 +7,7 @@ */ import { GenericFtrProviderContext } from '@kbn/test'; -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; - -export const kibanaCommonServices = { - ...commonFunctionalServices, - ...commonFunctionalUIServices, -} as const; - +import { services as kibanaCommonServices } from '../../common/services'; import { services as kibanaApiIntegrationServices } from '../../api_integration/services'; export type FtrProviderContext = GenericFtrProviderContext< diff --git a/test/tsconfig.json b/test/tsconfig.json index 8b0d946bded62..9f9f062a16492 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -47,6 +47,8 @@ "@kbn/controls-plugin", "@kbn/field-formats-plugin", "@kbn/axe-config", + "@kbn/dev-cli-runner", + "@kbn/dev-cli-errors", "@kbn/data-view-field-editor-plugin", "@kbn/data-views-plugin", "@kbn/guided-onboarding-plugin", @@ -69,6 +71,7 @@ "@kbn/links-plugin", "@kbn/ftr-common-functional-ui-services", "@kbn/monaco", + "@kbn/search-types", "@kbn/console-plugin", "@kbn/core-chrome-browser", "@kbn/default-nav-ml", diff --git a/x-pack/test/api_integration/apis/cloud_security_posture/helper.ts b/x-pack/test/api_integration/apis/cloud_security_posture/helper.ts index 7c21e6df09f8c..13bc2ee7de9d2 100644 --- a/x-pack/test/api_integration/apis/cloud_security_posture/helper.ts +++ b/x-pack/test/api_integration/apis/cloud_security_posture/helper.ts @@ -11,7 +11,7 @@ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import type { IndexDetails } from '@kbn/cloud-security-posture-common'; import { CLOUD_SECURITY_PLUGIN_VERSION } from '@kbn/cloud-security-posture-plugin/common/constants'; -import { SecurityService } from '@kbn/ftr-common-functional-ui-services'; +import { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; export interface RoleCredentials { apiKey: { id: string; name: string }; diff --git a/x-pack/test/api_integration/apis/telemetry/telemetry.ts b/x-pack/test/api_integration/apis/telemetry/telemetry.ts index 5e034ce3a1847..bae5c5b8cdc44 100644 --- a/x-pack/test/api_integration/apis/telemetry/telemetry.ts +++ b/x-pack/test/api_integration/apis/telemetry/telemetry.ts @@ -26,7 +26,7 @@ import { ELASTIC_HTTP_VERSION_HEADER, X_ELASTIC_INTERNAL_ORIGIN_REQUEST, } from '@kbn/core-http-common'; -import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; +import type { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; import basicClusterFixture from './fixtures/basiccluster.json'; import multiClusterFixture from './fixtures/multicluster.json'; import type { FtrProviderContext } from '../../ftr_provider_context'; diff --git a/x-pack/test/common/services/bsearch_secure.ts b/x-pack/test/common/services/bsearch_secure.ts index ccd1866ddd66e..f454aa3818ea6 100644 --- a/x-pack/test/common/services/bsearch_secure.ts +++ b/x-pack/test/common/services/bsearch_secure.ts @@ -5,8 +5,8 @@ * 2.0. */ -// NOTE: This is pretty much a copy/paste from packages/kbn-ftr-common-functional-services/services/bsearch.ts -// but with the ability to provide custom auth +// NOTE: This is pretty much a copy/paste from test/common/services/bsearch.ts but with the ability +// to provide custom auth import expect from '@kbn/expect'; import request from 'superagent'; diff --git a/x-pack/test/common/services/index.ts b/x-pack/test/common/services/index.ts index edf64c828e944..5e931b440654a 100644 --- a/x-pack/test/common/services/index.ts +++ b/x-pack/test/common/services/index.ts @@ -6,8 +6,7 @@ */ import { services as kibanaApiIntegrationServices } from '@kbn/test-suites-src/api_integration/services'; -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; +import { services as kibanaCommonServices } from '@kbn/test-suites-src/common/services'; import { InfraLogViewsServiceProvider } from './infra_log_views'; import { SpacesServiceProvider } from './spaces'; import { BsearchSecureService } from './bsearch_secure'; @@ -15,8 +14,7 @@ import { ApmSynthtraceKibanaClientProvider } from './apm_synthtrace_kibana_clien import { InfraSynthtraceKibanaClientProvider } from './infra_synthtrace_kibana_client'; export const services = { - ...commonFunctionalServices, - ...commonFunctionalUIServices, + ...kibanaCommonServices, infraLogViews: InfraLogViewsServiceProvider, supertest: kibanaApiIntegrationServices.supertest, spaces: SpacesServiceProvider, diff --git a/x-pack/test/fleet_api_integration/apis/test_users.ts b/x-pack/test/fleet_api_integration/apis/test_users.ts index 74581fd681af7..f84c1f72fb657 100644 --- a/x-pack/test/fleet_api_integration/apis/test_users.ts +++ b/x-pack/test/fleet_api_integration/apis/test_users.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; +import type { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; export const testUsers: { [rollName: string]: { username: string; password: string; permissions?: any }; diff --git a/x-pack/test/fleet_cypress/services.ts b/x-pack/test/fleet_cypress/services.ts index 8986c0928d750..272cf7eb8da4e 100644 --- a/x-pack/test/fleet_cypress/services.ts +++ b/x-pack/test/fleet_cypress/services.ts @@ -4,10 +4,5 @@ * 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 { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; -export const services = { - ...commonFunctionalServices, - ...commonFunctionalUIServices, -} as const; +export * from '@kbn/test-suites-src/common/services'; diff --git a/x-pack/test/osquery_cypress/services.ts b/x-pack/test/osquery_cypress/services.ts index 95fd493e6f668..272cf7eb8da4e 100644 --- a/x-pack/test/osquery_cypress/services.ts +++ b/x-pack/test/osquery_cypress/services.ts @@ -5,10 +5,4 @@ * 2.0. */ -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; - -export const services = { - ...commonFunctionalServices, - ...commonFunctionalUIServices, -} as const; +export * from '@kbn/test-suites-src/common/services'; diff --git a/x-pack/test/profiling_api_integration/common/create_profiling_users/helpers/create_or_update_user.ts b/x-pack/test/profiling_api_integration/common/create_profiling_users/helpers/create_or_update_user.ts index 2f467d4507e7f..679a750af410b 100644 --- a/x-pack/test/profiling_api_integration/common/create_profiling_users/helpers/create_or_update_user.ts +++ b/x-pack/test/profiling_api_integration/common/create_profiling_users/helpers/create_or_update_user.ts @@ -8,7 +8,7 @@ /* eslint-disable no-console */ import { difference, union } from 'lodash'; -import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; +import { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; import { Elasticsearch, Kibana } from '..'; import { callKibana, isAxiosError } from './call_kibana'; diff --git a/x-pack/test/profiling_api_integration/common/create_profiling_users/index.ts b/x-pack/test/profiling_api_integration/common/create_profiling_users/index.ts index 18a056b001c56..d7c101dd52eaa 100644 --- a/x-pack/test/profiling_api_integration/common/create_profiling_users/index.ts +++ b/x-pack/test/profiling_api_integration/common/create_profiling_users/index.ts @@ -5,7 +5,7 @@ * 2.0. */ import { asyncForEach } from '@kbn/std'; -import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; +import { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; import { ProfilingUsername, profilingUsers } from './authentication'; import { AbortError, callKibana } from './helpers/call_kibana'; import { createOrUpdateUser } from './helpers/create_or_update_user'; diff --git a/x-pack/test/saved_objects_field_count/config.ts b/x-pack/test/saved_objects_field_count/config.ts index 603a325ca0479..eb2aeb1df90a9 100644 --- a/x-pack/test/saved_objects_field_count/config.ts +++ b/x-pack/test/saved_objects_field_count/config.ts @@ -6,7 +6,6 @@ */ import { FtrConfigProviderContext } from '@kbn/test'; -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const kibanaCommonTestsConfig = await readConfigFile( @@ -16,10 +15,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), - services: { - ...commonFunctionalServices, - }, - testFiles: [require.resolve('./test')], esTestCluster: { diff --git a/x-pack/test/security_solution_api_integration/config/services/security_solution_serverless_utils.ts b/x-pack/test/security_solution_api_integration/config/services/security_solution_serverless_utils.ts index 00df4f0374c27..da57ccf64860e 100644 --- a/x-pack/test/security_solution_api_integration/config/services/security_solution_serverless_utils.ts +++ b/x-pack/test/security_solution_api_integration/config/services/security_solution_serverless_utils.ts @@ -9,7 +9,7 @@ import supertest from 'supertest'; import { format as formatUrl } from 'url'; import { IEsSearchResponse } from '@kbn/search-types'; import { RoleCredentials } from '@kbn/test-suites-serverless/shared/services'; -import type { SendOptions } from '@kbn/ftr-common-functional-services'; +import type { SendOptions } from '@kbn/test-suites-src/common/services/bsearch'; import type { SendOptions as SecureBsearchSendOptions } from '@kbn/test-suites-serverless/shared/services/bsearch_secure'; import type { FtrProviderContext } from '../../ftr_provider_context'; import type { SecuritySolutionUtilsInterface } from './types'; diff --git a/x-pack/test/security_solution_api_integration/config/services/types.ts b/x-pack/test/security_solution_api_integration/config/services/types.ts index 838f31e69412e..72397582dad00 100644 --- a/x-pack/test/security_solution_api_integration/config/services/types.ts +++ b/x-pack/test/security_solution_api_integration/config/services/types.ts @@ -9,7 +9,7 @@ import TestAgent from 'supertest/lib/agent'; import type { IEsSearchResponse } from '@kbn/search-types'; import type { BsearchSecureService } from '@kbn/test-suites-serverless/shared/services/bsearch_secure'; -import type { BsearchService, SendOptions } from '@kbn/ftr-common-functional-services'; +import type { BsearchService, SendOptions } from '@kbn/test-suites-src/common/services/bsearch'; export interface SecuritySolutionServerlessBsearch extends Omit { send: (options: SendOptions) => Promise; diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/users_and_roles.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/users_and_roles.ts index a9663cd943a78..3bccaf4a00fe3 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/users_and_roles.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/users_and_roles.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; +import { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; export const usersAndRolesFactory = (security: SecurityService) => ({ createRole: async ({ name, privileges }: { name: string; privileges: any }) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/host_details.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/host_details.ts index cf2ac65f1086b..1c74a987e4fec 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/host_details.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/host_details.ts @@ -11,7 +11,7 @@ import { HostsQueries, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; import { hostDetailsFilebeatExpectedResult } from '../mocks/host_details'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/hosts.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/hosts.ts index 80052ef3ddf56..a39da25c81aa3 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/hosts.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/hosts.ts @@ -16,7 +16,7 @@ import { FirstLastSeenStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/uncommon_processes.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/uncommon_processes.ts index 22001c26b66b5..19710d4eedf45 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/uncommon_processes.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/uncommon_processes.ts @@ -12,7 +12,7 @@ import { HostsUncommonProcessesStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; const FROM = '2000-01-01T00:00:00.000Z'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_details.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_details.ts index 166af42ba5702..5e9040424713b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_details.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_details.ts @@ -11,7 +11,7 @@ import { NetworkQueries, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_dns.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_dns.ts index 22edc8cff64de..7254dc6e99a5e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_dns.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_dns.ts @@ -14,7 +14,7 @@ import { NetworkDnsStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; export default function ({ getService }: FtrProviderContextWithSpaces) { diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_top_n_flow.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_top_n_flow.ts index 8b1adb16975f6..2306861471073 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_top_n_flow.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_top_n_flow.ts @@ -15,7 +15,7 @@ import { NetworkTopNFlowStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/tls.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/tls.ts index 36b2b677a1949..4c555ca0d6555 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/tls.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/tls.ts @@ -14,8 +14,7 @@ import { NetworkTlsStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; - -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_host.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_host.ts index ffb287239ac0f..d99fbd296ba3e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_host.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_host.ts @@ -12,7 +12,7 @@ import { HostsOverviewStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; export default function ({ getService }: FtrProviderContextWithSpaces) { diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_network.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_network.ts index f8d4aa80c0e3d..952e3eed8f8af 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_network.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_network.ts @@ -11,7 +11,7 @@ import { NetworkQueries, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; export default function ({ getService }: FtrProviderContextWithSpaces) { diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/authentications.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/authentications.ts index 39dddc7a0c046..d7329a597e2e0 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/authentications.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/authentications.ts @@ -15,7 +15,7 @@ import { import type { UserAuthenticationsRequestOptions } from '@kbn/security-solution-plugin/common/api/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; const FROM = '2000-01-01T00:00:00.000Z'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/users.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/users.ts index 6765e6d2bb164..65b44bf4cbc5e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/users.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/users.ts @@ -14,8 +14,7 @@ import { NetworkUsersStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; - -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/events.ts b/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/events.ts index c42ac64de4a23..c66978bbe1b42 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/events.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/events.ts @@ -14,9 +14,8 @@ import { TimelineEventsAllStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; - import { getFieldsToRequest, getFilterValue } from '../../../../utils'; const TO = '3000-01-01T00:00:00.000Z'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/timeline_details.ts b/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/timeline_details.ts index 12539d43a145f..1e3119260455d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/timeline_details.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/timeline_details.ts @@ -13,8 +13,7 @@ import { TimelineKpiStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; - -import { BsearchService } from '@kbn/ftr-common-functional-services'; +import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; import { timelineDetailsFilebeatExpectedResults as EXPECTED_DATA } from '../mocks/timeline_details'; diff --git a/x-pack/test/security_solution_api_integration/tsconfig.json b/x-pack/test/security_solution_api_integration/tsconfig.json index 1f558e3c3f051..2f420920027d5 100644 --- a/x-pack/test/security_solution_api_integration/tsconfig.json +++ b/x-pack/test/security_solution_api_integration/tsconfig.json @@ -49,6 +49,6 @@ "@kbn/dev-cli-runner", "@kbn/search-types", "@kbn/security-plugin", - "@kbn/ftr-common-functional-ui-services", + "@kbn/test-suites-src", ] } diff --git a/x-pack/test/threat_intelligence_cypress/config.ts b/x-pack/test/threat_intelligence_cypress/config.ts index c2e9a6ac8b180..963cfab55dad5 100644 --- a/x-pack/test/threat_intelligence_cypress/config.ts +++ b/x-pack/test/threat_intelligence_cypress/config.ts @@ -6,8 +6,9 @@ */ import { FtrConfigProviderContext } from '@kbn/test'; + import { CA_CERT_PATH } from '@kbn/dev-utils'; -import { services } from './services'; + export default async function ({ readConfigFile }: FtrConfigProviderContext) { const kibanaCommonTestsConfig = await readConfigFile( require.resolve('@kbn/test-suites-src/common/config') @@ -19,8 +20,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), - services, - esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ diff --git a/x-pack/test/upgrade_assistant_integration/config.js b/x-pack/test/upgrade_assistant_integration/config.js index 9529e4bc568d3..dbdf0ade8affe 100644 --- a/x-pack/test/upgrade_assistant_integration/config.js +++ b/x-pack/test/upgrade_assistant_integration/config.js @@ -5,8 +5,6 @@ * 2.0. */ -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; - export default async function ({ readConfigFile }) { // Read the Kibana API integration tests config file so that we can utilize its services. const kibanaAPITestsConfig = await readConfigFile( @@ -15,12 +13,15 @@ export default async function ({ readConfigFile }) { const xPackFunctionalTestsConfig = await readConfigFile( require.resolve('../functional/config.base.js') ); + const kibanaCommonConfig = await readConfigFile( + require.resolve('@kbn/test-suites-src/common/config') + ); return { testFiles: [require.resolve('./upgrade_assistant')], servers: xPackFunctionalTestsConfig.get('servers'), services: { - ...commonFunctionalServices, + ...kibanaCommonConfig.get('services'), supertest: kibanaAPITestsConfig.get('services.supertest'), }, junit: { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts b/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts index 3ec162ad28ffd..72640103c0ef9 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts +++ b/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts @@ -11,7 +11,7 @@ import { InternalRequestHeader, RoleCredentials } from '../../../../shared/servi export default ({ getService }: FtrProviderContext) => { const svlCommonApi = getService('svlCommonApi'); - const console = getService('console'); + const consoleService = getService('console'); const svlUserManager = getService('svlUserManager'); const supertestWithoutAuth = getService('supertestWithoutAuth'); @@ -27,6 +27,17 @@ export default ({ getService }: FtrProviderContext) => { }; describe('/api/console/autocomplete_entities', function () { + let createIndex: (typeof consoleService)['helpers']['createIndex']; + let createAlias: (typeof consoleService)['helpers']['createAlias']; + let createIndexTemplate: (typeof consoleService)['helpers']['createIndexTemplate']; + let createComponentTemplate: (typeof consoleService)['helpers']['createComponentTemplate']; + let createDataStream: (typeof consoleService)['helpers']['createDataStream']; + let deleteIndex: (typeof consoleService)['helpers']['deleteIndex']; + let deleteAlias: (typeof consoleService)['helpers']['deleteAlias']; + let deleteIndexTemplate: (typeof consoleService)['helpers']['deleteIndexTemplate']; + let deleteComponentTemplate: (typeof consoleService)['helpers']['deleteComponentTemplate']; + let deleteDataStream: (typeof consoleService)['helpers']['deleteDataStream']; + const indexName = 'test-index-1'; const aliasName = 'test-alias-1'; const indexTemplateName = 'test-index-template-1'; @@ -36,26 +47,36 @@ export default ({ getService }: FtrProviderContext) => { before(async () => { roleAuthc = await svlUserManager.createM2mApiKeyWithRoleScope('admin'); internalRequestHeader = svlCommonApi.getInternalRequestHeader(); + ({ + helpers: { + createIndex, + createAlias, + createIndexTemplate, + createComponentTemplate, + createDataStream, + deleteIndex, + deleteAlias, + deleteIndexTemplate, + deleteComponentTemplate, + deleteDataStream, + }, + } = consoleService); // Setup indices, aliases, templates, and data streams - await console.createIndex(indexName); - await console.createAlias(indexName, aliasName); - await console.createComponentTemplate(componentTemplateName); - await console.createIndexTemplate( - indexTemplateName, - [dataStreamName], - [componentTemplateName] - ); - await console.createDataStream(dataStreamName); + await createIndex(indexName); + await createAlias(indexName, aliasName); + await createComponentTemplate(componentTemplateName); + await createIndexTemplate(indexTemplateName, [dataStreamName], [componentTemplateName]); + await createDataStream(dataStreamName); }); after(async () => { // Cleanup indices, aliases, templates, and data streams - await console.deleteAlias(indexName, aliasName); - await console.deleteIndex(indexName); - await console.deleteDataStream(dataStreamName); - await console.deleteIndexTemplate(indexTemplateName); - await console.deleteComponentTemplate(componentTemplateName); + await deleteAlias(indexName, aliasName); + await deleteIndex(indexName); + await deleteDataStream(dataStreamName); + await deleteIndexTemplate(indexTemplateName); + await deleteComponentTemplate(componentTemplateName); await svlUserManager.invalidateM2mApiKeyWithRoleScope(roleAuthc); }); diff --git a/x-pack/test_serverless/shared/services/bsearch_secure.ts b/x-pack/test_serverless/shared/services/bsearch_secure.ts index 03f8241c9e12a..7ebe89bed8247 100644 --- a/x-pack/test_serverless/shared/services/bsearch_secure.ts +++ b/x-pack/test_serverless/shared/services/bsearch_secure.ts @@ -5,8 +5,8 @@ * 2.0. */ -// NOTE: This is pretty much a copy/paste from packages/kbn-ftr-common-functional-services/services/bsearch.ts -// but with the ability to provide custom auth +// NOTE: This is pretty much a copy/paste from test/common/services/bsearch.ts but with the ability +// to provide custom auth import expect from '@kbn/expect'; import { GenericFtrService } from '@kbn/test';