diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a2ab11703f473..9a1762436e2ae 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -597,6 +597,7 @@ src/platform/packages/shared/kbn-storybook @elastic/kibana-operations src/platform/packages/shared/kbn-telemetry @elastic/kibana-core @elastic/obs-ai-assistant src/platform/packages/shared/kbn-telemetry-config @elastic/kibana-core src/platform/packages/shared/kbn-test @elastic/kibana-operations @elastic/appex-qa +src/platform/packages/shared/kbn-test-es-server @elastic/kibana-operations @elastic/appex-qa src/platform/packages/shared/kbn-test-jest-helpers @elastic/kibana-operations @elastic/appex-qa src/platform/packages/shared/kbn-test-subj-selector @elastic/kibana-operations @elastic/appex-qa src/platform/packages/shared/kbn-timerange @elastic/obs-onboarding-team diff --git a/package.json b/package.json index b7edfca3ddd4d..61c6e3bd6a690 100644 --- a/package.json +++ b/package.json @@ -1684,6 +1684,7 @@ "@kbn/synthetics-private-location": "link:x-pack/packages/kbn-synthetics-private-location", "@kbn/telemetry-tools": "link:src/platform/packages/private/kbn-telemetry-tools", "@kbn/test": "link:src/platform/packages/shared/kbn-test", + "@kbn/test-es-server": "link:src/platform/packages/shared/kbn-test-es-server", "@kbn/test-eui-helpers": "link:src/platform/packages/private/kbn-test-eui-helpers", "@kbn/test-jest-helpers": "link:src/platform/packages/shared/kbn-test-jest-helpers", "@kbn/test-subj-selector": "link:src/platform/packages/shared/kbn-test-subj-selector", diff --git a/packages/kbn-repo-source-classifier/src/repo_source_classifier.ts b/packages/kbn-repo-source-classifier/src/repo_source_classifier.ts index 3734471184ac4..bffd269153cc0 100644 --- a/packages/kbn-repo-source-classifier/src/repo_source_classifier.ts +++ b/packages/kbn-repo-source-classifier/src/repo_source_classifier.ts @@ -162,7 +162,11 @@ export class RepoSourceClassifier { const { pkgId, rel } = pkgInfo; - if (pkgId === '@kbn/test' || pkgId === '@kbn/test-subj-selector') { + if ( + pkgId === '@kbn/test' || + pkgId === '@kbn/test-es-server' || + pkgId === '@kbn/test-subj-selector' + ) { return 'common package'; } diff --git a/src/platform/packages/shared/kbn-scout/moon.yml b/src/platform/packages/shared/kbn-scout/moon.yml index b64c2d0a7c749..3a6fc8ea85f3e 100644 --- a/src/platform/packages/shared/kbn-scout/moon.yml +++ b/src/platform/packages/shared/kbn-scout/moon.yml @@ -26,6 +26,7 @@ dependsOn: - '@kbn/es' - '@kbn/dev-proc-runner' - '@kbn/kbn-client' + - '@kbn/test-es-server' - '@kbn/test' - '@kbn/es-archiver' - '@kbn/dev-utils' diff --git a/src/platform/packages/shared/kbn-scout/src/common/services/clients.ts b/src/platform/packages/shared/kbn-scout/src/common/services/clients.ts index d1a3170237e1f..9b8275a7c31f0 100644 --- a/src/platform/packages/shared/kbn-scout/src/common/services/clients.ts +++ b/src/platform/packages/shared/kbn-scout/src/common/services/clients.ts @@ -8,7 +8,7 @@ */ import { KbnClient } from '@kbn/kbn-client'; -import { createEsClientForTesting } from '@kbn/test'; +import { createEsClientForTesting } from '@kbn/test-es-server'; import type { ScoutLogger } from './logger'; import type { ScoutTestConfig, EsClient } from '../../types'; diff --git a/src/platform/packages/shared/kbn-scout/src/servers/run_elasticsearch.ts b/src/platform/packages/shared/kbn-scout/src/servers/run_elasticsearch.ts index 2e05724ac2036..6c7547313b98e 100644 --- a/src/platform/packages/shared/kbn-scout/src/servers/run_elasticsearch.ts +++ b/src/platform/packages/shared/kbn-scout/src/servers/run_elasticsearch.ts @@ -10,7 +10,7 @@ import type { ArtifactLicense, ServerlessProjectType } from '@kbn/es'; import { isServerlessProjectType } from '@kbn/es/src/utils'; import { REPO_ROOT } from '@kbn/repo-info'; -import { cleanupElasticsearch, createTestEsCluster, esTestConfig } from '@kbn/test'; +import { cleanupElasticsearch, createTestEsCluster, esTestConfig } from '@kbn/test-es-server'; import type { ToolingLog } from '@kbn/tooling-log'; import { resolve } from 'path'; import Url from 'url'; diff --git a/src/platform/packages/shared/kbn-scout/tsconfig.json b/src/platform/packages/shared/kbn-scout/tsconfig.json index 10fee2e9d3d61..f5a1a7d28b800 100644 --- a/src/platform/packages/shared/kbn-scout/tsconfig.json +++ b/src/platform/packages/shared/kbn-scout/tsconfig.json @@ -2,17 +2,10 @@ "extends": "@kbn/tsconfig-base/tsconfig.json", "compilerOptions": { "outDir": "target/types", - "types": [ - "jest", - "node" - ] + "types": ["jest", "node"] }, - "include": [ - "**/*.ts", - ], - "exclude": [ - "target/**/*" - ], + "include": ["**/*.ts"], + "exclude": ["target/**/*"], "kbn_references": [ "@kbn/tooling-log", "@kbn/dev-cli-runner", @@ -23,6 +16,7 @@ "@kbn/es", "@kbn/dev-proc-runner", "@kbn/kbn-client", + "@kbn/test-es-server", "@kbn/test", "@kbn/es-archiver", "@kbn/dev-utils", diff --git a/src/platform/packages/shared/kbn-test/src/es/index.ts b/src/platform/packages/shared/kbn-test-es-server/index.ts similarity index 58% rename from src/platform/packages/shared/kbn-test/src/es/index.ts rename to src/platform/packages/shared/kbn-test-es-server/index.ts index 1652e5e706db3..a67c88fc7c172 100644 --- a/src/platform/packages/shared/kbn-test/src/es/index.ts +++ b/src/platform/packages/shared/kbn-test-es-server/index.ts @@ -7,12 +7,16 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { createTestEsCluster } from './test_es_cluster'; -export type { CreateTestEsClusterOptions, EsTestCluster, ICluster } from './test_es_cluster'; -export { esTestConfig } from './es_test_config'; +export { CI_PARALLEL_PROCESS_PREFIX } from './src/ci_parallel_process_prefix'; +export { cleanupElasticsearch } from './src/cleanup_elasticsearch'; export { createEsClientForTesting, - createEsClientForFtrConfig, - createRemoteEsClientForFtrConfig, -} from './es_client_for_testing'; -export type { EsClientForTestingOptions } from './es_client_for_testing'; + type EsClientForTestingOptions, +} from './src/es_client_for_testing'; +export { esTestConfig } from './src/es_test_config'; +export { + createTestEsCluster, + type CreateTestEsClusterOptions, + type EsTestCluster, + type ICluster, +} from './src/test_es_cluster'; diff --git a/src/platform/packages/shared/kbn-test-es-server/jest.config.js b/src/platform/packages/shared/kbn-test-es-server/jest.config.js new file mode 100644 index 0000000000000..d4365f52a6aac --- /dev/null +++ b/src/platform/packages/shared/kbn-test-es-server/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../../../..', + roots: ['/src/platform/packages/shared/kbn-test-es-server'], +}; diff --git a/src/platform/packages/shared/kbn-test-es-server/kibana.jsonc b/src/platform/packages/shared/kbn-test-es-server/kibana.jsonc new file mode 100644 index 0000000000000..4f9c25d4316e0 --- /dev/null +++ b/src/platform/packages/shared/kbn-test-es-server/kibana.jsonc @@ -0,0 +1,11 @@ +{ + "type": "shared-common", + "id": "@kbn/test-es-server", + "owner": [ + "@elastic/kibana-operations", + "@elastic/appex-qa" + ], + "group": "platform", + "visibility": "shared", + "devOnly": true +} diff --git a/src/platform/packages/shared/kbn-test-es-server/moon.yml b/src/platform/packages/shared/kbn-test-es-server/moon.yml new file mode 100644 index 0000000000000..01861dc8abd55 --- /dev/null +++ b/src/platform/packages/shared/kbn-test-es-server/moon.yml @@ -0,0 +1,58 @@ +# This file is generated by the @kbn/moon package. Any manual edits will be erased! +# To extend this, write your extensions/overrides to 'moon.extend.yml' +# then regenerate this file with: 'node scripts/regenerate_moon_projects.js --update --filter @kbn/test-es-server' + +$schema: https://moonrepo.dev/schemas/project.json +id: '@kbn/test-es-server' +layer: unknown +owners: + defaultOwner: '@elastic/kibana-operations' +toolchains: + default: node +language: typescript +project: + title: '@kbn/test-es-server' + description: Moon project for @kbn/test-es-server + channel: '' + owner: '@elastic/kibana-operations' + sourceRoot: src/platform/packages/shared/kbn-test-es-server +dependsOn: + - '@kbn/dev-utils' + - '@kbn/es' + - '@kbn/repo-info' + - '@kbn/tooling-log' +tags: + - shared-common + - package + - dev + - group-platform + - shared + - jest-unit-tests +fileGroups: + src: + - '**/*.ts' + - '**/*.js' + - '!target/**/*' +tasks: + jest: + command: node + args: + - '--no-experimental-require-module' + - $workspaceRoot/scripts/jest + - '--config' + - $projectRoot/jest.config.js + options: + runFromWorkspaceRoot: true + inputs: + - '@group(src)' + jestCI: + command: node + args: + - '--no-experimental-require-module' + - $workspaceRoot/scripts/jest + - '--config' + - $projectRoot/jest.config.js + options: + runFromWorkspaceRoot: true + inputs: + - '@group(src)' diff --git a/src/platform/packages/shared/kbn-test-es-server/package.json b/src/platform/packages/shared/kbn-test-es-server/package.json new file mode 100644 index 0000000000000..79a763d1151d4 --- /dev/null +++ b/src/platform/packages/shared/kbn-test-es-server/package.json @@ -0,0 +1,7 @@ +{ + "name": "@kbn/test-es-server", + "author": "Operations", + "version": "1.0.0", + "private": true, + "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0" +} diff --git a/src/platform/packages/shared/kbn-test/src/ci_parallel_process_prefix.ts b/src/platform/packages/shared/kbn-test-es-server/src/ci_parallel_process_prefix.ts similarity index 100% rename from src/platform/packages/shared/kbn-test/src/ci_parallel_process_prefix.ts rename to src/platform/packages/shared/kbn-test-es-server/src/ci_parallel_process_prefix.ts diff --git a/src/platform/packages/shared/kbn-test-es-server/src/cleanup_elasticsearch.ts b/src/platform/packages/shared/kbn-test-es-server/src/cleanup_elasticsearch.ts new file mode 100644 index 0000000000000..cc84b5da8b7c2 --- /dev/null +++ b/src/platform/packages/shared/kbn-test-es-server/src/cleanup_elasticsearch.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import type { ToolingLog } from '@kbn/tooling-log'; +import { extractAndArchiveLogs } from '@kbn/es/src/utils'; +import type { ICluster } from './test_es_cluster'; + +export async function cleanupElasticsearch( + node: ICluster, + isServerless: boolean, + logsDir: string | undefined, + log: ToolingLog +): Promise { + await node.cleanup(); + + if (isServerless) { + await extractAndArchiveLogs({ outputFolder: logsDir, log }); + } +} diff --git a/src/platform/packages/shared/kbn-test/src/es/es_client_for_testing.ts b/src/platform/packages/shared/kbn-test-es-server/src/es_client_for_testing.ts similarity index 66% rename from src/platform/packages/shared/kbn-test/src/es/es_client_for_testing.ts rename to src/platform/packages/shared/kbn-test-es-server/src/es_client_for_testing.ts index c89a18528cb2c..511014b71ad5c 100644 --- a/src/platform/packages/shared/kbn-test/src/es/es_client_for_testing.ts +++ b/src/platform/packages/shared/kbn-test-es-server/src/es_client_for_testing.ts @@ -13,7 +13,6 @@ import * as Fs from 'fs'; import { CA_CERT_PATH } from '@kbn/dev-utils'; import type { ClientOptions } from '@elastic/elasticsearch'; import { Client as EsClient, HttpConnection } from '@elastic/elasticsearch'; -import type { Config } from '../functional_test_runner'; /** options for creating es instances used in functional testing scenarios */ export interface EsClientForTestingOptions extends Omit { @@ -29,36 +28,13 @@ export interface EsClientForTestingOptions extends Omit -) { - const ccsConfig = config.get('esTestCluster.ccs'); - if (!ccsConfig) { - throw new Error('FTR config is missing esTestCluster.ccs'); - } - - return createEsClientForTesting({ - esUrl: ccsConfig.remoteClusterUrl, - requestTimeout: config.get('timeouts.esRequestTimeout'), - ...overrides, - }); -} - -export function createEsClientForFtrConfig( - config: Config, - overrides?: Omit -) { - const esUrl = Url.format(config.get('servers.elasticsearch')); - return createEsClientForTesting({ - esUrl, - requestTimeout: config.get('timeouts.esRequestTimeout'), - ...overrides, - }); -} - export function createEsClientForTesting(options: EsClientForTestingOptions) { - const { esUrl, authOverride, isCloud = !!process.env.TEST_CLOUD, ...otherOptions } = options; + const { + esUrl: _esUrl, + authOverride, + isCloud = !!process.env.TEST_CLOUD, + ...otherOptions + } = options; const url = options.authOverride ? Url.format({ diff --git a/src/platform/packages/shared/kbn-test/src/es/es_test_config.ts b/src/platform/packages/shared/kbn-test-es-server/src/es_test_config.ts similarity index 88% rename from src/platform/packages/shared/kbn-test/src/es/es_test_config.ts rename to src/platform/packages/shared/kbn-test-es-server/src/es_test_config.ts index ba5b34b569bfe..638a4964e3ba7 100644 --- a/src/platform/packages/shared/kbn-test/src/es/es_test_config.ts +++ b/src/platform/packages/shared/kbn-test-es-server/src/es_test_config.ts @@ -9,7 +9,7 @@ import { kibanaPackageJson as pkg } from '@kbn/repo-info'; import Url from 'url'; -import { systemIndicesSuperuser } from '../kbn'; +import { SYSTEM_INDICES_SUPERUSER } from '@kbn/es'; class EsTestConfig { getVersion() { @@ -56,8 +56,8 @@ class EsTestConfig { }; } - const username = process.env.TEST_ES_USERNAME || systemIndicesSuperuser.username; - const password = process.env.TEST_ES_PASSWORD || systemIndicesSuperuser.password; + const username = process.env.TEST_ES_USERNAME || SYSTEM_INDICES_SUPERUSER; + const password = process.env.TEST_ES_PASSWORD || process.env.TEST_ES_PASS || 'changeme'; const port = process.env.TEST_ES_PORT ? parseInt(process.env.TEST_ES_PORT, 10) : 9220; @@ -69,7 +69,7 @@ class EsTestConfig { return { // Allow setting any individual component(s) of the URL, - // or use default values (username and password from ../kbn/users.js) + // or use default values (aligned with @kbn/test systemIndicesSuperuser defaults) protocol: process.env.TEST_ES_PROTOCOL || 'http', hostname: process.env.TEST_ES_HOSTNAME || 'localhost', port, diff --git a/src/platform/packages/shared/kbn-test/src/es/test_es_cluster.ts b/src/platform/packages/shared/kbn-test-es-server/src/test_es_cluster.ts similarity index 99% rename from src/platform/packages/shared/kbn-test/src/es/test_es_cluster.ts rename to src/platform/packages/shared/kbn-test-es-server/src/test_es_cluster.ts index bcb7d4f8ad2a8..24aec8b2bfccd 100644 --- a/src/platform/packages/shared/kbn-test/src/es/test_es_cluster.ts +++ b/src/platform/packages/shared/kbn-test-es-server/src/test_es_cluster.ts @@ -22,7 +22,7 @@ import { REPO_ROOT } from '@kbn/repo-info'; import type { ArtifactLicense } from '@kbn/es'; import type { ServerlessOptions } from '@kbn/es/src/utils'; import { getFips } from 'crypto'; -import { CI_PARALLEL_PROCESS_PREFIX } from '../ci_parallel_process_prefix'; +import { CI_PARALLEL_PROCESS_PREFIX } from './ci_parallel_process_prefix'; import { esTestConfig } from './es_test_config'; interface TestEsClusterNodesOptions { diff --git a/src/platform/packages/shared/kbn-test-es-server/tsconfig.json b/src/platform/packages/shared/kbn-test-es-server/tsconfig.json new file mode 100644 index 0000000000000..070582b675931 --- /dev/null +++ b/src/platform/packages/shared/kbn-test-es-server/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "@kbn/tsconfig-base/tsconfig.json", + "compilerOptions": { + "outDir": "target/types", + "stripInternal": true, + "types": ["jest", "node"] + }, + "include": ["**/*.ts", "**/*.js"], + "exclude": ["target/**/*"], + "kbn_references": [ + "@kbn/dev-utils", + "@kbn/es", + "@kbn/repo-info", + "@kbn/tooling-log" + ] +} diff --git a/src/platform/packages/shared/kbn-test/index.ts b/src/platform/packages/shared/kbn-test/index.ts index e16f6d0e997e2..c86ee63d4d3ad 100644 --- a/src/platform/packages/shared/kbn-test/index.ts +++ b/src/platform/packages/shared/kbn-test/index.ts @@ -37,14 +37,9 @@ export type { EsTestCluster, ICluster, EsClientForTestingOptions, -} from './src/es'; -export { - esTestConfig, - createTestEsCluster, - createEsClientForTesting, - createEsClientForFtrConfig, - createRemoteEsClientForFtrConfig, -} from './src/es'; +} from '@kbn/test-es-server'; +export { esTestConfig, createTestEsCluster, createEsClientForTesting } from '@kbn/test-es-server'; +export { createEsClientForFtrConfig, createRemoteEsClientForFtrConfig } from './src/ftr_es_client'; export { kbnTestConfig } from './kbn_test_config'; export type { UrlParts } from './kbn_test_config'; @@ -60,7 +55,7 @@ export { // @internal export { setupJUnitReportGeneration, escapeCdata } from './src/mocha'; -export { CI_PARALLEL_PROCESS_PREFIX } from './src/ci_parallel_process_prefix'; +export { CI_PARALLEL_PROCESS_PREFIX } from '@kbn/test-es-server'; export * from './src/functional_test_runner'; diff --git a/src/platform/packages/shared/kbn-test/moon.yml b/src/platform/packages/shared/kbn-test/moon.yml index 09234603179a3..55c111cb58dfa 100644 --- a/src/platform/packages/shared/kbn-test/moon.yml +++ b/src/platform/packages/shared/kbn-test/moon.yml @@ -18,8 +18,8 @@ project: sourceRoot: src/platform/packages/shared/kbn-test dependsOn: - '@kbn/kbn-client' - - '@kbn/dev-utils' - '@kbn/std' + - '@kbn/test-es-server' - '@kbn/tooling-log' - '@kbn/get-repo-files' - '@kbn/peggy' diff --git a/src/platform/packages/shared/kbn-test/src/ftr_es_client.ts b/src/platform/packages/shared/kbn-test/src/ftr_es_client.ts new file mode 100644 index 0000000000000..89a08bce87f72 --- /dev/null +++ b/src/platform/packages/shared/kbn-test/src/ftr_es_client.ts @@ -0,0 +1,43 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import * as Url from 'url'; + +import { createEsClientForTesting, type EsClientForTestingOptions } from '@kbn/test-es-server'; +import type { Config } from './functional_test_runner'; + +export type { EsClientForTestingOptions }; + +export function createRemoteEsClientForFtrConfig( + config: Config, + overrides?: Omit +) { + const ccsConfig = config.get('esTestCluster.ccs'); + if (!ccsConfig) { + throw new Error('FTR config is missing esTestCluster.ccs'); + } + + return createEsClientForTesting({ + esUrl: ccsConfig.remoteClusterUrl, + requestTimeout: config.get('timeouts.esRequestTimeout'), + ...overrides, + }); +} + +export function createEsClientForFtrConfig( + config: Config, + overrides?: Omit +) { + const esUrl = Url.format(config.get('servers.elasticsearch')); + return createEsClientForTesting({ + esUrl, + requestTimeout: config.get('timeouts.esRequestTimeout'), + ...overrides, + }); +} diff --git a/src/platform/packages/shared/kbn-test/src/functional_test_runner/functional_test_runner.ts b/src/platform/packages/shared/kbn-test/src/functional_test_runner/functional_test_runner.ts index d6d1e62d80dcc..b79790d41ce38 100644 --- a/src/platform/packages/shared/kbn-test/src/functional_test_runner/functional_test_runner.ts +++ b/src/platform/packages/shared/kbn-test/src/functional_test_runner/functional_test_runner.ts @@ -24,7 +24,7 @@ import { EsVersion, DedicatedTaskRunner, } from './lib'; -import { createEsClientForFtrConfig } from '../es'; +import { createEsClientForFtrConfig } from '../ftr_es_client'; export class FunctionalTestRunner { private readonly esVersion: EsVersion; diff --git a/src/platform/packages/shared/kbn-test/src/functional_tests/lib/index.ts b/src/platform/packages/shared/kbn-test/src/functional_tests/lib/index.ts index e26d77217ef5e..126bb1d240723 100644 --- a/src/platform/packages/shared/kbn-test/src/functional_tests/lib/index.ts +++ b/src/platform/packages/shared/kbn-test/src/functional_tests/lib/index.ts @@ -8,7 +8,8 @@ */ export { runKibanaServer } from './run_kibana_server'; -export { runElasticsearch, cleanupElasticsearch } from './run_elasticsearch'; +export { runElasticsearch } from './run_elasticsearch'; +export { cleanupElasticsearch } from '@kbn/test-es-server'; export * from './run_ftr'; export { parseRawFlags, diff --git a/src/platform/packages/shared/kbn-test/src/functional_tests/lib/run_elasticsearch.ts b/src/platform/packages/shared/kbn-test/src/functional_tests/lib/run_elasticsearch.ts index 4ab9a2c3e283c..612929d734608 100644 --- a/src/platform/packages/shared/kbn-test/src/functional_tests/lib/run_elasticsearch.ts +++ b/src/platform/packages/shared/kbn-test/src/functional_tests/lib/run_elasticsearch.ts @@ -15,9 +15,8 @@ import getopts from 'getopts'; import { REPO_ROOT } from '@kbn/repo-info'; import type { ArtifactLicense, ServerlessProjectType } from '@kbn/es'; import { isServerlessProjectType, extractAndArchiveLogs } from '@kbn/es/src/utils'; +import { cleanupElasticsearch, createTestEsCluster, esTestConfig } from '@kbn/test-es-server'; import type { Config } from '../../functional_test_runner'; -import type { ICluster } from '../../es'; -import { createTestEsCluster, esTestConfig } from '../../es'; interface RunElasticsearchOptions { log: ToolingLog; @@ -78,19 +77,6 @@ function getEsConfig({ }; } -export async function cleanupElasticsearch( - node: ICluster, - isServerless: boolean, - logsDir: string | undefined, - log: ToolingLog -): Promise { - await node.cleanup(); - - if (isServerless) { - await extractAndArchiveLogs({ outputFolder: logsDir, log }); - } -} - export async function runElasticsearch( options: RunElasticsearchOptions ): Promise<() => Promise> { diff --git a/src/platform/packages/shared/kbn-test/src/report_path.ts b/src/platform/packages/shared/kbn-test/src/report_path.ts index 858d9de1b6506..5f76f164d6b2b 100644 --- a/src/platform/packages/shared/kbn-test/src/report_path.ts +++ b/src/platform/packages/shared/kbn-test/src/report_path.ts @@ -10,7 +10,7 @@ import Fs from 'fs'; import Path from 'path'; -import { CI_PARALLEL_PROCESS_PREFIX } from './ci_parallel_process_prefix'; +import { CI_PARALLEL_PROCESS_PREFIX } from '@kbn/test-es-server'; export function getUniqueJunitReportPath( rootDirectory: string, diff --git a/src/platform/packages/shared/kbn-test/tsconfig.json b/src/platform/packages/shared/kbn-test/tsconfig.json index c97fd9111397d..1c99a1fd7c6a0 100644 --- a/src/platform/packages/shared/kbn-test/tsconfig.json +++ b/src/platform/packages/shared/kbn-test/tsconfig.json @@ -3,25 +3,14 @@ "compilerOptions": { "outDir": "target/types", "stripInternal": true, - "types": [ - "jest", - "node" - ] + "types": ["jest", "node"] }, - "include": [ - "**/*.ts", - "**/*.js", - "src/jest/jest_flags.json", - ], - "exclude": [ - "types/**/*", - "**/__fixtures__/**/*", - "target/**/*", - ], + "include": ["**/*.ts", "**/*.js", "src/jest/jest_flags.json"], + "exclude": ["types/**/*", "**/__fixtures__/**/*", "target/**/*"], "kbn_references": [ "@kbn/kbn-client", - "@kbn/dev-utils", "@kbn/std", + "@kbn/test-es-server", "@kbn/tooling-log", "@kbn/get-repo-files", "@kbn/peggy", @@ -42,6 +31,6 @@ "@kbn/react-mute-legacy-root-warning", "@kbn/babel-preset", "@kbn/dot-text", - "@kbn/apm-utils", + "@kbn/apm-utils" ] } diff --git a/tsconfig.base.json b/tsconfig.base.json index 83118519e170b..adc7a844c9895 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -2184,6 +2184,8 @@ "@kbn/telemetry-tools/*": ["src/platform/packages/private/kbn-telemetry-tools/*"], "@kbn/test": ["src/platform/packages/shared/kbn-test"], "@kbn/test/*": ["src/platform/packages/shared/kbn-test/*"], + "@kbn/test-es-server": ["src/platform/packages/shared/kbn-test-es-server"], + "@kbn/test-es-server/*": ["src/platform/packages/shared/kbn-test-es-server/*"], "@kbn/test-eui-helpers": ["src/platform/packages/private/kbn-test-eui-helpers"], "@kbn/test-eui-helpers/*": ["src/platform/packages/private/kbn-test-eui-helpers/*"], "@kbn/test-feature-usage-plugin": ["x-pack/platform/test/licensing_plugin/plugins/test_feature_usage"], diff --git a/x-pack/platform/packages/shared/kbn-evals/tsconfig.json b/x-pack/platform/packages/shared/kbn-evals/tsconfig.json index 1110bc8e4752e..6776ada0f6a30 100644 --- a/x-pack/platform/packages/shared/kbn-evals/tsconfig.json +++ b/x-pack/platform/packages/shared/kbn-evals/tsconfig.json @@ -2,11 +2,7 @@ "extends": "@kbn/tsconfig-base/tsconfig.json", "compilerOptions": { "outDir": "target/types", - "types": [ - "jest", - "node", - "@kbn/ambient-common-types" - ] + "types": ["jest", "node", "@kbn/ambient-common-types"] }, "include": [ "**/*.ts" diff --git a/yarn.lock b/yarn.lock index 1199f6b620256..f8b3af92bbdaa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8482,6 +8482,10 @@ version "0.0.0" uid "" +"@kbn/test-es-server@link:src/platform/packages/shared/kbn-test-es-server": + version "0.0.0" + uid "" + "@kbn/test-eui-helpers@link:src/platform/packages/private/kbn-test-eui-helpers": version "0.0.0" uid ""