From 2a8e956c81f8f9591f3410184a4d268c56c63e97 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 19 Aug 2024 10:28:12 +0100 Subject: [PATCH 01/22] [FTR] Refactor test/common/services Resolves: https://github.com/elastic/kibana/issues/188541 --- .../development-functional-tests.asciidoc | 10 ++-- .../index.ts | 5 ++ .../services/all.ts | 14 +++++ .../services/bsearch.ts | 3 +- .../services/console.ts | 4 +- .../services/deployment.ts | 2 +- .../services/es_delete_all_indices.ts | 2 +- .../services/index_patterns.ts | 12 +++-- .../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 .../tsconfig.json | 8 ++- .../index.ts | 1 + .../services/all.ts | 2 + .../services/ftr_provider_context.ts | 8 ++- .../services/security/index.ts | 2 +- .../services/security/role.ts | 0 .../services/security/role_mappings.ts | 0 .../services/security/security.ts | 2 +- .../services/security/system_indices_user.ts | 2 +- .../services/security/test_user.ts | 5 +- .../services/security/user.ts | 0 scripts/saved_objs_info.js | 2 +- test/analytics/services/index.ts | 7 ++- .../apis/console/autocomplete_entities.ts | 46 +++++++---------- test/api_integration/services/index.ts | 7 +-- test/common/config.js | 2 - test/common/ftr_provider_context.ts | 14 ----- test/common/services/console.ts | 15 ------ test/common/services/index.ts | 36 ------------- .../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 ++- .../test/defend_workflows_cypress/services.ts | 8 ++- .../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/services.ts | 8 ++- .../upgrade_assistant_integration/config.js | 7 ++- .../common/console/autocomplete_entities.ts | 51 ++++++------------- .../shared/services/bsearch_secure.ts | 4 +- 71 files changed, 199 insertions(+), 206 deletions(-) rename {test/common => packages/kbn-ftr-common-functional-services}/services/bsearch.ts (98%) rename test/api_integration/apis/console/helpers.ts => packages/kbn-ftr-common-functional-services/services/console.ts (95%) rename {test/common => packages/kbn-ftr-common-functional-services}/services/deployment.ts (96%) rename {test/common => packages/kbn-ftr-common-functional-services}/services/es_delete_all_indices.ts (97%) rename {test/common => packages/kbn-ftr-common-functional-services}/services/index_patterns.ts (74%) rename {test/common => packages/kbn-ftr-common-functional-services}/services/randomness.ts (97%) rename {test/common => packages/kbn-ftr-common-functional-services}/services/saved_object_info/index.ts (100%) rename {test/common => packages/kbn-ftr-common-functional-services}/services/saved_object_info/saved_object_info.ts (97%) rename {test/common => packages/kbn-ftr-common-functional-services}/services/saved_object_info/saved_objects_info_svc.md (100%) rename {test/common => packages/kbn-ftr-common-functional-services}/services/saved_object_info/use_with_jq.md (100%) rename {test/common => packages/kbn-ftr-common-functional-services}/services/saved_object_info/utils.ts (100%) rename {test/common => packages/kbn-ftr-common-functional-ui-services}/services/security/index.ts (83%) rename {test/common => packages/kbn-ftr-common-functional-ui-services}/services/security/role.ts (100%) rename {test/common => packages/kbn-ftr-common-functional-ui-services}/services/security/role_mappings.ts (100%) rename {test/common => packages/kbn-ftr-common-functional-ui-services}/services/security/security.ts (95%) rename {test/common => packages/kbn-ftr-common-functional-ui-services}/services/security/system_indices_user.ts (97%) rename {test/common => packages/kbn-ftr-common-functional-ui-services}/services/security/test_user.ts (96%) rename {test/common => packages/kbn-ftr-common-functional-ui-services}/services/security/user.ts (100%) delete mode 100644 test/common/ftr_provider_context.ts delete mode 100644 test/common/services/console.ts delete mode 100644 test/common/services/index.ts diff --git a/docs/developer/contributing/development-functional-tests.asciidoc b/docs/developer/contributing/development-functional-tests.asciidoc index 23d43480eb090..88163ebb6804b 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 `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(). +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(). 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}test/common/services/retry/retry.ts[test/common/services/retry/retry.ts] +// * Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/retry/retry.ts[packages/kbn-ftr-common-functional-services/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}test/common/services/kibana_server/kibana_server.js[test/common/services/kibana_server/kibana_server.js] +// * 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] * 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}test/common/services/es_archiver.ts[test/common/services/es_archiver.ts] +// * Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/es_archiver.ts[packages/kbn-ftr-common-functional-services/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}test/common/services/es.ts[test/common/services/es.ts] +// ** Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/es.ts[packages/kbn-ftr-common-functional-services/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 3cc6df44adf01..e02703a08a7bc 100644 --- a/packages/kbn-ftr-common-functional-services/index.ts +++ b/packages/kbn-ftr-common-functional-services/index.ts @@ -10,6 +10,7 @@ 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'; @@ -18,6 +19,7 @@ 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'; @@ -29,3 +31,6 @@ 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'; diff --git a/packages/kbn-ftr-common-functional-services/services/all.ts b/packages/kbn-ftr-common-functional-services/services/all.ts index 49308faeb3dd0..c6c0fb792bb81 100644 --- a/packages/kbn-ftr-common-functional-services/services/all.ts +++ b/packages/kbn-ftr-common-functional-services/services/all.ts @@ -10,6 +10,13 @@ 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'; @@ -18,6 +25,13 @@ 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/test/common/services/bsearch.ts b/packages/kbn-ftr-common-functional-services/services/bsearch.ts similarity index 98% rename from test/common/services/bsearch.ts rename to packages/kbn-ftr-common-functional-services/services/bsearch.ts index 81063813cec5f..b36834dedbca5 100644 --- a/test/common/services/bsearch.ts +++ b/packages/kbn-ftr-common-functional-services/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,6 +62,7 @@ export interface SendOptions { * }); * expect(response).eql({ ... your value ... }); */ + export class BsearchService extends FtrService { private readonly retry = this.ctx.getService('retry'); diff --git a/test/api_integration/apis/console/helpers.ts b/packages/kbn-ftr-common-functional-services/services/console.ts similarity index 95% rename from test/api_integration/apis/console/helpers.ts rename to packages/kbn-ftr-common-functional-services/services/console.ts index cfd1365f212fa..1ca5128d83f7c 100644 --- a/test/api_integration/apis/console/helpers.ts +++ b/packages/kbn-ftr-common-functional-services/services/console.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 helpers(getService: FtrProviderContext['getService']) { +export function ConsoleProvider({ getService }: FtrProviderContext) { const client = getService('es'); const createIndex = async (indexName: string) => { diff --git a/test/common/services/deployment.ts b/packages/kbn-ftr-common-functional-services/services/deployment.ts similarity index 96% rename from test/common/services/deployment.ts rename to packages/kbn-ftr-common-functional-services/services/deployment.ts index e61d6b360da19..28474a6bc60e2 100644 --- a/test/common/services/deployment.ts +++ b/packages/kbn-ftr-common-functional-services/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/test/common/services/es_delete_all_indices.ts b/packages/kbn-ftr-common-functional-services/services/es_delete_all_indices.ts similarity index 97% rename from test/common/services/es_delete_all_indices.ts rename to packages/kbn-ftr-common-functional-services/services/es_delete_all_indices.ts index 5f0ecba2cbde8..cf3f93d9ef6aa 100644 --- a/test/common/services/es_delete_all_indices.ts +++ b/packages/kbn-ftr-common-functional-services/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_patterns.ts b/packages/kbn-ftr-common-functional-services/services/index_patterns.ts similarity index 74% rename from test/common/services/index_patterns.ts rename to packages/kbn-ftr-common-functional-services/services/index_patterns.ts index 3fe02863b8568..f6610a8d8434e 100644 --- a/test/common/services/index_patterns.ts +++ b/packages/kbn-ftr-common-functional-services/services/index_patterns.ts @@ -6,10 +6,14 @@ * Side Public License, v 1. */ -import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; -import { INITIAL_REST_VERSION } from '@kbn/data-views-plugin/server/constants'; -import { DataViewSpec } from '@kbn/data-plugin/common'; -import { FtrService } from '../ftr_provider_context'; +import type { DataViewSpec } from '@kbn/data-plugin/common'; +import { FtrService } from './ftr_provider_context'; + +// The fallowing two constant values live in +// '@kbn/data-views-plugin/server/constants' and +// '@kbn/core-http-common' respectively. +const INITIAL_REST_VERSION = '2023-10-31' as const; +const ELASTIC_HTTP_VERSION_HEADER = 'elastic-api-version' as const; export class IndexPatternsService extends FtrService { private readonly kibanaServer = this.ctx.getService('kibanaServer'); diff --git a/test/common/services/randomness.ts b/packages/kbn-ftr-common-functional-services/services/randomness.ts similarity index 97% rename from test/common/services/randomness.ts rename to packages/kbn-ftr-common-functional-services/services/randomness.ts index c799c34539f15..d3ea0c74ff5de 100644 --- a/test/common/services/randomness.ts +++ b/packages/kbn-ftr-common-functional-services/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/test/common/services/saved_object_info/index.ts b/packages/kbn-ftr-common-functional-services/services/saved_object_info/index.ts similarity index 100% rename from test/common/services/saved_object_info/index.ts rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/index.ts diff --git a/test/common/services/saved_object_info/saved_object_info.ts b/packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_object_info.ts similarity index 97% rename from test/common/services/saved_object_info/saved_object_info.ts rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_object_info.ts index a1b98cbd408bf..289c730cac17a 100644 --- a/test/common/services/saved_object_info/saved_object_info.ts +++ b/packages/kbn-ftr-common-functional-services/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/test/common/services/saved_object_info/saved_objects_info_svc.md b/packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_objects_info_svc.md similarity index 100% rename from test/common/services/saved_object_info/saved_objects_info_svc.md rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_objects_info_svc.md diff --git a/test/common/services/saved_object_info/use_with_jq.md b/packages/kbn-ftr-common-functional-services/services/saved_object_info/use_with_jq.md similarity index 100% rename from test/common/services/saved_object_info/use_with_jq.md rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/use_with_jq.md diff --git a/test/common/services/saved_object_info/utils.ts b/packages/kbn-ftr-common-functional-services/services/saved_object_info/utils.ts similarity index 100% rename from test/common/services/saved_object_info/utils.ts rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/utils.ts diff --git a/packages/kbn-ftr-common-functional-services/tsconfig.json b/packages/kbn-ftr-common-functional-services/tsconfig.json index 56a442ad2f5a9..cde384b3d689e 100644 --- a/packages/kbn-ftr-common-functional-services/tsconfig.json +++ b/packages/kbn-ftr-common-functional-services/tsconfig.json @@ -16,8 +16,14 @@ "@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/es" ], "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 cd383a03e5f5d..f5f5b9df5b8ae 100644 --- a/packages/kbn-ftr-common-functional-ui-services/index.ts +++ b/packages/kbn-ftr-common-functional-ui-services/index.ts @@ -22,3 +22,4 @@ 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 bffa7468e14ea..610697c69dfbf 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/all.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/all.ts @@ -12,6 +12,7 @@ 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, @@ -20,4 +21,5 @@ 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 992fe27059e45..6f589ac6d1bb4 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,12 +7,18 @@ */ import { GenericFtrProviderContext, GenericFtrService } from '@kbn/test'; -import { RetryService } from '@kbn/ftr-common-functional-services'; +import { + RetryService, + EsProvider, + KibanaServerProvider, +} 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/test/common/services/security/index.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/index.ts similarity index 83% rename from test/common/services/security/index.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/index.ts index d34246c0c4411..308b2f8b075a0 100644 --- a/test/common/services/security/index.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/security/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { SecurityServiceProvider } from './security'; +export { SecurityService, SecurityServiceProvider } from './security'; diff --git a/test/common/services/security/role.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/role.ts similarity index 100% rename from test/common/services/security/role.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/role.ts diff --git a/test/common/services/security/role_mappings.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/role_mappings.ts similarity index 100% rename from test/common/services/security/role_mappings.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/role_mappings.ts diff --git a/test/common/services/security/security.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/security.ts similarity index 95% rename from test/common/services/security/security.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/security.ts index a182f225f2388..5a5ff531acd5e 100644 --- a/test/common/services/security/security.ts +++ b/packages/kbn-ftr-common-functional-ui-services/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/test/common/services/security/system_indices_user.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/system_indices_user.ts similarity index 97% rename from test/common/services/security/system_indices_user.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/system_indices_user.ts index 52e166c645093..9d6016ebb17e9 100644 --- a/test/common/services/security/system_indices_user.ts +++ b/packages/kbn-ftr-common-functional-ui-services/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/test/common/services/security/test_user.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts similarity index 96% rename from test/common/services/security/test_user.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts index f3012304a95bd..10a6da9f707dd 100644 --- a/test/common/services/security/test_user.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts @@ -9,10 +9,11 @@ import { format as formatUrl } from 'url'; import supertest from 'supertest'; -import { type Browser, TestSubjects } from '@kbn/ftr-common-functional-ui-services'; +import type { Browser } from '../browser'; +import type { TestSubjects } from '../test_subjects'; 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/test/common/services/security/user.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/user.ts similarity index 100% rename from test/common/services/security/user.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/user.ts diff --git a/scripts/saved_objs_info.js b/scripts/saved_objs_info.js index f17a2897b83da..229565921ba90 100644 --- a/scripts/saved_objs_info.js +++ b/scripts/saved_objs_info.js @@ -7,4 +7,4 @@ */ require('../src/setup_node_env'); -require('@kbn/test-suites-src/common/services/saved_object_info').runSavedObjInfoSvc(); +require('@kbn/ftr-common-functional-services').runSavedObjInfoSvc(); diff --git a/test/analytics/services/index.ts b/test/analytics/services/index.ts index 0c75df9bc2050..0d3465986249a 100644 --- a/test/analytics/services/index.ts +++ b/test/analytics/services/index.ts @@ -7,14 +7,17 @@ */ import { GenericFtrProviderContext } from '@kbn/test'; -import { services as commonServices } from '../../common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + import { services as functionalServices } from '../../functional/services'; import { pageObjects } from '../../functional/page_objects'; import { KibanaEBTServerProvider, KibanaEBTUIProvider } from './kibana_ebt'; export const services = { - ...commonServices, + ...commonFunctionalServices, + ...commonFunctionalUIServices, ...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 a410e50950cd1..1993ef1f7fe19 100644 --- a/test/api_integration/apis/console/autocomplete_entities.ts +++ b/test/api_integration/apis/console/autocomplete_entities.ts @@ -8,25 +8,11 @@ import expect from '@kbn/expect'; import type { FtrProviderContext } from '../../ftr_provider_context'; -import { helpers } from './helpers'; export default ({ getService }: FtrProviderContext) => { - const { - createIndex, - createAlias, - createLegacyTemplate, - createIndexTemplate, - createComponentTemplate, - createDataStream, - deleteIndex, - deleteAlias, - deleteLegacyTemplate, - deleteIndexTemplate, - deleteComponentTemplate, - deleteDataStream, - } = helpers(getService); - + const console = getService('console'); const supertest = getService('supertest'); + const sendRequest = (query: object) => supertest.get('/api/console/autocomplete_entities').query(query); @@ -40,22 +26,26 @@ export default ({ getService }: FtrProviderContext) => { before(async () => { // Setup indices, aliases, templates, and data streams - await createIndex(indexName); - await createAlias(indexName, aliasName); - await createComponentTemplate(componentTemplateName); - await createIndexTemplate(indexTemplateName, [dataStreamName], [componentTemplateName]); - await createDataStream(dataStreamName); - await createLegacyTemplate(legacyTemplateName); + 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); }); after(async () => { // Cleanup indices, aliases, templates, and data streams - await deleteAlias(indexName, aliasName); - await deleteIndex(indexName); - await deleteDataStream(dataStreamName); - await deleteIndexTemplate(indexTemplateName); - await deleteComponentTemplate(componentTemplateName); - await deleteLegacyTemplate(legacyTemplateName); + 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); }); it('should not succeed if no settings are provided in query params', async () => { diff --git a/test/api_integration/services/index.ts b/test/api_integration/services/index.ts index 42a2616b781ac..f72460b7ffc5f 100644 --- a/test/api_integration/services/index.ts +++ b/test/api_integration/services/index.ts @@ -6,12 +6,13 @@ * Side Public License, v 1. */ -import { services as commonServices } from '../../common/services'; - +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { KibanaSupertestProvider, ElasticsearchSupertestProvider } from './supertest'; export const services = { - ...commonServices, + ...commonFunctionalServices, + ...commonFunctionalUIServices, supertest: KibanaSupertestProvider, esSupertest: ElasticsearchSupertestProvider, }; diff --git a/test/common/config.js b/test/common/config.js index 163703a693356..8f2d6b7e14018 100644 --- a/test/common/config.js +++ b/test/common/config.js @@ -9,7 +9,6 @@ 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 = { @@ -85,6 +84,5 @@ export default function () { })}`, ], }, - services, }; } diff --git a/test/common/ftr_provider_context.ts b/test/common/ftr_provider_context.ts deleted file mode 100644 index 6d21aedfe1d5e..0000000000000 --- a/test/common/ftr_provider_context.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 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/test/common/services/console.ts b/test/common/services/console.ts deleted file mode 100644 index a864952fa081b..0000000000000 --- a/test/common/services/console.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 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/test/common/services/index.ts b/test/common/services/index.ts deleted file mode 100644 index ccc786d4ccc6e..0000000000000 --- a/test/common/services/index.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 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 { commonFunctionalServices } from '@kbn/ftr-common-functional-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 } = commonFunctionalServices; - -export const services = { - es, - esArchiver, - kibanaServer, - retry, - supertestWithoutAuth, - deployment: DeploymentService, - randomness: RandomnessService, - security: SecurityServiceProvider, - esDeleteAllIndices: EsDeleteAllIndicesProvider, - savedObjectInfo: SavedObjectInfoService, - indexPatterns: IndexPatternsService, - bsearch: BsearchService, - console: ConsoleProvider, -}; diff --git a/test/functional/apps/discover/ftr_provider_context.d.ts b/test/functional/apps/discover/ftr_provider_context.d.ts index 5bf34af1bf9f3..b006a98a73d7c 100644 --- a/test/functional/apps/discover/ftr_provider_context.d.ts +++ b/test/functional/apps/discover/ftr_provider_context.d.ts @@ -7,7 +7,13 @@ */ import { GenericFtrProviderContext } from '@kbn/test'; -import { services } from '../../services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { services as functionalServces } 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 83672889eff75..01df9b5fdcbbf 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 { services as commonServiceProviders } from '../../common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; import { AppsMenuService } from './apps_menu'; import { @@ -57,7 +57,7 @@ import { ESQLService } from './esql'; import { DataViewsService } from './data_views'; export const services = { - ...commonServiceProviders, + ...commonFunctionalServices, ...commonFunctionalUIServices, filterBar: FilterBarService, queryBar: QueryBarService, diff --git a/test/health_gateway/services/index.ts b/test/health_gateway/services/index.ts index b9c44e227adae..5a89fb849f952 100644 --- a/test/health_gateway/services/index.ts +++ b/test/health_gateway/services/index.ts @@ -6,11 +6,13 @@ * Side Public License, v 1. */ -import { services as commonServices } from '../../common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { HealthGatewayService } from './health_gateway'; export const services = { - ...commonServices, + ...commonFunctionalServices, + ...commonFunctionalUIServices, healthGateway: HealthGatewayService, }; diff --git a/test/server_integration/config.base.js b/test/server_integration/config.base.js index 71006c258c423..61243595505eb 100644 --- a/test/server_integration/config.base.js +++ b/test/server_integration/config.base.js @@ -12,13 +12,15 @@ 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: { - ...commonConfig.get('services'), + ...commonFunctionalServices, 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 2df95f0297f90..204c0ae0106e5 100644 --- a/test/server_integration/services/types.d.ts +++ b/test/server_integration/services/types.d.ts @@ -7,7 +7,14 @@ */ import { GenericFtrProviderContext } from '@kbn/test'; -import { services as kibanaCommonServices } from '../../common/services'; +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 kibanaApiIntegrationServices } from '../../api_integration/services'; export type FtrProviderContext = GenericFtrProviderContext< diff --git a/test/tsconfig.json b/test/tsconfig.json index 9f9f062a16492..8b0d946bded62 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -47,8 +47,6 @@ "@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", @@ -71,7 +69,6 @@ "@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 13bc2ee7de9d2..7c21e6df09f8c 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/test-suites-src/common/services/security/security'; +import { SecurityService } from '@kbn/ftr-common-functional-ui-services'; 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 bae5c5b8cdc44..5e034ce3a1847 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/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; import basicClusterFixture from './fixtures/basiccluster.json'; import multiClusterFixture from './fixtures/multicluster.json'; import type { FtrProviderContext } from '../../ftr_provider_context'; diff --git a/x-pack/test/common/services/bsearch_secure.ts b/x-pack/test/common/services/bsearch_secure.ts index f454aa3818ea6..ccd1866ddd66e 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 test/common/services/bsearch.ts but with the ability -// to provide custom auth +// 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 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 5e931b440654a..edf64c828e944 100644 --- a/x-pack/test/common/services/index.ts +++ b/x-pack/test/common/services/index.ts @@ -6,7 +6,8 @@ */ import { services as kibanaApiIntegrationServices } from '@kbn/test-suites-src/api_integration/services'; -import { services as kibanaCommonServices } from '@kbn/test-suites-src/common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { InfraLogViewsServiceProvider } from './infra_log_views'; import { SpacesServiceProvider } from './spaces'; import { BsearchSecureService } from './bsearch_secure'; @@ -14,7 +15,8 @@ import { ApmSynthtraceKibanaClientProvider } from './apm_synthtrace_kibana_clien import { InfraSynthtraceKibanaClientProvider } from './infra_synthtrace_kibana_client'; export const services = { - ...kibanaCommonServices, + ...commonFunctionalServices, + ...commonFunctionalUIServices, infraLogViews: InfraLogViewsServiceProvider, supertest: kibanaApiIntegrationServices.supertest, spaces: SpacesServiceProvider, diff --git a/x-pack/test/defend_workflows_cypress/services.ts b/x-pack/test/defend_workflows_cypress/services.ts index 272cf7eb8da4e..95fd493e6f668 100644 --- a/x-pack/test/defend_workflows_cypress/services.ts +++ b/x-pack/test/defend_workflows_cypress/services.ts @@ -5,4 +5,10 @@ * 2.0. */ -export * from '@kbn/test-suites-src/common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + +export const services = { + ...commonFunctionalServices, + ...commonFunctionalUIServices, +} as const; 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 f84c1f72fb657..74581fd681af7 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/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; 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 272cf7eb8da4e..8986c0928d750 100644 --- a/x-pack/test/fleet_cypress/services.ts +++ b/x-pack/test/fleet_cypress/services.ts @@ -4,5 +4,10 @@ * 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 * from '@kbn/test-suites-src/common/services'; +export const services = { + ...commonFunctionalServices, + ...commonFunctionalUIServices, +} as const; diff --git a/x-pack/test/osquery_cypress/services.ts b/x-pack/test/osquery_cypress/services.ts index 272cf7eb8da4e..95fd493e6f668 100644 --- a/x-pack/test/osquery_cypress/services.ts +++ b/x-pack/test/osquery_cypress/services.ts @@ -5,4 +5,10 @@ * 2.0. */ -export * from '@kbn/test-suites-src/common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + +export const services = { + ...commonFunctionalServices, + ...commonFunctionalUIServices, +} as const; 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 679a750af410b..2f467d4507e7f 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 { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; 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 d7c101dd52eaa..18a056b001c56 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 { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; 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 eb2aeb1df90a9..603a325ca0479 100644 --- a/x-pack/test/saved_objects_field_count/config.ts +++ b/x-pack/test/saved_objects_field_count/config.ts @@ -6,6 +6,7 @@ */ import { FtrConfigProviderContext } from '@kbn/test'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const kibanaCommonTestsConfig = await readConfigFile( @@ -15,6 +16,10 @@ 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 da57ccf64860e..00df4f0374c27 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/test-suites-src/common/services/bsearch'; +import type { SendOptions } from '@kbn/ftr-common-functional-services'; 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 72397582dad00..838f31e69412e 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/test-suites-src/common/services/bsearch'; +import type { BsearchService, SendOptions } from '@kbn/ftr-common-functional-services'; 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 3bccaf4a00fe3..a9663cd943a78 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 { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; 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 1c74a987e4fec..cf2ac65f1086b 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/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 a39da25c81aa3..80052ef3ddf56 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/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 19710d4eedf45..22001c26b66b5 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/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 5e9040424713b..166af42ba5702 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/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 7254dc6e99a5e..22edc8cff64de 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/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 2306861471073..8b1adb16975f6 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/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 4c555ca0d6555..36b2b677a1949 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,7 +14,8 @@ import { NetworkTlsStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; + +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 d99fbd296ba3e..ffb287239ac0f 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/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 952e3eed8f8af..f8d4aa80c0e3d 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/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 d7329a597e2e0..39dddc7a0c046 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/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 65b44bf4cbc5e..6765e6d2bb164 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,7 +14,8 @@ import { NetworkUsersStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; + +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 c66978bbe1b42..c42ac64de4a23 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,8 +14,9 @@ import { TimelineEventsAllStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 1e3119260455d..12539d43a145f 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,7 +13,8 @@ import { TimelineKpiStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; + +import { BsearchService } from '@kbn/ftr-common-functional-services'; 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 2f420920027d5..1f558e3c3f051 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/test-suites-src", + "@kbn/ftr-common-functional-ui-services", ] } diff --git a/x-pack/test/threat_intelligence_cypress/services.ts b/x-pack/test/threat_intelligence_cypress/services.ts index 272cf7eb8da4e..95fd493e6f668 100644 --- a/x-pack/test/threat_intelligence_cypress/services.ts +++ b/x-pack/test/threat_intelligence_cypress/services.ts @@ -5,4 +5,10 @@ * 2.0. */ -export * from '@kbn/test-suites-src/common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + +export const services = { + ...commonFunctionalServices, + ...commonFunctionalUIServices, +} as const; diff --git a/x-pack/test/upgrade_assistant_integration/config.js b/x-pack/test/upgrade_assistant_integration/config.js index dbdf0ade8affe..9529e4bc568d3 100644 --- a/x-pack/test/upgrade_assistant_integration/config.js +++ b/x-pack/test/upgrade_assistant_integration/config.js @@ -5,6 +5,8 @@ * 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( @@ -13,15 +15,12 @@ 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: { - ...kibanaCommonConfig.get('services'), + ...commonFunctionalServices, 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 72640103c0ef9..3ec162ad28ffd 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 consoleService = getService('console'); + const console = getService('console'); const svlUserManager = getService('svlUserManager'); const supertestWithoutAuth = getService('supertestWithoutAuth'); @@ -27,17 +27,6 @@ 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'; @@ -47,36 +36,26 @@ 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 createIndex(indexName); - await createAlias(indexName, aliasName); - await createComponentTemplate(componentTemplateName); - await createIndexTemplate(indexTemplateName, [dataStreamName], [componentTemplateName]); - await createDataStream(dataStreamName); + await console.createIndex(indexName); + await console.createAlias(indexName, aliasName); + await console.createComponentTemplate(componentTemplateName); + await console.createIndexTemplate( + indexTemplateName, + [dataStreamName], + [componentTemplateName] + ); + await console.createDataStream(dataStreamName); }); after(async () => { // Cleanup indices, aliases, templates, and data streams - await deleteAlias(indexName, aliasName); - await deleteIndex(indexName); - await deleteDataStream(dataStreamName); - await deleteIndexTemplate(indexTemplateName); - await deleteComponentTemplate(componentTemplateName); + await console.deleteAlias(indexName, aliasName); + await console.deleteIndex(indexName); + await console.deleteDataStream(dataStreamName); + await console.deleteIndexTemplate(indexTemplateName); + await console.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 7ebe89bed8247..03f8241c9e12a 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 test/common/services/bsearch.ts but with the ability -// to provide custom auth +// 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 import expect from '@kbn/expect'; import { GenericFtrService } from '@kbn/test'; From 6c60b52bd0770c635f9854b2e029b24105fe0e7e Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 22 Aug 2024 09:47:21 +0100 Subject: [PATCH 02/22] satisfy "node scripts/build_api_docs --plugin @kbn/ftr-common-functional-services --stats comments --stats exports" ...specifially the "--stats exports" bit --- packages/kbn-ftr-common-functional-services/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/kbn-ftr-common-functional-services/index.ts b/packages/kbn-ftr-common-functional-services/index.ts index e02703a08a7bc..36d76c7e2ffd7 100644 --- a/packages/kbn-ftr-common-functional-services/index.ts +++ b/packages/kbn-ftr-common-functional-services/index.ts @@ -34,3 +34,7 @@ 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'; From a6fd2e708e6bec175bb0cea2541ffdede3cd4501 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 22 Aug 2024 10:55:04 +0100 Subject: [PATCH 03/22] fixup threat intel svcs --- x-pack/test/threat_intelligence_cypress/config.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x-pack/test/threat_intelligence_cypress/config.ts b/x-pack/test/threat_intelligence_cypress/config.ts index 963cfab55dad5..c2e9a6ac8b180 100644 --- a/x-pack/test/threat_intelligence_cypress/config.ts +++ b/x-pack/test/threat_intelligence_cypress/config.ts @@ -6,9 +6,8 @@ */ 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') @@ -20,6 +19,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + services, + esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ From 07b6d70faf8767dd3bb2c5699bc6f6ab7d57befd Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 23 Aug 2024 10:38:09 +0100 Subject: [PATCH 04/22] drop the junit:merge to see if this lessens the total ci time, such that the cypress tests finish --- .buildkite/scripts/steps/functional/defend_workflows.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/scripts/steps/functional/defend_workflows.sh b/.buildkite/scripts/steps/functional/defend_workflows.sh index 80a58683af6fb..417a79ad294c4 100755 --- a/.buildkite/scripts/steps/functional/defend_workflows.sh +++ b/.buildkite/scripts/steps/functional/defend_workflows.sh @@ -14,4 +14,5 @@ cd x-pack/plugins/security_solution set +e BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci defend-workflows-bk-api-key) -BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn cypress:dw:run; status=$?; yarn junit:merge || :; exit $status +# BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn cypress:dw:run; status=$?; yarn junit:merge || :; exit $status +BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn cypress:dw:run; status=$?; exit $status From f203a900fcef9750d1b2c9fa9d4709c70c4eeb91 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 23 Aug 2024 11:53:11 +0100 Subject: [PATCH 05/22] fixup yet another pointer for common svcs --- x-pack/test/functional/services/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/x-pack/test/functional/services/index.ts b/x-pack/test/functional/services/index.ts index 708e0c29aa711..06c62c628da03 100644 --- a/x-pack/test/functional/services/index.ts +++ b/x-pack/test/functional/services/index.ts @@ -5,10 +5,9 @@ * 2.0. */ -import { services as kibanaFunctionalServices } from '@kbn/test-suites-src/functional/services'; import { services as kibanaApiIntegrationServices } from '@kbn/test-suites-src/api_integration/services'; import { services as kibanaXPackApiIntegrationServices } from '../../api_integration/services'; -import { services as commonServices } from '../../common/services'; +import { services as commonServicesPlus } from '../../common/services'; import { ReportingFunctionalProvider } from '../../reporting_functional/services'; import { @@ -74,8 +73,7 @@ import { SloUiServiceProvider } from './slo'; // available to your tests. If you don't specify anything here // only the built-in services will be available export const services = { - ...kibanaFunctionalServices, - ...commonServices, + ...commonServicesPlus, supertest: kibanaApiIntegrationServices.supertest, supertestWithoutAuth: kibanaXPackApiIntegrationServices.supertestWithoutAuth, From cea8f316bec8d06155f7256d01f678db57c71de3 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 23 Aug 2024 12:56:02 +0100 Subject: [PATCH 06/22] try to drop cypress tests for now --- .../scripts/steps/functional/defend_workflows.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.buildkite/scripts/steps/functional/defend_workflows.sh b/.buildkite/scripts/steps/functional/defend_workflows.sh index 417a79ad294c4..8387649b01eb7 100755 --- a/.buildkite/scripts/steps/functional/defend_workflows.sh +++ b/.buildkite/scripts/steps/functional/defend_workflows.sh @@ -7,12 +7,10 @@ source .buildkite/scripts/steps/functional/common.sh export JOB=kibana-defend-workflows-cypress export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION} -echo "--- Defend Workflows Cypress tests" +# echo "--- Defend Workflows Cypress tests" +echo "--- Defend Workflows Cypress tests DROPPED" -cd x-pack/plugins/security_solution - -set +e -BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci defend-workflows-bk-api-key) - -# BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn cypress:dw:run; status=$?; yarn junit:merge || :; exit $status -BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn cypress:dw:run; status=$?; exit $status +# cd x-pack/plugins/security_solution +# +# set +e +# BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci defend-workflows-bk-api-key) From 589cb63e244c3aee2186a7010515d69e1aad1f08 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 23 Aug 2024 14:19:21 +0100 Subject: [PATCH 07/22] put this back --- x-pack/test/functional/services/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x-pack/test/functional/services/index.ts b/x-pack/test/functional/services/index.ts index 06c62c628da03..708e0c29aa711 100644 --- a/x-pack/test/functional/services/index.ts +++ b/x-pack/test/functional/services/index.ts @@ -5,9 +5,10 @@ * 2.0. */ +import { services as kibanaFunctionalServices } from '@kbn/test-suites-src/functional/services'; import { services as kibanaApiIntegrationServices } from '@kbn/test-suites-src/api_integration/services'; import { services as kibanaXPackApiIntegrationServices } from '../../api_integration/services'; -import { services as commonServicesPlus } from '../../common/services'; +import { services as commonServices } from '../../common/services'; import { ReportingFunctionalProvider } from '../../reporting_functional/services'; import { @@ -73,7 +74,8 @@ import { SloUiServiceProvider } from './slo'; // available to your tests. If you don't specify anything here // only the built-in services will be available export const services = { - ...commonServicesPlus, + ...kibanaFunctionalServices, + ...commonServices, supertest: kibanaApiIntegrationServices.supertest, supertestWithoutAuth: kibanaXPackApiIntegrationServices.supertestWithoutAuth, From 899a3a989177f7331cadb8c1c17b3727298ac566 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 23 Aug 2024 16:26:25 +0100 Subject: [PATCH 08/22] drop these, just like I dropped defend_workflows script --- .buildkite/scripts/steps/functional/threat_intelligence.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.buildkite/scripts/steps/functional/threat_intelligence.sh b/.buildkite/scripts/steps/functional/threat_intelligence.sh index 58a3029469891..c5de2e9621ecd 100755 --- a/.buildkite/scripts/steps/functional/threat_intelligence.sh +++ b/.buildkite/scripts/steps/functional/threat_intelligence.sh @@ -7,8 +7,8 @@ source .buildkite/scripts/steps/functional/common.sh export JOB=kibana-threat-intelligence-chrome export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION} -echo "--- Threat Intelligence Cypress tests (Chrome)" +echo "--- Threat Intelligence Cypress tests (Chrome) DROPPED" -BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci threat-intelligence-bk-api-key) +# BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci threat-intelligence-bk-api-key) -BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn --cwd x-pack/plugins/threat_intelligence cypress:run +# BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn --cwd x-pack/plugins/threat_intelligence cypress:run From 1f33165a64b5a2c68db9f4b9db3be23409860ea5 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 26 Aug 2024 10:59:32 +0100 Subject: [PATCH 09/22] Turn defend_workflows.sh and defend_workflows.sh back on in ci --- .../scripts/steps/functional/defend_workflows.sh | 13 +++++++------ .../scripts/steps/functional/threat_intelligence.sh | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.buildkite/scripts/steps/functional/defend_workflows.sh b/.buildkite/scripts/steps/functional/defend_workflows.sh index 8387649b01eb7..80a58683af6fb 100755 --- a/.buildkite/scripts/steps/functional/defend_workflows.sh +++ b/.buildkite/scripts/steps/functional/defend_workflows.sh @@ -7,10 +7,11 @@ source .buildkite/scripts/steps/functional/common.sh export JOB=kibana-defend-workflows-cypress export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION} -# echo "--- Defend Workflows Cypress tests" -echo "--- Defend Workflows Cypress tests DROPPED" +echo "--- Defend Workflows Cypress tests" -# cd x-pack/plugins/security_solution -# -# set +e -# BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci defend-workflows-bk-api-key) +cd x-pack/plugins/security_solution + +set +e +BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci defend-workflows-bk-api-key) + +BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn cypress:dw:run; status=$?; yarn junit:merge || :; exit $status diff --git a/.buildkite/scripts/steps/functional/threat_intelligence.sh b/.buildkite/scripts/steps/functional/threat_intelligence.sh index c5de2e9621ecd..58a3029469891 100755 --- a/.buildkite/scripts/steps/functional/threat_intelligence.sh +++ b/.buildkite/scripts/steps/functional/threat_intelligence.sh @@ -7,8 +7,8 @@ source .buildkite/scripts/steps/functional/common.sh export JOB=kibana-threat-intelligence-chrome export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION} -echo "--- Threat Intelligence Cypress tests (Chrome) DROPPED" +echo "--- Threat Intelligence Cypress tests (Chrome)" -# BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci threat-intelligence-bk-api-key) +BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci threat-intelligence-bk-api-key) -# BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn --cwd x-pack/plugins/threat_intelligence cypress:run +BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn --cwd x-pack/plugins/threat_intelligence cypress:run From 499e40a34be935b77f5e7aaddc9b4d3deade946f Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 26 Aug 2024 13:08:17 +0100 Subject: [PATCH 10/22] Fix up from Dima's comment; Type checker passed locally with: "info [tsc] exited with 0 after 893.5 seconds" --- .../services/index_patterns.ts | 9 +++------ .../kbn-ftr-common-functional-services/tsconfig.json | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/kbn-ftr-common-functional-services/services/index_patterns.ts b/packages/kbn-ftr-common-functional-services/services/index_patterns.ts index f6610a8d8434e..6113040b927b3 100644 --- a/packages/kbn-ftr-common-functional-services/services/index_patterns.ts +++ b/packages/kbn-ftr-common-functional-services/services/index_patterns.ts @@ -7,13 +7,10 @@ */ import type { DataViewSpec } from '@kbn/data-plugin/common'; -import { FtrService } from './ftr_provider_context'; -// The fallowing two constant values live in -// '@kbn/data-views-plugin/server/constants' and -// '@kbn/core-http-common' respectively. -const INITIAL_REST_VERSION = '2023-10-31' as const; -const ELASTIC_HTTP_VERSION_HEADER = 'elastic-api-version' as const; +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'; export class IndexPatternsService extends FtrService { private readonly kibanaServer = this.ctx.getService('kibanaServer'); diff --git a/packages/kbn-ftr-common-functional-services/tsconfig.json b/packages/kbn-ftr-common-functional-services/tsconfig.json index cde384b3d689e..490eed5f7ac0e 100644 --- a/packages/kbn-ftr-common-functional-services/tsconfig.json +++ b/packages/kbn-ftr-common-functional-services/tsconfig.json @@ -23,7 +23,8 @@ "@kbn/dev-cli-runner", "@kbn/dev-cli-errors", "@kbn/repo-info", - "@kbn/es" + "@kbn/es", + "@kbn/data-views-plugin" ], "exclude": [ "target/**/*", From ddd95b251f094517ad38c30c21ecc20af530edb7 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 26 Aug 2024 13:46:23 +0100 Subject: [PATCH 11/22] attempt to extend the timeout's of the two scripts that are being cancelled --- .../pull_request/security_solution/defend_workflows.yml | 2 +- .../pull_request/security_solution/threat_intelligence.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml b/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml index 47f0e672a8d5a..69a456a5bc7af 100644 --- a/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml +++ b/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml @@ -9,7 +9,7 @@ steps: depends_on: - build - quick_checks - timeout_in_minutes: 60 + timeout_in_minutes: 120 parallelism: 20 retry: automatic: diff --git a/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml b/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml index 3b4f0e6accc7f..e01d338784182 100644 --- a/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml +++ b/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml @@ -7,7 +7,7 @@ steps: depends_on: - build - quick_checks - timeout_in_minutes: 60 + timeout_in_minutes: 120 parallelism: 1 retry: automatic: From ca91369dbff414949fc0a1526655edef9af3dcf7 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 26 Aug 2024 16:43:37 +0100 Subject: [PATCH 12/22] put these back as it made no difference --- .../pull_request/security_solution/defend_workflows.yml | 2 +- .../pull_request/security_solution/threat_intelligence.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml b/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml index 69a456a5bc7af..47f0e672a8d5a 100644 --- a/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml +++ b/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml @@ -9,7 +9,7 @@ steps: depends_on: - build - quick_checks - timeout_in_minutes: 120 + timeout_in_minutes: 60 parallelism: 20 retry: automatic: diff --git a/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml b/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml index e01d338784182..3b4f0e6accc7f 100644 --- a/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml +++ b/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml @@ -7,7 +7,7 @@ steps: depends_on: - build - quick_checks - timeout_in_minutes: 120 + timeout_in_minutes: 60 parallelism: 1 retry: automatic: From 76cc71369cc4a4ff1abad45f0278ecb04d4515f3 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 27 Aug 2024 13:06:58 +0100 Subject: [PATCH 13/22] [pairing with tom] drop svcs for now --- x-pack/test/defend_workflows_cypress/config.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/x-pack/test/defend_workflows_cypress/config.ts b/x-pack/test/defend_workflows_cypress/config.ts index a8502edcabe24..3b8df714a2d64 100644 --- a/x-pack/test/defend_workflows_cypress/config.ts +++ b/x-pack/test/defend_workflows_cypress/config.ts @@ -8,7 +8,6 @@ import { FtrConfigProviderContext } from '@kbn/test'; import { CA_CERT_PATH } from '@kbn/dev-utils'; import { getLocalhostRealIp } from '@kbn/security-solution-plugin/scripts/endpoint/common/network_services'; -import { services } from './services'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const kibanaCommonTestsConfig = await readConfigFile( @@ -23,8 +22,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), - services, - esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ From 990537b47860c7b061c2649ae1251768bbe19fb9 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 27 Aug 2024 13:33:30 +0100 Subject: [PATCH 14/22] [pairing with tom] add test/common/services back, but using the new 'homes' of the services --- test/common/services/index.ts | 45 +++++++++++++++++++ .../test/defend_workflows_cypress/config.ts | 3 ++ .../test/defend_workflows_cypress/services.ts | 8 +--- 3 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 test/common/services/index.ts diff --git a/test/common/services/index.ts b/test/common/services/index.ts new file mode 100644 index 0000000000000..18855d9dee114 --- /dev/null +++ b/test/common/services/index.ts @@ -0,0 +1,45 @@ +/* + * 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 { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + +// 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; + +export const services = { + es, + esArchiver, + kibanaServer, + retry, + supertestWithoutAuth, + deployment, + randomness, + security, + esDeleteAllIndices, + savedObjectInfo, + indexPatterns, + bsearch, + console, +}; diff --git a/x-pack/test/defend_workflows_cypress/config.ts b/x-pack/test/defend_workflows_cypress/config.ts index 3b8df714a2d64..a8502edcabe24 100644 --- a/x-pack/test/defend_workflows_cypress/config.ts +++ b/x-pack/test/defend_workflows_cypress/config.ts @@ -8,6 +8,7 @@ import { FtrConfigProviderContext } from '@kbn/test'; import { CA_CERT_PATH } from '@kbn/dev-utils'; import { getLocalhostRealIp } from '@kbn/security-solution-plugin/scripts/endpoint/common/network_services'; +import { services } from './services'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const kibanaCommonTestsConfig = await readConfigFile( @@ -22,6 +23,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + services, + esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ diff --git a/x-pack/test/defend_workflows_cypress/services.ts b/x-pack/test/defend_workflows_cypress/services.ts index 95fd493e6f668..272cf7eb8da4e 100644 --- a/x-pack/test/defend_workflows_cypress/services.ts +++ b/x-pack/test/defend_workflows_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'; From 4e4d0b2068eac0d05aaddc74100f03cbdbd8620c Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 27 Aug 2024 15:53:03 +0100 Subject: [PATCH 15/22] [pairing with tom] repoint to * --- x-pack/test/threat_intelligence_cypress/services.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/x-pack/test/threat_intelligence_cypress/services.ts b/x-pack/test/threat_intelligence_cypress/services.ts index 95fd493e6f668..272cf7eb8da4e 100644 --- a/x-pack/test/threat_intelligence_cypress/services.ts +++ b/x-pack/test/threat_intelligence_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'; From 029845977647be0d5dd3eb2c52c63399eabb1336 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 30 Aug 2024 10:05:23 +0100 Subject: [PATCH 16/22] Add services stanza with both common svcs spread into it --- .../plugins/observability_solution/synthetics/e2e/config.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x-pack/plugins/observability_solution/synthetics/e2e/config.ts b/x-pack/plugins/observability_solution/synthetics/e2e/config.ts index ea3d57ff4fca5..45b729c27bd8c 100644 --- a/x-pack/plugins/observability_solution/synthetics/e2e/config.ts +++ b/x-pack/plugins/observability_solution/synthetics/e2e/config.ts @@ -7,6 +7,8 @@ import { FtrConfigProviderContext } from '@kbn/test'; import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { readKibanaConfig } from './tasks/read_kibana_config'; const MANIFEST_KEY = 'xpack.uptime.service.manifestUrl'; const SERVICE_PASSWORD = 'xpack.uptime.service.password'; @@ -29,6 +31,10 @@ async function config({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + services: { + ...commonFunctionalServices, + ...commonFunctionalUIServices, + }, esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ From 1b8a9004a44718d1fd4fc5e6c08eda63b11edc88 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 30 Aug 2024 11:08:39 +0100 Subject: [PATCH 17/22] commit the first handfull. Committing due to it being obvious the services stanza was missing. --- .../observability_solution/apm/ftr_e2e/ftr_config.ts | 7 +++++++ .../observability_onboarding/e2e/ftr_config.ts | 7 +++++++ .../observability_solution/profiling/e2e/ftr_config.ts | 7 +++++++ .../observability_solution/synthetics/e2e/config.ts | 1 + x-pack/plugins/observability_solution/uptime/e2e/config.ts | 7 +++++++ 5 files changed, 29 insertions(+) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/ftr_config.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/ftr_config.ts index 9a0ccb56f1ad6..58cf601c33c43 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/ftr_config.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/ftr_config.ts @@ -7,6 +7,8 @@ import { FtrConfigProviderContext } from '@kbn/test'; import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { cypressTestRunner } from './cypress_test_runner'; import { FtrProviderContext } from './ftr_provider_context'; @@ -21,6 +23,11 @@ async function ftrConfig({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + services: { + ...commonFunctionalServices, + ...commonFunctionalUIServices, + }, + esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ diff --git a/x-pack/plugins/observability_solution/observability_onboarding/e2e/ftr_config.ts b/x-pack/plugins/observability_solution/observability_onboarding/e2e/ftr_config.ts index 757382042c5e9..56cb76e2b2ac7 100644 --- a/x-pack/plugins/observability_solution/observability_onboarding/e2e/ftr_config.ts +++ b/x-pack/plugins/observability_solution/observability_onboarding/e2e/ftr_config.ts @@ -7,6 +7,8 @@ import { FtrConfigProviderContext } from '@kbn/test'; import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import path from 'path'; const kibanaYamlFilePath = path.join(__dirname, './ftr_kibana.yml'); @@ -22,6 +24,11 @@ async function ftrConfig({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + services: { + ...commonFunctionalServices, + ...commonFunctionalUIServices, + }, + esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ diff --git a/x-pack/plugins/observability_solution/profiling/e2e/ftr_config.ts b/x-pack/plugins/observability_solution/profiling/e2e/ftr_config.ts index 757382042c5e9..56cb76e2b2ac7 100644 --- a/x-pack/plugins/observability_solution/profiling/e2e/ftr_config.ts +++ b/x-pack/plugins/observability_solution/profiling/e2e/ftr_config.ts @@ -7,6 +7,8 @@ import { FtrConfigProviderContext } from '@kbn/test'; import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import path from 'path'; const kibanaYamlFilePath = path.join(__dirname, './ftr_kibana.yml'); @@ -22,6 +24,11 @@ async function ftrConfig({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + services: { + ...commonFunctionalServices, + ...commonFunctionalUIServices, + }, + esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ diff --git a/x-pack/plugins/observability_solution/synthetics/e2e/config.ts b/x-pack/plugins/observability_solution/synthetics/e2e/config.ts index 45b729c27bd8c..06088cfcdd02a 100644 --- a/x-pack/plugins/observability_solution/synthetics/e2e/config.ts +++ b/x-pack/plugins/observability_solution/synthetics/e2e/config.ts @@ -35,6 +35,7 @@ async function config({ readConfigFile }: FtrConfigProviderContext) { ...commonFunctionalServices, ...commonFunctionalUIServices, }, + esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ diff --git a/x-pack/plugins/observability_solution/uptime/e2e/config.ts b/x-pack/plugins/observability_solution/uptime/e2e/config.ts index 18fe9bfd1712a..4f3e86eeb35ea 100644 --- a/x-pack/plugins/observability_solution/uptime/e2e/config.ts +++ b/x-pack/plugins/observability_solution/uptime/e2e/config.ts @@ -7,6 +7,8 @@ import { FtrConfigProviderContext } from '@kbn/test'; import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { readKibanaConfig } from './tasks/read_kibana_config'; const MANIFEST_KEY = 'xpack.uptime.service.manifestUrl'; const SERVICE_PASSWORD = 'xpack.uptime.service.password'; @@ -29,6 +31,11 @@ async function config({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + services: { + ...commonFunctionalServices, + ...commonFunctionalUIServices, + }, + esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ From 082d7d026686d1ef614a93a4818f878e6a5481c8 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 30 Aug 2024 10:33:54 +0000 Subject: [PATCH 18/22] [CI] Auto-commit changed files from 'node scripts/yarn_deduplicate' --- .../plugins/observability_solution/apm/ftr_e2e/tsconfig.json | 4 +++- .../observability_onboarding/e2e/tsconfig.json | 4 +++- .../observability_solution/profiling/e2e/tsconfig.json | 4 +++- .../observability_solution/synthetics/e2e/tsconfig.json | 3 ++- .../plugins/observability_solution/uptime/e2e/tsconfig.json | 3 ++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/tsconfig.json b/x-pack/plugins/observability_solution/apm/ftr_e2e/tsconfig.json index 6da58add924b0..804f3a3efa0a4 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/tsconfig.json +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/tsconfig.json @@ -14,6 +14,8 @@ "@kbn/dev-utils", "@kbn/axe-config", "@kbn/cypress-config", - "@kbn/apm-plugin" + "@kbn/apm-plugin", + "@kbn/ftr-common-functional-services", + "@kbn/ftr-common-functional-ui-services" ] } diff --git a/x-pack/plugins/observability_solution/observability_onboarding/e2e/tsconfig.json b/x-pack/plugins/observability_solution/observability_onboarding/e2e/tsconfig.json index 8970ccc1749df..94d4f2278cb63 100644 --- a/x-pack/plugins/observability_solution/observability_onboarding/e2e/tsconfig.json +++ b/x-pack/plugins/observability_solution/observability_onboarding/e2e/tsconfig.json @@ -12,6 +12,8 @@ "@kbn/test", "@kbn/dev-utils", "@kbn/cypress-config", - "@kbn/observability-onboarding-plugin" + "@kbn/observability-onboarding-plugin", + "@kbn/ftr-common-functional-services", + "@kbn/ftr-common-functional-ui-services" ] } diff --git a/x-pack/plugins/observability_solution/profiling/e2e/tsconfig.json b/x-pack/plugins/observability_solution/profiling/e2e/tsconfig.json index 6e8b7e3a8d3bb..c1a5e4f90e020 100644 --- a/x-pack/plugins/observability_solution/profiling/e2e/tsconfig.json +++ b/x-pack/plugins/observability_solution/profiling/e2e/tsconfig.json @@ -12,6 +12,8 @@ "@kbn/test", "@kbn/dev-utils", "@kbn/cypress-config", - "@kbn/observability-plugin" + "@kbn/observability-plugin", + "@kbn/ftr-common-functional-services", + "@kbn/ftr-common-functional-ui-services" ] } diff --git a/x-pack/plugins/observability_solution/synthetics/e2e/tsconfig.json b/x-pack/plugins/observability_solution/synthetics/e2e/tsconfig.json index 6fc40dded4e72..bbc7edf10c1f6 100644 --- a/x-pack/plugins/observability_solution/synthetics/e2e/tsconfig.json +++ b/x-pack/plugins/observability_solution/synthetics/e2e/tsconfig.json @@ -15,6 +15,7 @@ "@kbn/apm-plugin", "@kbn/es-archiver", "@kbn/repo-info", - "@kbn/synthetics-plugin" + "@kbn/synthetics-plugin", + "@kbn/ftr-common-functional-ui-services" ] } diff --git a/x-pack/plugins/observability_solution/uptime/e2e/tsconfig.json b/x-pack/plugins/observability_solution/uptime/e2e/tsconfig.json index 84a2627b487fe..2ad789f1e88d9 100644 --- a/x-pack/plugins/observability_solution/uptime/e2e/tsconfig.json +++ b/x-pack/plugins/observability_solution/uptime/e2e/tsconfig.json @@ -13,6 +13,7 @@ "@kbn/ux-plugin/e2e", "@kbn/ftr-common-functional-services", "@kbn/apm-plugin", - "@kbn/es-archiver" + "@kbn/es-archiver", + "@kbn/ftr-common-functional-ui-services" ] } From 0f53a1677377c29907d5caf06854096f1bf79463 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 30 Aug 2024 16:10:46 +0100 Subject: [PATCH 19/22] Change svc refs. --- x-pack/test/fleet_cypress/config.ts | 8 +++++++- x-pack/test/functional_enterprise_search/cli_config.ts | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/x-pack/test/fleet_cypress/config.ts b/x-pack/test/fleet_cypress/config.ts index da0d8aa7af271..1019e12ecbc1b 100644 --- a/x-pack/test/fleet_cypress/config.ts +++ b/x-pack/test/fleet_cypress/config.ts @@ -6,8 +6,9 @@ */ import { FtrConfigProviderContext, getKibanaCliLoggers } from '@kbn/test'; - import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const kibanaCommonTestsConfig = await readConfigFile( @@ -20,6 +21,11 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + services: { + ...commonFunctionalServices, + ...commonFunctionalUIServices, + }, + esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ diff --git a/x-pack/test/functional_enterprise_search/cli_config.ts b/x-pack/test/functional_enterprise_search/cli_config.ts index 05fe67f6be01a..ce439961848c8 100644 --- a/x-pack/test/functional_enterprise_search/cli_config.ts +++ b/x-pack/test/functional_enterprise_search/cli_config.ts @@ -6,6 +6,8 @@ */ import { FtrConfigProviderContext } from '@kbn/test'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { EnterpriseSearchCypressCliTestRunner } from './runner'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { @@ -16,6 +18,12 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + + services: { + ...commonFunctionalServices, + ...commonFunctionalUIServices, + }, + // default to the xpack functional config ...baseConfig.getAll(), From 5860bf4d704c73133c944f6315100e900f0ccfe3 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 30 Aug 2024 16:12:13 +0100 Subject: [PATCH 20/22] Add comments to hopefully trigger any other "extra" tests. --- x-pack/test/load/config.ts | 1 + x-pack/test/osquery_cypress/config.ts | 1 + x-pack/test/saved_objects_field_count/config.ts | 1 + x-pack/test/security_solution_cypress/config.ts | 1 + x-pack/test/threat_intelligence_cypress/config.ts | 1 + 5 files changed, 5 insertions(+) diff --git a/x-pack/test/load/config.ts b/x-pack/test/load/config.ts index b2559ead7af95..05f6e7ef86c2a 100644 --- a/x-pack/test/load/config.ts +++ b/x-pack/test/load/config.ts @@ -27,6 +27,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { require.resolve('../functional/config.base.js') ); + // FIXME Just triggering a change for ci purposes return { ...kibanaCommonTestsConfig.getAll(), diff --git a/x-pack/test/osquery_cypress/config.ts b/x-pack/test/osquery_cypress/config.ts index 37b522e424164..09a1623498e14 100644 --- a/x-pack/test/osquery_cypress/config.ts +++ b/x-pack/test/osquery_cypress/config.ts @@ -20,6 +20,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + // FIXME Just triggering a change for ci purposes servers: { ...kibanaCommonTestsConfig.get('servers'), fleetserver: { diff --git a/x-pack/test/saved_objects_field_count/config.ts b/x-pack/test/saved_objects_field_count/config.ts index 603a325ca0479..938a8e4a18e6c 100644 --- a/x-pack/test/saved_objects_field_count/config.ts +++ b/x-pack/test/saved_objects_field_count/config.ts @@ -16,6 +16,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + // FIXME Just triggering a change for ci purposes services: { ...commonFunctionalServices, }, diff --git a/x-pack/test/security_solution_cypress/config.ts b/x-pack/test/security_solution_cypress/config.ts index 1bed88858601d..b372f63f47394 100644 --- a/x-pack/test/security_solution_cypress/config.ts +++ b/x-pack/test/security_solution_cypress/config.ts @@ -20,6 +20,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + // FIXME Just triggering a change for ci purposes esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ diff --git a/x-pack/test/threat_intelligence_cypress/config.ts b/x-pack/test/threat_intelligence_cypress/config.ts index c2e9a6ac8b180..cdc6d1fe5c71a 100644 --- a/x-pack/test/threat_intelligence_cypress/config.ts +++ b/x-pack/test/threat_intelligence_cypress/config.ts @@ -19,6 +19,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + // FIXME Just triggering a change for ci purposes services, esTestCluster: { From 357724ea3e31d5cee48202c15c43f44e963f712d Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 2 Sep 2024 12:16:49 +0100 Subject: [PATCH 21/22] fix svc refs. --- x-pack/test/fleet_cypress/config.ts | 7 ------- x-pack/test/fleet_cypress/services.ts | 7 +------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/x-pack/test/fleet_cypress/config.ts b/x-pack/test/fleet_cypress/config.ts index 1019e12ecbc1b..d868be18bc5c3 100644 --- a/x-pack/test/fleet_cypress/config.ts +++ b/x-pack/test/fleet_cypress/config.ts @@ -7,8 +7,6 @@ import { FtrConfigProviderContext, getKibanaCliLoggers } from '@kbn/test'; import { CA_CERT_PATH } from '@kbn/dev-utils'; -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const kibanaCommonTestsConfig = await readConfigFile( @@ -21,11 +19,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), - services: { - ...commonFunctionalServices, - ...commonFunctionalUIServices, - }, - esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ 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'; From 0c26add048a350ed55be342d0db08ca626b8db0a Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 2 Sep 2024 15:32:05 +0100 Subject: [PATCH 22/22] Drop these. --- x-pack/test/load/config.ts | 1 - x-pack/test/osquery_cypress/config.ts | 1 - x-pack/test/saved_objects_field_count/config.ts | 1 - x-pack/test/security_solution_cypress/config.ts | 1 - x-pack/test/threat_intelligence_cypress/config.ts | 1 - 5 files changed, 5 deletions(-) diff --git a/x-pack/test/load/config.ts b/x-pack/test/load/config.ts index 05f6e7ef86c2a..b2559ead7af95 100644 --- a/x-pack/test/load/config.ts +++ b/x-pack/test/load/config.ts @@ -27,7 +27,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { require.resolve('../functional/config.base.js') ); - // FIXME Just triggering a change for ci purposes return { ...kibanaCommonTestsConfig.getAll(), diff --git a/x-pack/test/osquery_cypress/config.ts b/x-pack/test/osquery_cypress/config.ts index 09a1623498e14..37b522e424164 100644 --- a/x-pack/test/osquery_cypress/config.ts +++ b/x-pack/test/osquery_cypress/config.ts @@ -20,7 +20,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), - // FIXME Just triggering a change for ci purposes servers: { ...kibanaCommonTestsConfig.get('servers'), fleetserver: { diff --git a/x-pack/test/saved_objects_field_count/config.ts b/x-pack/test/saved_objects_field_count/config.ts index 938a8e4a18e6c..603a325ca0479 100644 --- a/x-pack/test/saved_objects_field_count/config.ts +++ b/x-pack/test/saved_objects_field_count/config.ts @@ -16,7 +16,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), - // FIXME Just triggering a change for ci purposes services: { ...commonFunctionalServices, }, diff --git a/x-pack/test/security_solution_cypress/config.ts b/x-pack/test/security_solution_cypress/config.ts index b372f63f47394..1bed88858601d 100644 --- a/x-pack/test/security_solution_cypress/config.ts +++ b/x-pack/test/security_solution_cypress/config.ts @@ -20,7 +20,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), - // FIXME Just triggering a change for ci purposes esTestCluster: { ...xpackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ diff --git a/x-pack/test/threat_intelligence_cypress/config.ts b/x-pack/test/threat_intelligence_cypress/config.ts index cdc6d1fe5c71a..c2e9a6ac8b180 100644 --- a/x-pack/test/threat_intelligence_cypress/config.ts +++ b/x-pack/test/threat_intelligence_cypress/config.ts @@ -19,7 +19,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), - // FIXME Just triggering a change for ci purposes services, esTestCluster: {