From 24fda7ed565652203eba3040c74b8b9be2171a8d Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Wed, 3 Mar 2021 22:15:41 +0000 Subject: [PATCH 1/4] [Rename] kbn-test in packages directory to osd-test/functional_test_runner Signed-off-by: Mihir Soni --- .../__tests__/fixtures/failure_hooks/config.js | 0 .../fixtures/failure_hooks/tests/after_hook.js | 0 .../fixtures/failure_hooks/tests/before_hook.js | 0 .../__tests__/fixtures/failure_hooks/tests/it.js | 0 .../__tests__/fixtures/simple_project/config.js | 0 .../__tests__/fixtures/simple_project/tests.js | 2 +- .../__tests__/integration/basic.js | 4 ++-- .../__tests__/integration/failure_hooks.js | 4 ++-- .../src/functional_test_runner/cli.ts | 12 ++++++------ .../functional_test_runner/fake_mocha_types.d.ts | 0 .../functional_test_runner.ts | 2 +- .../src/functional_test_runner/index.ts | 0 .../lib/config/__tests__/fixtures/config.1.js | 0 .../lib/config/__tests__/fixtures/config.2.js | 0 .../lib/config/__tests__/fixtures/config.3.js | 0 .../lib/config/__tests__/fixtures/config.4.js | 0 .../config/__tests__/fixtures/config.invalid.js | 0 .../lib/config/__tests__/read_config_file.js | 4 ++-- .../functional_test_runner/lib/config/config.ts | 0 .../functional_test_runner/lib/config/index.ts | 0 .../lib/config/read_config_file.ts | 2 +- .../functional_test_runner/lib/config/schema.ts | 16 ++++++++-------- .../lib/docker_servers/README.md | 2 +- .../lib/docker_servers/container_logs.ts | 2 +- .../lib/docker_servers/container_running.ts | 2 +- .../define_docker_servers_config.ts | 0 .../lib/docker_servers/docker_servers_service.ts | 2 +- .../lib/docker_servers/index.ts | 0 .../lib/failure_metadata.test.ts | 0 .../lib/failure_metadata.ts | 2 +- .../src/functional_test_runner/lib/index.ts | 0 .../src/functional_test_runner/lib/lifecycle.ts | 0 .../lib/lifecycle_event.ts | 0 .../lib/lifecycle_phase.test.ts | 0 .../lib/lifecycle_phase.ts | 0 .../functional_test_runner/lib/load_tracer.ts | 0 .../lib/mocha/assignment_proxy.js | 0 .../lib/mocha/decorate_mocha_ui.js | 2 +- .../lib/mocha/filter_suites_by_tags.js | 0 .../lib/mocha/filter_suites_by_tags.test.js | 0 .../functional_test_runner/lib/mocha/index.ts | 0 .../lib/mocha/load_test_files.js | 2 +- .../lib/mocha/reporter/colors.js | 0 .../lib/mocha/reporter/index.js | 0 .../lib/mocha/reporter/ms.js | 0 .../lib/mocha/reporter/reporter.js | 2 +- .../lib/mocha/reporter/symbols.js | 0 .../lib/mocha/reporter/write_epilogue.js | 0 .../lib/mocha/run_tests.ts | 0 .../lib/mocha/setup_mocha.js | 2 +- .../lib/mocha/wrap_function.js | 0 .../lib/mocha/wrap_runnable_args.js | 0 .../lib/providers/async_instance.ts | 0 .../lib/providers/index.ts | 0 .../lib/providers/provider_collection.ts | 2 +- .../lib/providers/read_provider_spec.ts | 0 .../lib/providers/verbose_instance.ts | 2 +- .../lib/suite_tracker.test.ts | 4 ++-- .../functional_test_runner/lib/suite_tracker.ts | 2 +- 59 files changed, 37 insertions(+), 37 deletions(-) rename packages/{kbn-test => osd-test}/src/functional_test_runner/__tests__/fixtures/failure_hooks/config.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/after_hook.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/before_hook.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/it.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/__tests__/fixtures/simple_project/config.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/__tests__/fixtures/simple_project/tests.js (96%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/__tests__/integration/basic.js (95%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/__tests__/integration/failure_hooks.js (97%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/cli.ts (91%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/fake_mocha_types.d.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/functional_test_runner.ts (99%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/index.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/__tests__/fixtures/config.1.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/__tests__/fixtures/config.2.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/__tests__/fixtures/config.3.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/__tests__/fixtures/config.4.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/__tests__/fixtures/config.invalid.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/__tests__/read_config_file.js (96%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/config.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/index.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/read_config_file.ts (97%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/config/schema.ts (95%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/docker_servers/README.md (98%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/docker_servers/container_logs.ts (96%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/docker_servers/container_running.ts (97%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/docker_servers/define_docker_servers_config.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/docker_servers/docker_servers_service.ts (99%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/docker_servers/index.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/failure_metadata.test.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/failure_metadata.ts (98%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/index.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/lifecycle.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/lifecycle_event.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/lifecycle_phase.test.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/lifecycle_phase.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/load_tracer.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/assignment_proxy.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js (99%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/filter_suites_by_tags.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/filter_suites_by_tags.test.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/index.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/load_test_files.js (96%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/reporter/colors.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/reporter/index.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/reporter/ms.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/reporter/reporter.js (99%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/reporter/symbols.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/reporter/write_epilogue.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/run_tests.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/setup_mocha.js (98%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/wrap_function.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/mocha/wrap_runnable_args.js (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/providers/async_instance.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/providers/index.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/providers/provider_collection.ts (98%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/providers/read_provider_spec.ts (100%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/providers/verbose_instance.ts (98%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/suite_tracker.test.ts (98%) rename packages/{kbn-test => osd-test}/src/functional_test_runner/lib/suite_tracker.ts (99%) diff --git a/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/config.js b/packages/osd-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/config.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/config.js rename to packages/osd-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/config.js diff --git a/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/after_hook.js b/packages/osd-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/after_hook.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/after_hook.js rename to packages/osd-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/after_hook.js diff --git a/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/before_hook.js b/packages/osd-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/before_hook.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/before_hook.js rename to packages/osd-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/before_hook.js diff --git a/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/it.js b/packages/osd-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/it.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/it.js rename to packages/osd-test/src/functional_test_runner/__tests__/fixtures/failure_hooks/tests/it.js diff --git a/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/simple_project/config.js b/packages/osd-test/src/functional_test_runner/__tests__/fixtures/simple_project/config.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/__tests__/fixtures/simple_project/config.js rename to packages/osd-test/src/functional_test_runner/__tests__/fixtures/simple_project/config.js diff --git a/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/simple_project/tests.js b/packages/osd-test/src/functional_test_runner/__tests__/fixtures/simple_project/tests.js similarity index 96% rename from packages/kbn-test/src/functional_test_runner/__tests__/fixtures/simple_project/tests.js rename to packages/osd-test/src/functional_test_runner/__tests__/fixtures/simple_project/tests.js index 02e49fefc587..471b1adec85b 100644 --- a/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/simple_project/tests.js +++ b/packages/osd-test/src/functional_test_runner/__tests__/fixtures/simple_project/tests.js @@ -17,7 +17,7 @@ * under the License. */ -import expect from '@kbn/expect'; +import expect from '@osd/expect'; export default () => { describe('app one', () => { diff --git a/packages/kbn-test/src/functional_test_runner/__tests__/integration/basic.js b/packages/osd-test/src/functional_test_runner/__tests__/integration/basic.js similarity index 95% rename from packages/kbn-test/src/functional_test_runner/__tests__/integration/basic.js rename to packages/osd-test/src/functional_test_runner/__tests__/integration/basic.js index a010d9f0b038..c9c257bed85d 100644 --- a/packages/kbn-test/src/functional_test_runner/__tests__/integration/basic.js +++ b/packages/osd-test/src/functional_test_runner/__tests__/integration/basic.js @@ -20,8 +20,8 @@ import { spawnSync } from 'child_process'; import { resolve } from 'path'; -import expect from '@kbn/expect'; -import { REPO_ROOT } from '@kbn/utils'; +import expect from '@osd/expect'; +import { REPO_ROOT } from '@osd/utils'; const SCRIPT = resolve(REPO_ROOT, 'scripts/functional_test_runner.js'); const BASIC_CONFIG = require.resolve('../fixtures/simple_project/config.js'); diff --git a/packages/kbn-test/src/functional_test_runner/__tests__/integration/failure_hooks.js b/packages/osd-test/src/functional_test_runner/__tests__/integration/failure_hooks.js similarity index 97% rename from packages/kbn-test/src/functional_test_runner/__tests__/integration/failure_hooks.js rename to packages/osd-test/src/functional_test_runner/__tests__/integration/failure_hooks.js index fa4ef88fd3e7..ab82ff75c26f 100644 --- a/packages/kbn-test/src/functional_test_runner/__tests__/integration/failure_hooks.js +++ b/packages/osd-test/src/functional_test_runner/__tests__/integration/failure_hooks.js @@ -21,8 +21,8 @@ import { spawnSync } from 'child_process'; import { resolve } from 'path'; import stripAnsi from 'strip-ansi'; -import expect from '@kbn/expect'; -import { REPO_ROOT } from '@kbn/utils'; +import expect from '@osd/expect'; +import { REPO_ROOT } from '@osd/utils'; const SCRIPT = resolve(REPO_ROOT, 'scripts/functional_test_runner.js'); const FAILURE_HOOKS_CONFIG = require.resolve('../fixtures/failure_hooks/config.js'); diff --git a/packages/kbn-test/src/functional_test_runner/cli.ts b/packages/osd-test/src/functional_test_runner/cli.ts similarity index 91% rename from packages/kbn-test/src/functional_test_runner/cli.ts rename to packages/osd-test/src/functional_test_runner/cli.ts index 8a2075b2e7bd..5f17d8d8e497 100644 --- a/packages/kbn-test/src/functional_test_runner/cli.ts +++ b/packages/osd-test/src/functional_test_runner/cli.ts @@ -20,7 +20,7 @@ import { resolve } from 'path'; import { inspect } from 'util'; -import { run, createFlagError, Flags } from '@kbn/dev-utils'; +import { run, createFlagError, Flags } from '@osd/dev-utils'; import exitHook from 'exit-hook'; import { FunctionalTestRunner } from './functional_test_runner'; @@ -28,10 +28,10 @@ import { FunctionalTestRunner } from './functional_test_runner'; const makeAbsolutePath = (v: string) => resolve(process.cwd(), v); const toArray = (v: string | string[]) => ([] as string[]).concat(v || []); const parseInstallDir = (flags: Flags) => { - const flag = flags['kibana-install-dir']; + const flag = flags['opensearch-dashboards-install-dir']; if (typeof flag !== 'string' && flag !== undefined) { - throw createFlagError('--kibana-install-dir must be a string or not defined'); + throw createFlagError('--opensearch-dashboards-install-dir must be a string or not defined'); } return flag ? makeAbsolutePath(flag) : undefined; @@ -49,7 +49,7 @@ export function runFtrCli() { grep: flags.grep || undefined, invert: flags.invert, }, - kbnTestServer: { + osdTestServer: { installDir: parseInstallDir(flags), }, suiteFiles: { @@ -116,7 +116,7 @@ export function runFtrCli() { 'exclude', 'include-tag', 'exclude-tag', - 'kibana-install-dir', + 'opensearch-dashboards-install-dir', ], boolean: ['bail', 'invert', 'test-stats', 'updateBaselines'], default: { @@ -133,7 +133,7 @@ export function runFtrCli() { --exclude-tag=tag a tag to be excluded, pass multiple times for multiple tags --test-stats print the number of tests (included and excluded) to STDERR --updateBaselines replace baseline screenshots with whatever is generated from the test - --kibana-install-dir directory where the Kibana install being tested resides + --opensearch-dashboards-install-dir directory where the OpenSearch Dashbaords install being tested resides `, }, } diff --git a/packages/kbn-test/src/functional_test_runner/fake_mocha_types.d.ts b/packages/osd-test/src/functional_test_runner/fake_mocha_types.d.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/fake_mocha_types.d.ts rename to packages/osd-test/src/functional_test_runner/fake_mocha_types.d.ts diff --git a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts b/packages/osd-test/src/functional_test_runner/functional_test_runner.ts similarity index 99% rename from packages/kbn-test/src/functional_test_runner/functional_test_runner.ts rename to packages/osd-test/src/functional_test_runner/functional_test_runner.ts index 24f5cdceac95..92edaf02664f 100644 --- a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts +++ b/packages/osd-test/src/functional_test_runner/functional_test_runner.ts @@ -17,7 +17,7 @@ * under the License. */ -import { ToolingLog } from '@kbn/dev-utils'; +import { ToolingLog } from '@osd/dev-utils'; import { Suite, Test } from './fake_mocha_types'; import { diff --git a/packages/kbn-test/src/functional_test_runner/index.ts b/packages/osd-test/src/functional_test_runner/index.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/index.ts rename to packages/osd-test/src/functional_test_runner/index.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.1.js b/packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.1.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.1.js rename to packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.1.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.2.js b/packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.2.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.2.js rename to packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.2.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.3.js b/packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.3.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.3.js rename to packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.3.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.4.js b/packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.4.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.4.js rename to packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.4.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.invalid.js b/packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.invalid.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.invalid.js rename to packages/osd-test/src/functional_test_runner/lib/config/__tests__/fixtures/config.invalid.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/read_config_file.js b/packages/osd-test/src/functional_test_runner/lib/config/__tests__/read_config_file.js similarity index 96% rename from packages/kbn-test/src/functional_test_runner/lib/config/__tests__/read_config_file.js rename to packages/osd-test/src/functional_test_runner/lib/config/__tests__/read_config_file.js index 8d02e7262409..4f11b7a52e27 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/read_config_file.js +++ b/packages/osd-test/src/functional_test_runner/lib/config/__tests__/read_config_file.js @@ -17,9 +17,9 @@ * under the License. */ -import expect from '@kbn/expect'; +import expect from '@osd/expect'; -import { ToolingLog } from '@kbn/dev-utils'; +import { ToolingLog } from '@osd/dev-utils'; import { readConfigFile } from '../read_config_file'; import { Config } from '../config'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/config.ts b/packages/osd-test/src/functional_test_runner/lib/config/config.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/config/config.ts rename to packages/osd-test/src/functional_test_runner/lib/config/config.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/index.ts b/packages/osd-test/src/functional_test_runner/lib/config/index.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/config/index.ts rename to packages/osd-test/src/functional_test_runner/lib/config/index.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/read_config_file.ts b/packages/osd-test/src/functional_test_runner/lib/config/read_config_file.ts similarity index 97% rename from packages/kbn-test/src/functional_test_runner/lib/config/read_config_file.ts rename to packages/osd-test/src/functional_test_runner/lib/config/read_config_file.ts index 2e40aeec4f43..6388df13838b 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/config/read_config_file.ts +++ b/packages/osd-test/src/functional_test_runner/lib/config/read_config_file.ts @@ -17,7 +17,7 @@ * under the License. */ -import { ToolingLog } from '@kbn/dev-utils'; +import { ToolingLog } from '@osd/dev-utils'; import { defaultsDeep } from 'lodash'; import { Config } from './config'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts b/packages/osd-test/src/functional_test_runner/lib/config/schema.ts similarity index 95% rename from packages/kbn-test/src/functional_test_runner/lib/config/schema.ts rename to packages/osd-test/src/functional_test_runner/lib/config/schema.ts index 6ed114d62e24..9c093ef6b475 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts +++ b/packages/osd-test/src/functional_test_runner/lib/config/schema.ts @@ -105,8 +105,8 @@ export const schema = Joi.object() find: Joi.number().default(10000), try: Joi.number().default(120000), waitFor: Joi.number().default(20000), - esRequestTimeout: Joi.number().default(30000), - kibanaStabilize: Joi.number().default(15000), + opensearchRequestTimeout: Joi.number().default(30000), + opensearchDashboardsStabilize: Joi.number().default(15000), navigateStatusPageCheck: Joi.number().default(250), // Many of our tests use the `exists` functions to determine where the user is. For @@ -173,8 +173,8 @@ export const schema = Joi.object() servers: Joi.object() .keys({ - kibana: urlPartsSchema(), - elasticsearch: urlPartsSchema(), + opensearchDashboards: urlPartsSchema(), + opensearch: urlPartsSchema(), }) .default(), @@ -189,7 +189,7 @@ export const schema = Joi.object() }) .default(), - kbnTestServer: Joi.object() + osdTestServer: Joi.object() .keys({ buildArgs: Joi.array(), sourceArgs: Joi.array(), @@ -217,14 +217,14 @@ export const schema = Joi.object() // definition of apps that work with `common.navigateToApp()` apps: Joi.object().pattern(ID_PATTERN, appUrlPartsSchema()).default(), - // settings for the esArchiver module - esArchiver: Joi.object() + // settings for the opensearchArchiver module + opensearchArchiver: Joi.object() .keys({ directory: Joi.string().default(defaultRelativeToConfigPath('fixtures/es_archiver')), }) .default(), - // settings for the kibanaServer.uiSettings module + // settings for the opensearchDashboardsServer.uiSettings module uiSettings: Joi.object() .keys({ defaults: Joi.object().unknown(true), diff --git a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/README.md b/packages/osd-test/src/functional_test_runner/lib/docker_servers/README.md similarity index 98% rename from packages/kbn-test/src/functional_test_runner/lib/docker_servers/README.md rename to packages/osd-test/src/functional_test_runner/lib/docker_servers/README.md index d75faf4c854a..1b132b378a2a 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/README.md +++ b/packages/osd-test/src/functional_test_runner/lib/docker_servers/README.md @@ -6,7 +6,7 @@ To configure docker servers in your FTR config add the `dockerServers` key to yo ```ts // import this helper to get TypeScript support for this section of the config -import { defineDockerServersConfig } from '@kbn/test'; +import { defineDockerServersConfig } from '@osd/test'; export default function () { return { diff --git a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/container_logs.ts b/packages/osd-test/src/functional_test_runner/lib/docker_servers/container_logs.ts similarity index 96% rename from packages/kbn-test/src/functional_test_runner/lib/docker_servers/container_logs.ts rename to packages/osd-test/src/functional_test_runner/lib/docker_servers/container_logs.ts index f8e8137ce40a..58fe6be8e5a4 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/container_logs.ts +++ b/packages/osd-test/src/functional_test_runner/lib/docker_servers/container_logs.ts @@ -20,7 +20,7 @@ import execa from 'execa'; import * as Rx from 'rxjs'; import { tap } from 'rxjs/operators'; -import { ToolingLog, observeLines } from '@kbn/dev-utils'; +import { ToolingLog, observeLines } from '@osd/dev-utils'; /** * Observe the logs for a container, reflecting the log lines diff --git a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/container_running.ts b/packages/osd-test/src/functional_test_runner/lib/docker_servers/container_running.ts similarity index 97% rename from packages/kbn-test/src/functional_test_runner/lib/docker_servers/container_running.ts rename to packages/osd-test/src/functional_test_runner/lib/docker_servers/container_running.ts index 3e3247a6ae3b..27169cf4cb2d 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/container_running.ts +++ b/packages/osd-test/src/functional_test_runner/lib/docker_servers/container_running.ts @@ -19,7 +19,7 @@ import execa from 'execa'; import * as Rx from 'rxjs'; -import { ToolingLog } from '@kbn/dev-utils'; +import { ToolingLog } from '@osd/dev-utils'; /** * Create an observable that errors if a docker diff --git a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/define_docker_servers_config.ts b/packages/osd-test/src/functional_test_runner/lib/docker_servers/define_docker_servers_config.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/docker_servers/define_docker_servers_config.ts rename to packages/osd-test/src/functional_test_runner/lib/docker_servers/define_docker_servers_config.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/docker_servers_service.ts b/packages/osd-test/src/functional_test_runner/lib/docker_servers/docker_servers_service.ts similarity index 99% rename from packages/kbn-test/src/functional_test_runner/lib/docker_servers/docker_servers_service.ts rename to packages/osd-test/src/functional_test_runner/lib/docker_servers/docker_servers_service.ts index e5bad88e5e7b..fb6f5f4a68fd 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/docker_servers_service.ts +++ b/packages/osd-test/src/functional_test_runner/lib/docker_servers/docker_servers_service.ts @@ -21,7 +21,7 @@ import Url from 'url'; import execa from 'execa'; import * as Rx from 'rxjs'; import { filter, take, map } from 'rxjs/operators'; -import { ToolingLog } from '@kbn/dev-utils'; +import { ToolingLog } from '@osd/dev-utils'; import { Lifecycle } from '../lifecycle'; import { observeContainerRunning } from './container_running'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/docker_servers/index.ts b/packages/osd-test/src/functional_test_runner/lib/docker_servers/index.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/docker_servers/index.ts rename to packages/osd-test/src/functional_test_runner/lib/docker_servers/index.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/failure_metadata.test.ts b/packages/osd-test/src/functional_test_runner/lib/failure_metadata.test.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/failure_metadata.test.ts rename to packages/osd-test/src/functional_test_runner/lib/failure_metadata.test.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/failure_metadata.ts b/packages/osd-test/src/functional_test_runner/lib/failure_metadata.ts similarity index 98% rename from packages/kbn-test/src/functional_test_runner/lib/failure_metadata.ts rename to packages/osd-test/src/functional_test_runner/lib/failure_metadata.ts index e5c60f1d208b..d2378d40e93d 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/failure_metadata.ts +++ b/packages/osd-test/src/functional_test_runner/lib/failure_metadata.ts @@ -19,7 +19,7 @@ import Path from 'path'; -import { REPO_ROOT } from '@kbn/utils'; +import { REPO_ROOT } from '@osd/utils'; import { Lifecycle } from './lifecycle'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/index.ts b/packages/osd-test/src/functional_test_runner/lib/index.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/index.ts rename to packages/osd-test/src/functional_test_runner/lib/index.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/lifecycle.ts b/packages/osd-test/src/functional_test_runner/lib/lifecycle.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/lifecycle.ts rename to packages/osd-test/src/functional_test_runner/lib/lifecycle.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/lifecycle_event.ts b/packages/osd-test/src/functional_test_runner/lib/lifecycle_event.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/lifecycle_event.ts rename to packages/osd-test/src/functional_test_runner/lib/lifecycle_event.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/lifecycle_phase.test.ts b/packages/osd-test/src/functional_test_runner/lib/lifecycle_phase.test.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/lifecycle_phase.test.ts rename to packages/osd-test/src/functional_test_runner/lib/lifecycle_phase.test.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/lifecycle_phase.ts b/packages/osd-test/src/functional_test_runner/lib/lifecycle_phase.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/lifecycle_phase.ts rename to packages/osd-test/src/functional_test_runner/lib/lifecycle_phase.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/load_tracer.ts b/packages/osd-test/src/functional_test_runner/lib/load_tracer.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/load_tracer.ts rename to packages/osd-test/src/functional_test_runner/lib/load_tracer.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/assignment_proxy.js b/packages/osd-test/src/functional_test_runner/lib/mocha/assignment_proxy.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/assignment_proxy.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/assignment_proxy.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js b/packages/osd-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js similarity index 99% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js index 92137a8c4f84..ea7ade67369c 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js +++ b/packages/osd-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js @@ -17,7 +17,7 @@ * under the License. */ import { relative } from 'path'; -import { REPO_ROOT } from '@kbn/utils'; +import { REPO_ROOT } from '@osd/utils'; import { createAssignmentProxy } from './assignment_proxy'; import { wrapFunction } from './wrap_function'; import { wrapRunnableArgs } from './wrap_runnable_args'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/filter_suites_by_tags.js b/packages/osd-test/src/functional_test_runner/lib/mocha/filter_suites_by_tags.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/filter_suites_by_tags.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/filter_suites_by_tags.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/filter_suites_by_tags.test.js b/packages/osd-test/src/functional_test_runner/lib/mocha/filter_suites_by_tags.test.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/filter_suites_by_tags.test.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/filter_suites_by_tags.test.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/index.ts b/packages/osd-test/src/functional_test_runner/lib/mocha/index.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/index.ts rename to packages/osd-test/src/functional_test_runner/lib/mocha/index.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/load_test_files.js b/packages/osd-test/src/functional_test_runner/lib/mocha/load_test_files.js similarity index 96% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/load_test_files.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/load_test_files.js index 5c23be636186..f629613ab38e 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/load_test_files.js +++ b/packages/osd-test/src/functional_test_runner/lib/mocha/load_test_files.js @@ -41,7 +41,7 @@ export const loadTestFiles = ({ mocha, log, lifecycle, providers, paths, updateB log.verbose('Loading test file %s', path); const testModule = require(path); // eslint-disable-line import/no-dynamic-require - const testProvider = testModule.__esModule ? testModule.default : testModule; + const testProvider = testModule.__opensearchModule ? testModule.default : testModule; runTestProvider(testProvider, path); // eslint-disable-line }); diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/colors.js b/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/colors.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/colors.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/reporter/colors.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/index.js b/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/index.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/index.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/reporter/index.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/ms.js b/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/ms.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/ms.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/reporter/ms.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/reporter.js b/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/reporter.js similarity index 99% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/reporter.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/reporter/reporter.js index 9f89efddf49b..6d4c10b984e0 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/reporter.js +++ b/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/reporter.js @@ -20,7 +20,7 @@ import { format } from 'util'; import Mocha from 'mocha'; -import { ToolingLogTextWriter } from '@kbn/dev-utils'; +import { ToolingLogTextWriter } from '@osd/dev-utils'; import moment from 'moment'; import { setupJUnitReportGeneration } from '../../../../../../../src/dev'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/symbols.js b/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/symbols.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/symbols.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/reporter/symbols.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/write_epilogue.js b/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/write_epilogue.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/write_epilogue.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/reporter/write_epilogue.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/run_tests.ts b/packages/osd-test/src/functional_test_runner/lib/mocha/run_tests.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/run_tests.ts rename to packages/osd-test/src/functional_test_runner/lib/mocha/run_tests.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/setup_mocha.js b/packages/osd-test/src/functional_test_runner/lib/mocha/setup_mocha.js similarity index 98% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/setup_mocha.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/setup_mocha.js index 39eb69a15191..66195ac2e223 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/setup_mocha.js +++ b/packages/osd-test/src/functional_test_runner/lib/mocha/setup_mocha.js @@ -19,7 +19,7 @@ import Mocha from 'mocha'; import { relative } from 'path'; -import { REPO_ROOT } from '@kbn/utils'; +import { REPO_ROOT } from '@osd/utils'; import { loadTestFiles } from './load_test_files'; import { filterSuitesByTags } from './filter_suites_by_tags'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/wrap_function.js b/packages/osd-test/src/functional_test_runner/lib/mocha/wrap_function.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/wrap_function.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/wrap_function.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/wrap_runnable_args.js b/packages/osd-test/src/functional_test_runner/lib/mocha/wrap_runnable_args.js similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/mocha/wrap_runnable_args.js rename to packages/osd-test/src/functional_test_runner/lib/mocha/wrap_runnable_args.js diff --git a/packages/kbn-test/src/functional_test_runner/lib/providers/async_instance.ts b/packages/osd-test/src/functional_test_runner/lib/providers/async_instance.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/providers/async_instance.ts rename to packages/osd-test/src/functional_test_runner/lib/providers/async_instance.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/providers/index.ts b/packages/osd-test/src/functional_test_runner/lib/providers/index.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/providers/index.ts rename to packages/osd-test/src/functional_test_runner/lib/providers/index.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/providers/provider_collection.ts b/packages/osd-test/src/functional_test_runner/lib/providers/provider_collection.ts similarity index 98% rename from packages/kbn-test/src/functional_test_runner/lib/providers/provider_collection.ts rename to packages/osd-test/src/functional_test_runner/lib/providers/provider_collection.ts index c58747e07dcf..70b34b296a11 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/providers/provider_collection.ts +++ b/packages/osd-test/src/functional_test_runner/lib/providers/provider_collection.ts @@ -17,7 +17,7 @@ * under the License. */ -import { ToolingLog } from '@kbn/dev-utils'; +import { ToolingLog } from '@osd/dev-utils'; import { loadTracer } from '../load_tracer'; import { createAsyncInstance, isAsyncInstance } from './async_instance'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/providers/read_provider_spec.ts b/packages/osd-test/src/functional_test_runner/lib/providers/read_provider_spec.ts similarity index 100% rename from packages/kbn-test/src/functional_test_runner/lib/providers/read_provider_spec.ts rename to packages/osd-test/src/functional_test_runner/lib/providers/read_provider_spec.ts diff --git a/packages/kbn-test/src/functional_test_runner/lib/providers/verbose_instance.ts b/packages/osd-test/src/functional_test_runner/lib/providers/verbose_instance.ts similarity index 98% rename from packages/kbn-test/src/functional_test_runner/lib/providers/verbose_instance.ts rename to packages/osd-test/src/functional_test_runner/lib/providers/verbose_instance.ts index 1967e98306d4..8207c75e941b 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/providers/verbose_instance.ts +++ b/packages/osd-test/src/functional_test_runner/lib/providers/verbose_instance.ts @@ -19,7 +19,7 @@ import { inspect } from 'util'; -import { ToolingLog } from '@kbn/dev-utils'; +import { ToolingLog } from '@osd/dev-utils'; function printArgs(args: any[]): string { return args diff --git a/packages/kbn-test/src/functional_test_runner/lib/suite_tracker.test.ts b/packages/osd-test/src/functional_test_runner/lib/suite_tracker.test.ts similarity index 98% rename from packages/kbn-test/src/functional_test_runner/lib/suite_tracker.test.ts rename to packages/osd-test/src/functional_test_runner/lib/suite_tracker.test.ts index 5350b2709843..3554df658a1e 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/suite_tracker.test.ts +++ b/packages/osd-test/src/functional_test_runner/lib/suite_tracker.test.ts @@ -21,11 +21,11 @@ import fs from 'fs'; import { join, resolve } from 'path'; jest.mock('fs'); -jest.mock('@kbn/utils', () => { +jest.mock('@osd/utils', () => { return { REPO_ROOT: '/dev/null/root' }; }); -import { REPO_ROOT } from '@kbn/dev-utils'; +import { REPO_ROOT } from '@osd/dev-utils'; import { Lifecycle } from './lifecycle'; import { SuiteTracker } from './suite_tracker'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/suite_tracker.ts b/packages/osd-test/src/functional_test_runner/lib/suite_tracker.ts similarity index 99% rename from packages/kbn-test/src/functional_test_runner/lib/suite_tracker.ts rename to packages/osd-test/src/functional_test_runner/lib/suite_tracker.ts index 6cbd74467106..e6f9dc166f43 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/suite_tracker.ts +++ b/packages/osd-test/src/functional_test_runner/lib/suite_tracker.ts @@ -19,7 +19,7 @@ import fs from 'fs'; import { dirname, relative, resolve } from 'path'; -import { REPO_ROOT } from '@kbn/utils'; +import { REPO_ROOT } from '@osd/utils'; import { Lifecycle } from './lifecycle'; From 60e7a68b06ee317676d4166f74cfb441fc25e654 Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Wed, 3 Mar 2021 22:16:29 +0000 Subject: [PATCH 2/4] [Rename] kbn-test in packages directory to osd-test/functional_tests Signed-off-by: Mihir Soni --- .../src/functional_tests/cli/index.js | 23 -- .../run_tests/__snapshots__/args.test.js.snap | 281 ------------------ .../run_tests/__snapshots__/cli.test.js.snap | 71 ----- .../functional_tests/cli/run_tests/args.js | 180 ----------- .../cli/run_tests/args.test.js | 137 --------- .../src/functional_tests/cli/run_tests/cli.js | 37 --- .../cli/run_tests/cli.test.js | 211 ------------- .../__snapshots__/args.test.js.snap | 120 -------- .../__snapshots__/cli.test.js.snap | 43 --- .../cli/start_servers/args.js | 128 -------- .../cli/start_servers/args.test.js | 121 -------- .../functional_tests/cli/start_servers/cli.js | 34 --- .../cli/start_servers/cli.test.js | 194 ------------ .../lib/__snapshots__/run_cli.test.js.snap | 26 -- .../kbn-test/src/functional_tests/lib/auth.js | 162 ---------- .../lib/babel_register_for_test_plugins.js | 39 --- .../src/functional_tests/lib/index.js | 24 -- .../src/functional_tests/lib/paths.js | 34 --- .../src/functional_tests/lib/run_cli.js | 66 ---- .../src/functional_tests/lib/run_cli.test.js | 133 --------- .../functional_tests/lib/run_elasticsearch.js | 69 ----- .../src/functional_tests/lib/run_ftr.js | 94 ------ .../functional_tests/lib/run_kibana_server.js | 143 --------- .../kbn-test/src/functional_tests/tasks.js | 166 ----------- .../src/functional_tests/test_helpers.js | 30 -- 25 files changed, 2566 deletions(-) delete mode 100644 packages/kbn-test/src/functional_tests/cli/index.js delete mode 100644 packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/args.test.js.snap delete mode 100644 packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/cli.test.js.snap delete mode 100644 packages/kbn-test/src/functional_tests/cli/run_tests/args.js delete mode 100644 packages/kbn-test/src/functional_tests/cli/run_tests/args.test.js delete mode 100644 packages/kbn-test/src/functional_tests/cli/run_tests/cli.js delete mode 100644 packages/kbn-test/src/functional_tests/cli/run_tests/cli.test.js delete mode 100644 packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap delete mode 100644 packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/cli.test.js.snap delete mode 100644 packages/kbn-test/src/functional_tests/cli/start_servers/args.js delete mode 100644 packages/kbn-test/src/functional_tests/cli/start_servers/args.test.js delete mode 100644 packages/kbn-test/src/functional_tests/cli/start_servers/cli.js delete mode 100644 packages/kbn-test/src/functional_tests/cli/start_servers/cli.test.js delete mode 100644 packages/kbn-test/src/functional_tests/lib/__snapshots__/run_cli.test.js.snap delete mode 100644 packages/kbn-test/src/functional_tests/lib/auth.js delete mode 100644 packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js delete mode 100644 packages/kbn-test/src/functional_tests/lib/index.js delete mode 100644 packages/kbn-test/src/functional_tests/lib/paths.js delete mode 100644 packages/kbn-test/src/functional_tests/lib/run_cli.js delete mode 100644 packages/kbn-test/src/functional_tests/lib/run_cli.test.js delete mode 100644 packages/kbn-test/src/functional_tests/lib/run_elasticsearch.js delete mode 100644 packages/kbn-test/src/functional_tests/lib/run_ftr.js delete mode 100644 packages/kbn-test/src/functional_tests/lib/run_kibana_server.js delete mode 100644 packages/kbn-test/src/functional_tests/tasks.js delete mode 100644 packages/kbn-test/src/functional_tests/test_helpers.js diff --git a/packages/kbn-test/src/functional_tests/cli/index.js b/packages/kbn-test/src/functional_tests/cli/index.js deleted file mode 100644 index 4671a4f652af..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { runTestsCli } from './run_tests/cli'; -export { processOptions as processRunTestsCliOptions } from './run_tests/args'; -export { startServersCli } from './start_servers/cli'; -export { processOptions as processStartServersCliOptions } from './start_servers/args'; diff --git a/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/args.test.js.snap b/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/args.test.js.snap deleted file mode 100644 index 434c374d5d23..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/args.test.js.snap +++ /dev/null @@ -1,281 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`display help for run tests CLI displays as expected 1`] = ` -"Run Functional Tests - -Usage: - node scripts/functional_tests --help - node scripts/functional_tests [--config [--config ...]] - node scripts/functional_tests [options] [-- --] - -Options: - --help Display this menu and exit. - --config Pass in a config. Can pass in multiple configs. - --esFrom Build Elasticsearch from source or run from snapshot. Default: $TEST_ES_FROM or snapshot - --kibana-install-dir Run Kibana from existing install directory instead of from source. - --bail Stop the test run at the first failure. - --grep Pattern to select which tests to run. - --updateBaselines Replace baseline screenshots with whatever is generated from the test. - --include Files that must included to be run, can be included multiple times. - --exclude Files that must NOT be included to be run, can be included multiple times. - --include-tag Tags that suites must include to be run, can be included multiple times. - --exclude-tag Tags that suites must NOT include to be run, can be included multiple times. - --assert-none-excluded Exit with 1/0 based on if any test is excluded with the current set of tags. - --verbose Log everything. - --debug Run in debug mode. - --quiet Only log errors. - --silent Log nothing." -`; - -exports[`process options for run tests CLI accepts boolean value for updateBaselines 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, - "updateBaselines": true, -} -`; - -exports[`process options for run tests CLI accepts debug option 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "debug": true, - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; - -exports[`process options for run tests CLI accepts empty config value if default passed 1`] = ` -Object { - "assertNoneExcluded": false, - "config": "", - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; - -exports[`process options for run tests CLI accepts extra server options 1`] = ` -Object { - "_": Object { - "server.foo": "bar", - }, - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": Object { - "server.foo": "bar", - }, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; - -exports[`process options for run tests CLI accepts quiet option 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "quiet": true, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; - -exports[`process options for run tests CLI accepts silent option 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "silent": true, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; - -exports[`process options for run tests CLI accepts source value for $TEST_ES_FROM 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "source", - "extraKbnOpts": undefined, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; - -exports[`process options for run tests CLI accepts source value for esFrom 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "source", - "extraKbnOpts": undefined, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; - -exports[`process options for run tests CLI accepts string value for kibana-install-dir 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "installDir": "foo", - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; - -exports[`process options for run tests CLI accepts value for grep 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "grep": "management", - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; - -exports[`process options for run tests CLI accepts verbose option 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, - "verbose": true, -} -`; - -exports[`process options for run tests CLI prioritizes source flag over $TEST_ES_FROM 1`] = ` -Object { - "assertNoneExcluded": false, - "configs": Array [ - /foo, - ], - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "suiteFiles": Object { - "exclude": Array [], - "include": Array [], - }, - "suiteTags": Object { - "exclude": Array [], - "include": Array [], - }, -} -`; diff --git a/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/cli.test.js.snap b/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/cli.test.js.snap deleted file mode 100644 index 6ede71a6c394..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/cli.test.js.snap +++ /dev/null @@ -1,71 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`run tests CLI options accepts help option even if invalid options passed 1`] = ` -"Run Functional Tests - -Usage: - node scripts/functional_tests --help - node scripts/functional_tests [--config [--config ...]] - node scripts/functional_tests [options] [-- --] - -Options: - --help Display this menu and exit. - --config Pass in a config. Can pass in multiple configs. - --esFrom Build Elasticsearch from source or run from snapshot. Default: $TEST_ES_FROM or snapshot - --kibana-install-dir Run Kibana from existing install directory instead of from source. - --bail Stop the test run at the first failure. - --grep Pattern to select which tests to run. - --updateBaselines Replace baseline screenshots with whatever is generated from the test. - --include Files that must included to be run, can be included multiple times. - --exclude Files that must NOT be included to be run, can be included multiple times. - --include-tag Tags that suites must include to be run, can be included multiple times. - --exclude-tag Tags that suites must NOT include to be run, can be included multiple times. - --assert-none-excluded Exit with 1/0 based on if any test is excluded with the current set of tags. - --verbose Log everything. - --debug Run in debug mode. - --quiet Only log errors. - --silent Log nothing. -" -`; - -exports[`run tests CLI options rejects boolean config value 1`] = ` -" -functional_tests: invalid argument [true] to option [config] - ...stack trace... -" -`; - -exports[`run tests CLI options rejects boolean value for kibana-install-dir 1`] = ` -" -functional_tests: invalid argument [true] to option [kibana-install-dir] - ...stack trace... -" -`; - -exports[`run tests CLI options rejects empty config value if no default passed 1`] = ` -" -functional_tests: config is required - ...stack trace... -" -`; - -exports[`run tests CLI options rejects invalid options even if valid options exist 1`] = ` -" -functional_tests: invalid option [aintnothang] - ...stack trace... -" -`; - -exports[`run tests CLI options rejects non-boolean value for bail 1`] = ` -" -functional_tests: invalid argument [peanut] to option [bail] - ...stack trace... -" -`; - -exports[`run tests CLI options rejects non-enum value for esFrom 1`] = ` -" -functional_tests: invalid argument [butter] to option [esFrom] - ...stack trace... -" -`; diff --git a/packages/kbn-test/src/functional_tests/cli/run_tests/args.js b/packages/kbn-test/src/functional_tests/cli/run_tests/args.js deleted file mode 100644 index 94d510915d8e..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/run_tests/args.js +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { resolve } from 'path'; - -import dedent from 'dedent'; -import { ToolingLog, pickLevelFromFlags } from '@kbn/dev-utils'; - -const options = { - help: { desc: 'Display this menu and exit.' }, - config: { - arg: '', - desc: 'Pass in a config. Can pass in multiple configs.', - }, - esFrom: { - arg: '', - choices: ['snapshot', 'source'], - desc: 'Build Elasticsearch from source or run from snapshot.', - defaultHelp: 'Default: $TEST_ES_FROM or snapshot', - }, - 'kibana-install-dir': { - arg: '', - desc: 'Run Kibana from existing install directory instead of from source.', - }, - bail: { desc: 'Stop the test run at the first failure.' }, - grep: { - arg: '', - desc: 'Pattern to select which tests to run.', - }, - updateBaselines: { - desc: 'Replace baseline screenshots with whatever is generated from the test.', - }, - include: { - arg: '', - desc: 'Files that must included to be run, can be included multiple times.', - }, - exclude: { - arg: '', - desc: 'Files that must NOT be included to be run, can be included multiple times.', - }, - 'include-tag': { - arg: '', - desc: 'Tags that suites must include to be run, can be included multiple times.', - }, - 'exclude-tag': { - arg: '', - desc: 'Tags that suites must NOT include to be run, can be included multiple times.', - }, - 'assert-none-excluded': { - desc: 'Exit with 1/0 based on if any test is excluded with the current set of tags.', - }, - verbose: { desc: 'Log everything.' }, - debug: { desc: 'Run in debug mode.' }, - quiet: { desc: 'Only log errors.' }, - silent: { desc: 'Log nothing.' }, -}; - -export function displayHelp() { - const helpOptions = Object.keys(options) - .filter((name) => name !== '_') - .map((name) => { - const option = options[name]; - return { - ...option, - usage: `${name} ${option.arg || ''}`, - default: option.defaultHelp || '', - }; - }) - .map((option) => { - return `--${option.usage.padEnd(28)} ${option.desc} ${option.default}`; - }) - .join(`\n `); - - return dedent(` - Run Functional Tests - - Usage: - node scripts/functional_tests --help - node scripts/functional_tests [--config [--config ...]] - node scripts/functional_tests [options] [-- --] - - Options: - ${helpOptions} - `); -} - -export function processOptions(userOptions, defaultConfigPaths) { - validateOptions(userOptions); - - let configs; - if (userOptions.config) { - configs = [].concat(userOptions.config); - } else { - if (!defaultConfigPaths || defaultConfigPaths.length === 0) { - throw new Error(`functional_tests: config is required`); - } else { - configs = defaultConfigPaths; - } - } - - if (!userOptions.esFrom) { - userOptions.esFrom = process.env.TEST_ES_FROM || 'snapshot'; - } - - if (userOptions['kibana-install-dir']) { - userOptions.installDir = userOptions['kibana-install-dir']; - delete userOptions['kibana-install-dir']; - } - - userOptions.suiteFiles = { - include: [].concat(userOptions.include || []), - exclude: [].concat(userOptions.exclude || []), - }; - delete userOptions.include; - delete userOptions.exclude; - - userOptions.suiteTags = { - include: [].concat(userOptions['include-tag'] || []), - exclude: [].concat(userOptions['exclude-tag'] || []), - }; - delete userOptions['include-tag']; - delete userOptions['exclude-tag']; - - userOptions.assertNoneExcluded = !!userOptions['assert-none-excluded']; - delete userOptions['assert-none-excluded']; - - function createLogger() { - return new ToolingLog({ - level: pickLevelFromFlags(userOptions), - writeTo: process.stdout, - }); - } - - return { - ...userOptions, - configs: configs.map((c) => resolve(c)), - createLogger, - extraKbnOpts: userOptions._, - }; -} - -function validateOptions(userOptions) { - Object.entries(userOptions).forEach(([key, val]) => { - if (key === '_' || key === 'suiteTags') { - return; - } - - // Validate flags passed - if (options[key] === undefined) { - throw new Error(`functional_tests: invalid option [${key}]`); - } - - if ( - // Validate boolean flags - (!options[key].arg && typeof val !== 'boolean') || - // Validate string/array flags - (options[key].arg && typeof val !== 'string' && !Array.isArray(val)) || - // Validate enum flags - (options[key].choices && !options[key].choices.includes(val)) - ) { - throw new Error(`functional_tests: invalid argument [${val}] to option [${key}]`); - } - }); -} diff --git a/packages/kbn-test/src/functional_tests/cli/run_tests/args.test.js b/packages/kbn-test/src/functional_tests/cli/run_tests/args.test.js deleted file mode 100644 index 35e4cef5b3a6..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/run_tests/args.test.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { displayHelp, processOptions } from './args'; -import { createAbsolutePathSerializer } from '@kbn/dev-utils'; - -expect.addSnapshotSerializer(createAbsolutePathSerializer(process.cwd())); - -const INITIAL_TEST_ES_FROM = process.env.TEST_ES_FROM; -beforeEach(() => { - process.env.TEST_ES_FROM = 'snapshot'; -}); -afterEach(() => { - process.env.TEST_ES_FROM = INITIAL_TEST_ES_FROM; -}); - -describe('display help for run tests CLI', () => { - it('displays as expected', () => { - expect(displayHelp()).toMatchSnapshot(); - }); -}); - -describe('process options for run tests CLI', () => { - it('rejects boolean config value', () => { - expect(() => { - processOptions({ config: true }); - }).toThrow('functional_tests: invalid argument [true] to option [config]'); - }); - - it('rejects empty config value if no default passed', () => { - expect(() => { - processOptions({}); - }).toThrow('functional_tests: config is required'); - }); - - it('accepts empty config value if default passed', () => { - const options = processOptions({ config: '' }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('rejects non-boolean value for bail', () => { - expect(() => { - processOptions({ bail: 'peanut' }, ['foo']); - }).toThrow('functional_tests: invalid argument [peanut] to option [bail]'); - }); - - it('accepts string value for kibana-install-dir', () => { - const options = processOptions({ 'kibana-install-dir': 'foo' }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('rejects boolean value for kibana-install-dir', () => { - expect(() => { - processOptions({ 'kibana-install-dir': true }, ['foo']); - }).toThrow('functional_tests: invalid argument [true] to option [kibana-install-dir]'); - }); - - it('accepts boolean value for updateBaselines', () => { - const options = processOptions({ updateBaselines: true }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('accepts source value for esFrom', () => { - const options = processOptions({ esFrom: 'source' }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('accepts source value for $TEST_ES_FROM', () => { - process.env.TEST_ES_FROM = 'source'; - const options = processOptions({}, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('prioritizes source flag over $TEST_ES_FROM', () => { - process.env.TEST_ES_FROM = 'source'; - const options = processOptions({ esFrom: 'snapshot' }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('rejects non-enum value for esFrom', () => { - expect(() => { - processOptions({ esFrom: 'butter' }, ['foo']); - }).toThrow('functional_tests: invalid argument [butter] to option [esFrom]'); - }); - - it('accepts value for grep', () => { - const options = processOptions({ grep: 'management' }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('accepts debug option', () => { - const options = processOptions({ debug: true }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('accepts silent option', () => { - const options = processOptions({ silent: true }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('accepts quiet option', () => { - const options = processOptions({ quiet: true }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('accepts verbose option', () => { - const options = processOptions({ verbose: true }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('accepts extra server options', () => { - const options = processOptions({ _: { 'server.foo': 'bar' } }, ['foo']); - expect(options).toMatchSnapshot(); - }); - - it('rejects invalid options even if valid options exist', () => { - expect(() => { - processOptions({ debug: true, aintnothang: true, bail: true }, ['foo']); - }).toThrow('functional_tests: invalid option [aintnothang]'); - }); -}); diff --git a/packages/kbn-test/src/functional_tests/cli/run_tests/cli.js b/packages/kbn-test/src/functional_tests/cli/run_tests/cli.js deleted file mode 100644 index cf49fc77e479..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/run_tests/cli.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { runTests } from '../../tasks'; -import { runCli } from '../../lib'; -import { processOptions, displayHelp } from './args'; - -/** - * Run servers and tests for each config - * Only cares about --config option. Other options - * are passed directly to functional_test_runner, such as - * --bail, --verbose, etc. - * @param {string[]} defaultConfigPaths Optional paths to configs - * if no config option is passed - */ -export async function runTestsCli(defaultConfigPaths) { - await runCli(displayHelp, async (userOptions) => { - const options = processOptions(userOptions, defaultConfigPaths); - await runTests(options); - }); -} diff --git a/packages/kbn-test/src/functional_tests/cli/run_tests/cli.test.js b/packages/kbn-test/src/functional_tests/cli/run_tests/cli.test.js deleted file mode 100644 index 97b74a3b2b54..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/run_tests/cli.test.js +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { Writable } from 'stream'; - -import { runTestsCli } from './cli'; -import { checkMockConsoleLogSnapshot } from '../../test_helpers'; - -// Note: Stub the runTests function to keep testing only around the cli -// method and arguments. -jest.mock('../../tasks', () => ({ - runTests: jest.fn(), -})); - -describe('run tests CLI', () => { - describe('options', () => { - const originalObjects = { process, console }; - const exitMock = jest.fn(); - const logMock = jest.fn(); // mock logging so we don't send output to the test results - const argvMock = ['foo', 'foo']; - - const processMock = { - exit: exitMock, - argv: argvMock, - stdout: new Writable(), - cwd: jest.fn(), - env: { - ...originalObjects.process.env, - TEST_ES_FROM: 'snapshot', - }, - }; - - beforeAll(() => { - global.process = processMock; - global.console = { log: logMock }; - }); - - afterAll(() => { - global.process = originalObjects.process; - global.console = originalObjects.console; - }); - - beforeEach(() => { - global.process.argv = [...argvMock]; - global.process.env = { - ...originalObjects.process.env, - TEST_ES_FROM: 'snapshot', - }; - jest.resetAllMocks(); - }); - - it('rejects boolean config value', async () => { - global.process.argv.push('--config'); - - await runTestsCli(); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('rejects empty config value if no default passed', async () => { - global.process.argv.push('--config', ''); - - await runTestsCli(); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('accepts empty config value if default passed', async () => { - global.process.argv.push('--config', ''); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('rejects non-boolean value for bail', async () => { - global.process.argv.push('--bail', 'peanut'); - - await runTestsCli(['foo']); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('accepts string value for kibana-install-dir', async () => { - global.process.argv.push('--kibana-install-dir', 'foo'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('rejects boolean value for kibana-install-dir', async () => { - global.process.argv.push('--kibana-install-dir'); - - await runTestsCli(['foo']); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('accepts boolean value for updateBaselines', async () => { - global.process.argv.push('--updateBaselines'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalledWith(); - }); - - it('accepts source value for esFrom', async () => { - global.process.argv.push('--esFrom', 'source'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('rejects non-enum value for esFrom', async () => { - global.process.argv.push('--esFrom', 'butter'); - - await runTestsCli(['foo']); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('accepts value for grep', async () => { - global.process.argv.push('--grep', 'management'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts debug option', async () => { - global.process.argv.push('--debug'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts silent option', async () => { - global.process.argv.push('--silent'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts quiet option', async () => { - global.process.argv.push('--quiet'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts verbose option', async () => { - global.process.argv.push('--verbose'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts extra server options', async () => { - global.process.argv.push('--', '--server.foo=bar'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts help option even if invalid options passed', async () => { - global.process.argv.push('--debug', '--aintnothang', '--help'); - - await runTestsCli(['foo']); - - expect(exitMock).not.toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('rejects invalid options even if valid options exist', async () => { - global.process.argv.push('--debug', '--aintnothang', '--bail'); - - await runTestsCli(['foo']); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - }); -}); diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap b/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap deleted file mode 100644 index 809b635369a3..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap +++ /dev/null @@ -1,120 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`display help for start servers CLI displays as expected 1`] = ` -"Start Functional Test Servers - -Usage: - node scripts/functional_tests_server --help - node scripts/functional_tests_server [--config ] - node scripts/functional_tests_server [options] [-- --] - -Options: - --help Display this menu and exit. - --config Pass in a config - --esFrom Build Elasticsearch from source, snapshot or path to existing install dir. Default: $TEST_ES_FROM or snapshot - --kibana-install-dir Run Kibana from existing install directory instead of from source. - --verbose Log everything. - --debug Run in debug mode. - --quiet Only log errors. - --silent Log nothing." -`; - -exports[`process options for start servers CLI accepts debug option 1`] = ` -Object { - "config": /foo, - "createLogger": [Function], - "debug": true, - "esFrom": "snapshot", - "extraKbnOpts": undefined, -} -`; - -exports[`process options for start servers CLI accepts empty config value if default passed 1`] = ` -Object { - "config": /foo, - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, -} -`; - -exports[`process options for start servers CLI accepts extra server options 1`] = ` -Object { - "_": Object { - "server.foo": "bar", - }, - "config": /foo, - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": Object { - "server.foo": "bar", - }, -} -`; - -exports[`process options for start servers CLI accepts quiet option 1`] = ` -Object { - "config": /foo, - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "quiet": true, -} -`; - -exports[`process options for start servers CLI accepts silent option 1`] = ` -Object { - "config": /foo, - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "silent": true, -} -`; - -exports[`process options for start servers CLI accepts source value for $TEST_ES_FROM 1`] = ` -Object { - "config": /foo, - "createLogger": [Function], - "esFrom": "source", - "extraKbnOpts": undefined, -} -`; - -exports[`process options for start servers CLI accepts source value for esFrom 1`] = ` -Object { - "config": /foo, - "createLogger": [Function], - "esFrom": "source", - "extraKbnOpts": undefined, -} -`; - -exports[`process options for start servers CLI accepts string value for kibana-install-dir 1`] = ` -Object { - "config": /foo, - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "installDir": "foo", -} -`; - -exports[`process options for start servers CLI accepts verbose option 1`] = ` -Object { - "config": /foo, - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, - "verbose": true, -} -`; - -exports[`process options for start servers CLI prioritizes source flag over $TEST_ES_FROM 1`] = ` -Object { - "config": /foo, - "createLogger": [Function], - "esFrom": "snapshot", - "extraKbnOpts": undefined, -} -`; diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/cli.test.js.snap b/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/cli.test.js.snap deleted file mode 100644 index b54bf5dc84dd..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/cli.test.js.snap +++ /dev/null @@ -1,43 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`start servers CLI options accepts boolean value for updateBaselines 1`] = ` -" -functional_tests_server: invalid option [updateBaselines] - ...stack trace... -" -`; - -exports[`start servers CLI options rejects bail 1`] = ` -" -functional_tests_server: invalid option [bail] - ...stack trace... -" -`; - -exports[`start servers CLI options rejects boolean config value 1`] = ` -" -functional_tests_server: invalid argument [true] to option [config] - ...stack trace... -" -`; - -exports[`start servers CLI options rejects boolean value for kibana-install-dir 1`] = ` -" -functional_tests_server: invalid argument [true] to option [kibana-install-dir] - ...stack trace... -" -`; - -exports[`start servers CLI options rejects empty config value if no default passed 1`] = ` -" -functional_tests_server: config is required - ...stack trace... -" -`; - -exports[`start servers CLI options rejects invalid options even if valid options exist 1`] = ` -" -functional_tests_server: invalid option [grep] - ...stack trace... -" -`; \ No newline at end of file diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/args.js b/packages/kbn-test/src/functional_tests/cli/start_servers/args.js deleted file mode 100644 index e604e86de8b3..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/args.js +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { resolve } from 'path'; - -import dedent from 'dedent'; -import { ToolingLog, pickLevelFromFlags } from '@kbn/dev-utils'; - -const options = { - help: { desc: 'Display this menu and exit.' }, - config: { - arg: '', - desc: 'Pass in a config', - }, - esFrom: { - arg: '', - desc: 'Build Elasticsearch from source, snapshot or path to existing install dir.', - defaultHelp: 'Default: $TEST_ES_FROM or snapshot', - }, - 'kibana-install-dir': { - arg: '', - desc: 'Run Kibana from existing install directory instead of from source.', - }, - verbose: { desc: 'Log everything.' }, - debug: { desc: 'Run in debug mode.' }, - quiet: { desc: 'Only log errors.' }, - silent: { desc: 'Log nothing.' }, -}; - -export function displayHelp() { - const helpOptions = Object.keys(options) - .filter((name) => name !== '_') - .map((name) => { - const option = options[name]; - return { - ...option, - usage: `${name} ${option.arg || ''}`, - default: option.defaultHelp || '', - }; - }) - .map((option) => { - return `--${option.usage.padEnd(30)} ${option.desc} ${option.default}`; - }) - .join(`\n `); - - return dedent(` - Start Functional Test Servers - - Usage: - node scripts/functional_tests_server --help - node scripts/functional_tests_server [--config ] - node scripts/functional_tests_server [options] [-- --] - - Options: - ${helpOptions} - `); -} - -export function processOptions(userOptions, defaultConfigPath) { - validateOptions(userOptions); - - const config = userOptions.config || defaultConfigPath; - - if (!config) { - throw new Error(`functional_tests_server: config is required`); - } - - if (!userOptions.esFrom) { - userOptions.esFrom = process.env.TEST_ES_FROM || 'snapshot'; - } - - if (userOptions['kibana-install-dir']) { - userOptions.installDir = userOptions['kibana-install-dir']; - delete userOptions['kibana-install-dir']; - } - - function createLogger() { - return new ToolingLog({ - level: pickLevelFromFlags(userOptions), - writeTo: process.stdout, - }); - } - - return { - ...userOptions, - config: resolve(config), - createLogger, - extraKbnOpts: userOptions._, - }; -} - -function validateOptions(userOptions) { - Object.entries(userOptions).forEach(([key, val]) => { - if (key === '_') return; - - // Validate flags passed - if (options[key] === undefined) { - throw new Error(`functional_tests_server: invalid option [${key}]`); - } - - if ( - // Validate boolean flags - (!options[key].arg && typeof val !== 'boolean') || - // Validate string/array flags - (options[key].arg && typeof val !== 'string' && !Array.isArray(val)) || - // Validate enum flags - (options[key].choices && !options[key].choices.includes(val)) - ) { - throw new Error(`functional_tests_server: invalid argument [${val}] to option [${key}]`); - } - }); -} diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/args.test.js b/packages/kbn-test/src/functional_tests/cli/start_servers/args.test.js deleted file mode 100644 index 0c842c8c7df4..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/args.test.js +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { displayHelp, processOptions } from './args'; -import { createAbsolutePathSerializer } from '@kbn/dev-utils'; - -expect.addSnapshotSerializer(createAbsolutePathSerializer(process.cwd())); - -const INITIAL_TEST_ES_FROM = process.env.TEST_ES_FROM; -beforeEach(() => { - process.env.TEST_ES_FROM = 'snapshot'; -}); -afterEach(() => { - process.env.TEST_ES_FROM = INITIAL_TEST_ES_FROM; -}); - -describe('display help for start servers CLI', () => { - it('displays as expected', () => { - expect(displayHelp()).toMatchSnapshot(); - }); -}); - -describe('process options for start servers CLI', () => { - it('rejects boolean config value', () => { - expect(() => { - processOptions({ config: true }); - }).toThrow('functional_tests_server: invalid argument [true] to option [config]'); - }); - - it('rejects empty config value if no default passed', () => { - expect(() => { - processOptions({}); - }).toThrow('functional_tests_server: config is required'); - }); - - it('accepts empty config value if default passed', () => { - const options = processOptions({ config: '' }, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('rejects invalid option', () => { - expect(() => { - processOptions({ bail: true }, 'foo'); - }).toThrow('functional_tests_server: invalid option [bail]'); - }); - - it('accepts string value for kibana-install-dir', () => { - const options = processOptions({ 'kibana-install-dir': 'foo' }, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('rejects boolean value for kibana-install-dir', () => { - expect(() => { - processOptions({ 'kibana-install-dir': true }, 'foo'); - }).toThrow('functional_tests_server: invalid argument [true] to option [kibana-install-dir]'); - }); - - it('accepts source value for esFrom', () => { - const options = processOptions({ esFrom: 'source' }, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('accepts source value for $TEST_ES_FROM', () => { - process.env.TEST_ES_FROM = 'source'; - const options = processOptions({}, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('prioritizes source flag over $TEST_ES_FROM', () => { - process.env.TEST_ES_FROM = 'source'; - const options = processOptions({ esFrom: 'snapshot' }, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('accepts debug option', () => { - const options = processOptions({ debug: true }, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('accepts silent option', () => { - const options = processOptions({ silent: true }, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('accepts quiet option', () => { - const options = processOptions({ quiet: true }, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('accepts verbose option', () => { - const options = processOptions({ verbose: true }, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('accepts extra server options', () => { - const options = processOptions({ _: { 'server.foo': 'bar' } }, 'foo'); - expect(options).toMatchSnapshot(); - }); - - it('rejects invalid options even if valid options exist', () => { - expect(() => { - processOptions({ debug: true, aintnothang: true, bail: true }, 'foo'); - }).toThrow('functional_tests_server: invalid option [aintnothang]'); - }); -}); diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/cli.js b/packages/kbn-test/src/functional_tests/cli/start_servers/cli.js deleted file mode 100644 index d4499ee76e31..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/cli.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { startServers } from '../../tasks'; -import { runCli } from '../../lib'; -import { processOptions, displayHelp } from './args'; - -/** - * Start servers - * @param {string} defaultConfigPath Optional path to config - * if no config option is passed - */ -export async function startServersCli(defaultConfigPath) { - await runCli(displayHelp, async (userOptions) => { - const options = processOptions(userOptions, defaultConfigPath); - await startServers(options); - }); -} diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/cli.test.js b/packages/kbn-test/src/functional_tests/cli/start_servers/cli.test.js deleted file mode 100644 index 3ceecb280662..000000000000 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/cli.test.js +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { Writable } from 'stream'; - -import { startServersCli } from './cli'; -import { checkMockConsoleLogSnapshot } from '../../test_helpers'; - -// Note: Stub the startServers function to keep testing only around the cli -// method and arguments. -jest.mock('../../tasks', () => ({ - startServers: jest.fn(), -})); - -describe('start servers CLI', () => { - describe('options', () => { - const originalObjects = { process, console }; - const exitMock = jest.fn(); - const logMock = jest.fn(); // mock logging so we don't send output to the test results - const argvMock = ['foo', 'foo']; - - const processMock = { - exit: exitMock, - argv: argvMock, - stdout: new Writable(), - cwd: jest.fn(), - env: { - ...originalObjects.process.env, - TEST_ES_FROM: 'snapshot', - }, - }; - - beforeAll(() => { - global.process = processMock; - global.console = { log: logMock }; - }); - - afterAll(() => { - global.process = originalObjects.process; - global.console = originalObjects.console; - }); - - beforeEach(() => { - global.process.argv = [...argvMock]; - global.process.env = { - ...originalObjects.process.env, - TEST_ES_FROM: 'snapshot', - }; - jest.resetAllMocks(); - }); - - it('rejects boolean config value', async () => { - global.process.argv.push('--config'); - - await startServersCli(); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('rejects empty config value if no default passed', async () => { - global.process.argv.push('--config', ''); - - await startServersCli(); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('accepts empty config value if default passed', async () => { - global.process.argv.push('--config', ''); - - await startServersCli('foo'); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('rejects bail', async () => { - global.process.argv.push('--bail', true); - - await startServersCli('foo'); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('accepts string value for kibana-install-dir', async () => { - global.process.argv.push('--kibana-install-dir', 'foo'); - - await startServersCli('foo'); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('rejects boolean value for kibana-install-dir', async () => { - global.process.argv.push('--kibana-install-dir'); - - await startServersCli('foo'); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('accepts boolean value for updateBaselines', async () => { - global.process.argv.push('--updateBaselines'); - - await startServersCli('foo'); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - - it('accepts source value for esFrom', async () => { - global.process.argv.push('--esFrom', 'source'); - - await startServersCli('foo'); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts debug option', async () => { - global.process.argv.push('--debug'); - - await startServersCli('foo'); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts silent option', async () => { - global.process.argv.push('--silent'); - - await startServersCli('foo'); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts quiet option', async () => { - global.process.argv.push('--quiet'); - - await startServersCli('foo'); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts verbose option', async () => { - global.process.argv.push('--verbose'); - - await startServersCli('foo'); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts extra server options', async () => { - global.process.argv.push('--', '--server.foo=bar'); - - await startServersCli('foo'); - - expect(exitMock).not.toHaveBeenCalled(); - }); - - it('accepts help option even if invalid options passed', async () => { - global.process.argv.push('--debug', '--grep', '--help'); - - await startServersCli('foo'); - - expect(exitMock).not.toHaveBeenCalledWith(1); - }); - - it('rejects invalid options even if valid options exist', async () => { - global.process.argv.push('--debug', '--grep', '--bail'); - - await startServersCli('foo'); - - expect(exitMock).toHaveBeenCalledWith(1); - checkMockConsoleLogSnapshot(logMock); - }); - }); -}); diff --git a/packages/kbn-test/src/functional_tests/lib/__snapshots__/run_cli.test.js.snap b/packages/kbn-test/src/functional_tests/lib/__snapshots__/run_cli.test.js.snap deleted file mode 100644 index 6506675cea9b..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/__snapshots__/run_cli.test.js.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`does right thing when non-error is thrown 1`] = ` -" -'foo bar' thrown! - ...stack trace... -" -`; - -exports[`logs no stack trace then exits when stack missing 1`] = ` -" -foo error - (no stack trace) - -" -`; - -exports[`logs the stack then exits when run function throws an error 1`] = ` -" -foo error - stack 1 - stack 2 - stack 3 - -" -`; diff --git a/packages/kbn-test/src/functional_tests/lib/auth.js b/packages/kbn-test/src/functional_tests/lib/auth.js deleted file mode 100644 index 358b16c562b1..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/auth.js +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import fs from 'fs'; -import util from 'util'; -import { format as formatUrl } from 'url'; - -import request from 'request'; -import { delay } from 'bluebird'; - -export const DEFAULT_SUPERUSER_PASS = 'changeme'; - -const readFile = util.promisify(fs.readFile); - -async function updateCredentials({ - port, - auth, - username, - password, - retries = 10, - protocol, - caCert, -}) { - const result = await new Promise((resolve, reject) => - request( - { - method: 'PUT', - uri: formatUrl({ - protocol: `${protocol}:`, - auth, - hostname: 'localhost', - port, - pathname: `/_security/user/${username}/_password`, - }), - json: true, - body: { password }, - ca: caCert, - }, - (err, httpResponse, body) => { - if (err) return reject(err); - resolve({ httpResponse, body }); - } - ) - ); - - const { body, httpResponse } = result; - const { statusCode } = httpResponse; - - if (statusCode === 200) { - return; - } - - if (retries > 0) { - await delay(2500); - return await updateCredentials({ - port, - auth, - username, - password, - retries: retries - 1, - protocol, - caCert, - }); - } - - throw new Error(`${statusCode} response, expected 200 -- ${JSON.stringify(body)}`); -} - -export async function setupUsers({ log, esPort, updates, protocol = 'http', caPath }) { - // track the current credentials for the `elastic` user as - // they will likely change as we apply updates - let auth = `elastic:${DEFAULT_SUPERUSER_PASS}`; - const caCert = caPath && (await readFile(caPath)); - - for (const { username, password, roles } of updates) { - // If working with a built-in user, just change the password - if (['logstash_system', 'elastic', 'kibana'].includes(username)) { - await updateCredentials({ port: esPort, auth, username, password, protocol, caCert }); - log.info('setting %j user password to %j', username, password); - - // If not a builtin user, add them - } else { - await insertUser({ port: esPort, auth, username, password, roles, protocol, caCert }); - log.info('Added %j user with password to %j', username, password); - } - - if (username === 'elastic') { - auth = `elastic:${password}`; - } - } -} - -async function insertUser({ - port, - auth, - username, - password, - roles = [], - retries = 10, - protocol, - caCert, -}) { - const result = await new Promise((resolve, reject) => - request( - { - method: 'POST', - uri: formatUrl({ - protocol: `${protocol}:`, - auth, - hostname: 'localhost', - port, - pathname: `/_security/user/${username}`, - }), - json: true, - body: { password, roles }, - ca: caCert, - }, - (err, httpResponse, body) => { - if (err) return reject(err); - resolve({ httpResponse, body }); - } - ) - ); - - const { body, httpResponse } = result; - const { statusCode } = httpResponse; - if (statusCode === 200) { - return; - } - - if (retries > 0) { - await delay(2500); - return await insertUser({ - port, - auth, - username, - password, - roles, - retries: retries - 1, - protocol, - caCert, - }); - } - - throw new Error(`${statusCode} response, expected 200 -- ${JSON.stringify(body)}`); -} diff --git a/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js b/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js deleted file mode 100644 index 44ff579411bd..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -const Path = require('path'); - -const { REPO_ROOT } = require('@kbn/dev-utils'); - -// modifies all future calls to require() to automatically -// compile the required source with babel -require('@babel/register')({ - ignore: [/[\/\\](node_modules|target|dist)[\/\\]/], - only: [ - Path.resolve(REPO_ROOT, 'test'), - Path.resolve(REPO_ROOT, 'x-pack/test'), - Path.resolve(REPO_ROOT, 'examples'), - Path.resolve(REPO_ROOT, 'x-pack/examples'), - // TODO: should should probably remove this link back to the source - Path.resolve(REPO_ROOT, 'x-pack/plugins/task_manager/server/config.ts'), - ], - babelrc: false, - presets: [require.resolve('@kbn/babel-preset/node_preset')], - extensions: ['.js', '.ts', '.tsx'], -}); diff --git a/packages/kbn-test/src/functional_tests/lib/index.js b/packages/kbn-test/src/functional_tests/lib/index.js deleted file mode 100644 index ec381b56b069..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { runKibanaServer } from './run_kibana_server'; -export { runElasticsearch } from './run_elasticsearch'; -export { runFtr, hasTests, assertNoneExcluded } from './run_ftr'; -export { KIBANA_ROOT, KIBANA_FTR_SCRIPT, FUNCTIONAL_CONFIG_PATH, API_CONFIG_PATH } from './paths'; -export { runCli } from './run_cli'; diff --git a/packages/kbn-test/src/functional_tests/lib/paths.js b/packages/kbn-test/src/functional_tests/lib/paths.js deleted file mode 100644 index 9ede5a105b08..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/paths.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { resolve, relative } from 'path'; - -// resolve() treats relative paths as relative to process.cwd(), -// so to return a relative path we use relative() -function resolveRelative(path) { - return relative(process.cwd(), resolve(path)); -} - -export const KIBANA_EXEC = 'node'; -export const KIBANA_EXEC_PATH = resolveRelative('scripts/kibana'); -export const KIBANA_ROOT = resolve(__dirname, '../../../../../'); -export const KIBANA_FTR_SCRIPT = resolve(KIBANA_ROOT, 'scripts/functional_test_runner'); -export const PROJECT_ROOT = resolve(__dirname, '../../../../../../'); -export const FUNCTIONAL_CONFIG_PATH = resolve(KIBANA_ROOT, 'test/functional/config'); -export const API_CONFIG_PATH = resolve(KIBANA_ROOT, 'test/api_integration/config'); diff --git a/packages/kbn-test/src/functional_tests/lib/run_cli.js b/packages/kbn-test/src/functional_tests/lib/run_cli.js deleted file mode 100644 index 51a970e1a305..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/run_cli.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { inspect } from 'util'; - -import chalk from 'chalk'; -import getopts from 'getopts'; - -export class CliError extends Error { - constructor(message, exitCode = 1) { - super(message); - this.exitCode = exitCode; - Error.captureStackTrace(this, CliError); - } -} - -export async function runCli(getHelpText, run) { - try { - const userOptions = getopts(process.argv.slice(2)) || {}; - if (userOptions.help) { - console.log(getHelpText()); - return; - } - - await run(userOptions); - } catch (error) { - if (!(error instanceof Error)) { - error = new Error(`${inspect(error)} thrown!`); - } - - console.log(); - console.log(chalk.red(error.message)); - - // CliError is a special error class that indicates that the error is produced as a part - // of using the CLI, and does not need a stack trace to make sense, so we skip the stack - // trace logging if the error thrown is an instance of this class - if (!(error instanceof CliError)) { - // first line in the stack trace is the message, skip it as we log it directly and color it red - if (error.stack) { - console.log(error.stack.split('\n').slice(1).join('\n')); - } else { - console.log(' (no stack trace)'); - } - } - - console.log(); - - process.exit(error.exitCode || 1); - } -} diff --git a/packages/kbn-test/src/functional_tests/lib/run_cli.test.js b/packages/kbn-test/src/functional_tests/lib/run_cli.test.js deleted file mode 100644 index 959f96591753..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/run_cli.test.js +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { runCli } from './run_cli'; -import { checkMockConsoleLogSnapshot } from '../test_helpers'; - -const mockProcessExit = jest.spyOn(process, 'exit').mockImplementation(() => {}); -const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(() => {}); - -const actualProcessArgv = process.argv; - -const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); - -beforeEach(() => { - process.argv = actualProcessArgv.slice(0, 2); - jest.clearAllMocks(); -}); - -afterAll(() => { - process.argv = actualProcessArgv; -}); - -it('accepts help option even if invalid options passed', async () => { - process.argv.push('--foo', '--bar', '--help'); - - const mockGetHelpText = jest.fn().mockReturnValue('mock help text'); - const mockRun = jest.fn(); - await runCli(mockGetHelpText, mockRun); - - expect(mockProcessExit).not.toHaveBeenCalled(); - expect(mockGetHelpText).toHaveBeenCalledTimes(1); - expect(mockConsoleLog).toHaveBeenCalledTimes(1); - expect(mockConsoleLog).toHaveBeenCalledWith('mock help text'); - expect(mockRun).not.toHaveBeenCalled(); -}); - -it('passes parsed argv to run function', async () => { - process.argv.push('--foo', 'bar', '--baz=box', '--', 'a', 'b', 'c'); - - const mockGetHelpText = jest.fn(); - const mockRun = jest.fn(); - await runCli(mockGetHelpText, mockRun); - - expect(mockGetHelpText).not.toHaveBeenCalled(); - expect(mockConsoleLog).not.toHaveBeenCalled(); - expect(mockProcessExit).not.toHaveBeenCalled(); - expect(mockRun).toHaveBeenCalledTimes(1); - expect(mockRun).toHaveBeenCalledWith({ - foo: 'bar', - baz: 'box', - _: ['a', 'b', 'c'], - }); -}); - -it('waits for promise returned from run function to resolve before resolving', async () => { - let resolveMockRun; - const mockRun = jest.fn().mockImplementation( - () => - new Promise((resolve) => { - resolveMockRun = resolve; - }) - ); - - const onResolved = jest.fn(); - const promise = runCli(null, mockRun).then(onResolved); - - expect(mockRun).toHaveBeenCalled(); - expect(onResolved).not.toHaveBeenCalled(); - - await sleep(500); - - expect(onResolved).not.toHaveBeenCalled(); - - resolveMockRun(); - await promise; - expect(onResolved).toHaveBeenCalled(); -}); - -it('logs the stack then exits when run function throws an error', async () => { - await runCli(null, () => { - const error = new Error('foo error'); - error.stack = 'foo error\n stack 1\n stack 2\n stack 3'; - throw error; - }); - - expect(mockProcessExit).toHaveBeenCalledTimes(1); - expect(mockProcessExit).toHaveBeenCalledWith(1); - - expect(mockConsoleLog).toHaveBeenCalled(); - checkMockConsoleLogSnapshot(mockConsoleLog); -}); - -it('logs no stack trace then exits when stack missing', async () => { - await runCli(null, () => { - const error = new Error('foo error'); - error.stack = undefined; - throw error; - }); - - expect(mockProcessExit).toHaveBeenCalledTimes(1); - expect(mockProcessExit).toHaveBeenCalledWith(1); - - expect(mockConsoleLog).toHaveBeenCalled(); - checkMockConsoleLogSnapshot(mockConsoleLog); -}); - -it('does right thing when non-error is thrown', async () => { - await runCli(null, () => { - throw 'foo bar'; - }); - - expect(mockProcessExit).toHaveBeenCalledTimes(1); - expect(mockProcessExit).toHaveBeenCalledWith(1); - - expect(mockConsoleLog).toHaveBeenCalled(); - checkMockConsoleLogSnapshot(mockConsoleLog); -}); diff --git a/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.js b/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.js deleted file mode 100644 index 3d174791fffc..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { resolve } from 'path'; -import { KIBANA_ROOT } from './paths'; -import { createLegacyEsTestCluster } from '../../legacy_es'; - -import { setupUsers, DEFAULT_SUPERUSER_PASS } from './auth'; - -export async function runElasticsearch({ config, options }) { - const { log, esFrom } = options; - const ssl = config.get('esTestCluster.ssl'); - const license = config.get('esTestCluster.license'); - const esArgs = config.get('esTestCluster.serverArgs'); - const esEnvVars = config.get('esTestCluster.serverEnvVars'); - const isSecurityEnabled = esArgs.includes('xpack.security.enabled=true'); - - const cluster = createLegacyEsTestCluster({ - port: config.get('servers.elasticsearch.port'), - password: isSecurityEnabled - ? DEFAULT_SUPERUSER_PASS - : config.get('servers.elasticsearch.password'), - license, - log, - basePath: resolve(KIBANA_ROOT, '.es'), - esFrom: esFrom || config.get('esTestCluster.from'), - dataArchive: config.get('esTestCluster.dataArchive'), - esArgs, - esEnvVars, - ssl, - }); - - await cluster.start(); - - if (isSecurityEnabled) { - await setupUsers({ - log, - esPort: config.get('servers.elasticsearch.port'), - updates: [config.get('servers.elasticsearch'), config.get('servers.kibana')], - protocol: config.get('servers.elasticsearch').protocol, - caPath: getRelativeCertificateAuthorityPath(config.get('kbnTestServer.serverArgs')), - }); - } - - return cluster; -} - -function getRelativeCertificateAuthorityPath(esConfig = []) { - const caConfig = esConfig.find( - (config) => config.indexOf('--elasticsearch.ssl.certificateAuthorities') === 0 - ); - return caConfig ? caConfig.split('=')[1] : undefined; -} diff --git a/packages/kbn-test/src/functional_tests/lib/run_ftr.js b/packages/kbn-test/src/functional_tests/lib/run_ftr.js deleted file mode 100644 index 14883ac977c4..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/run_ftr.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { FunctionalTestRunner, readConfigFile } from '../../functional_test_runner'; -import { CliError } from './run_cli'; - -async function createFtr({ - configPath, - options: { installDir, log, bail, grep, updateBaselines, suiteFiles, suiteTags }, -}) { - const config = await readConfigFile(log, configPath); - - return { - config, - ftr: new FunctionalTestRunner(log, configPath, { - mochaOpts: { - bail: !!bail, - grep, - }, - kbnTestServer: { - installDir, - }, - updateBaselines, - suiteFiles: { - include: [...suiteFiles.include, ...config.get('suiteFiles.include')], - exclude: [...suiteFiles.exclude, ...config.get('suiteFiles.exclude')], - }, - suiteTags: { - include: [...suiteTags.include, ...config.get('suiteTags.include')], - exclude: [...suiteTags.exclude, ...config.get('suiteTags.exclude')], - }, - }), - }; -} - -export async function assertNoneExcluded({ configPath, options }) { - const { config, ftr } = await createFtr({ configPath, options }); - - if (config.get('testRunner')) { - // tests with custom test runners are not included in this check - return; - } - - const stats = await ftr.getTestStats(); - if (stats.excludedTests.length > 0) { - throw new CliError(` - ${stats.excludedTests.length} tests in the ${configPath} config - are excluded when filtering by the tags run on CI. Make sure that all suites are - tagged with one of the following tags, or extend the list of tags in test/scripts/jenkins_xpack.sh - - tags: ${JSON.stringify(options.suiteTags)} - - - ${stats.excludedTests.join('\n - ')} - `); - } -} - -export async function runFtr({ configPath, options }) { - const { ftr } = await createFtr({ configPath, options }); - - const failureCount = await ftr.run(); - if (failureCount > 0) { - throw new CliError( - `${failureCount} functional test ${failureCount === 1 ? 'failure' : 'failures'}` - ); - } -} - -export async function hasTests({ configPath, options }) { - const { ftr, config } = await createFtr({ configPath, options }); - - if (config.get('testRunner')) { - // configs with custom test runners are assumed to always have tests - return true; - } - const stats = await ftr.getTestStats(); - return stats.testCount > 0; -} diff --git a/packages/kbn-test/src/functional_tests/lib/run_kibana_server.js b/packages/kbn-test/src/functional_tests/lib/run_kibana_server.js deleted file mode 100644 index e7ec99467ecf..000000000000 --- a/packages/kbn-test/src/functional_tests/lib/run_kibana_server.js +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { resolve, relative } from 'path'; -import { KIBANA_ROOT, KIBANA_EXEC, KIBANA_EXEC_PATH } from './paths'; - -function extendNodeOptions(installDir) { - if (!installDir) { - return {}; - } - - const testOnlyRegisterPath = relative( - installDir, - require.resolve('./babel_register_for_test_plugins') - ); - - return { - NODE_OPTIONS: `--require=${testOnlyRegisterPath}${ - process.env.NODE_OPTIONS ? ` ${process.env.NODE_OPTIONS}` : '' - }`, - }; -} - -export async function runKibanaServer({ procs, config, options }) { - const { installDir } = options; - - await procs.run('kibana', { - cmd: getKibanaCmd(installDir), - args: filterCliArgs(collectCliArgs(config, options)), - env: { - FORCE_COLOR: 1, - ...process.env, - ...extendNodeOptions(installDir), - }, - cwd: installDir || KIBANA_ROOT, - wait: /http server running/, - }); -} - -function getKibanaCmd(installDir) { - if (installDir) { - return process.platform.startsWith('win') - ? resolve(installDir, 'bin/kibana.bat') - : resolve(installDir, 'bin/kibana'); - } - - return KIBANA_EXEC; -} - -/** - * When installDir is passed, we run from a built version of Kibana, - * which uses different command line arguments. If installDir is not - * passed, we run from source code. We also allow passing in extra - * Kibana server options, so we tack those on here. - */ -function collectCliArgs(config, { installDir, extraKbnOpts }) { - const buildArgs = config.get('kbnTestServer.buildArgs') || []; - const sourceArgs = config.get('kbnTestServer.sourceArgs') || []; - const serverArgs = config.get('kbnTestServer.serverArgs') || []; - - return pipe( - serverArgs, - (args) => (installDir ? args.filter((a) => a !== '--oss') : args), - (args) => (installDir ? [...buildArgs, ...args] : [KIBANA_EXEC_PATH, ...sourceArgs, ...args]), - (args) => args.concat(extraKbnOpts || []) - ); -} - -/** - * Filter the cli args to remove duplications and - * overridden options - */ -function filterCliArgs(args) { - return args.reduce((acc, val, ind) => { - // If original argv has a later basepath setting, skip this val. - if (isBasePathSettingOverridden(args, val, ind)) { - return acc; - } - - // Check if original argv has a later setting that overrides - // the current val. If so, skip this val. - if ( - !allowsDuplicate(val) && - findIndexFrom(args, ++ind, (opt) => opt.split('=')[0] === val.split('=')[0]) > -1 - ) { - return acc; - } - - return [...acc, val]; - }, []); -} - -/** - * Apply each function in fns to the result of the - * previous function. The first function's input - * is the arr array. - */ -function pipe(arr, ...fns) { - return fns.reduce((acc, fn) => { - return fn(acc); - }, arr); -} - -/** - * Checks whether a specific parameter is allowed to appear multiple - * times in the Kibana parameters. - */ -function allowsDuplicate(val) { - return ['--plugin-path'].includes(val.split('=')[0]); -} - -function isBasePathSettingOverridden(args, val, ind) { - const key = val.split('=')[0]; - const basePathKeys = ['--no-base-path', '--server.basePath']; - - if (basePathKeys.includes(key)) { - if (findIndexFrom(args, ++ind, (opt) => basePathKeys.includes(opt.split('=')[0])) > -1) { - return true; - } - } - - return false; -} - -function findIndexFrom(array, index, ...args) { - return [...array].slice(index).findIndex(...args); -} diff --git a/packages/kbn-test/src/functional_tests/tasks.js b/packages/kbn-test/src/functional_tests/tasks.js deleted file mode 100644 index 7d4fc84d47bd..000000000000 --- a/packages/kbn-test/src/functional_tests/tasks.js +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { relative } from 'path'; -import * as Rx from 'rxjs'; -import { startWith, switchMap, take } from 'rxjs/operators'; -import { withProcRunner } from '@kbn/dev-utils'; -import dedent from 'dedent'; - -import { - runElasticsearch, - runKibanaServer, - runFtr, - assertNoneExcluded, - hasTests, - KIBANA_FTR_SCRIPT, -} from './lib'; - -import { readConfigFile } from '../functional_test_runner/lib'; - -const makeSuccessMessage = (options) => { - const installDirFlag = options.installDir ? ` --kibana-install-dir=${options.installDir}` : ''; - - return ( - '\n\n' + - dedent` - Elasticsearch and Kibana are ready for functional testing. Start the functional tests - in another terminal session by running this command from this directory: - - node ${relative(process.cwd(), KIBANA_FTR_SCRIPT)}${installDirFlag} - ` + - '\n\n' - ); -}; - -/** - * Run servers and tests for each config - * @param {object} options Optional - * @property {string[]} options.configs Array of paths to configs - * @property {function} options.log An instance of the ToolingLog - * @property {string} options.installDir Optional installation dir from which to run Kibana - * @property {boolean} options.bail Whether to exit test run at the first failure - * @property {string} options.esFrom Optionally run from source instead of snapshot - */ -export async function runTests(options) { - if (!process.env.KBN_NP_PLUGINS_BUILT) { - const log = options.createLogger(); - log.warning('❗️❗️❗️'); - log.warning('❗️❗️❗️'); - log.warning('❗️❗️❗️'); - log.warning( - " Don't forget to use `node scripts/build_kibana_platform_plugins` to build plugins you plan on testing" - ); - log.warning('❗️❗️❗️'); - log.warning('❗️❗️❗️'); - log.warning('❗️❗️❗️'); - } - - for (const configPath of options.configs) { - const log = options.createLogger(); - const opts = { - ...options, - log, - }; - - log.info('Running', configPath); - log.indent(2); - - if (options.assertNoneExcluded) { - await assertNoneExcluded({ configPath, options: opts }); - continue; - } - - if (!(await hasTests({ configPath, options: opts }))) { - log.info('Skipping', configPath, 'since all tests are excluded'); - continue; - } - - await withProcRunner(log, async (procs) => { - const config = await readConfigFile(log, configPath); - - let es; - try { - es = await runElasticsearch({ config, options: opts }); - await runKibanaServer({ procs, config, options: opts }); - await runFtr({ configPath, options: opts }); - } finally { - try { - await procs.stop('kibana'); - } finally { - if (es) { - await es.cleanup(); - } - } - } - }); - } -} - -/** - * Start only servers using single config - * @param {object} options Optional - * @property {string} options.config Path to a config file - * @property {function} options.log An instance of the ToolingLog - * @property {string} options.installDir Optional installation dir from which to run Kibana - * @property {string} options.esFrom Optionally run from source instead of snapshot - */ -export async function startServers(options) { - const log = options.createLogger(); - const opts = { - ...options, - log, - }; - - await withProcRunner(log, async (procs) => { - const config = await readConfigFile(log, options.config); - - const es = await runElasticsearch({ config, options: opts }); - await runKibanaServer({ - procs, - config, - options: { - ...opts, - extraKbnOpts: [ - ...options.extraKbnOpts, - ...(options.installDir ? [] : ['--dev', '--no-dev-config']), - ], - }, - }); - - // wait for 5 seconds of silence before logging the - // success message so that it doesn't get buried - await silence(log, 5000); - log.success(makeSuccessMessage(options)); - - await procs.waitForAllToStop(); - await es.cleanup(); - }); -} - -async function silence(log, milliseconds) { - await log - .getWritten$() - .pipe( - startWith(null), - switchMap(() => Rx.timer(milliseconds)), - take(1) - ) - .toPromise(); -} diff --git a/packages/kbn-test/src/functional_tests/test_helpers.js b/packages/kbn-test/src/functional_tests/test_helpers.js deleted file mode 100644 index cf36a794466c..000000000000 --- a/packages/kbn-test/src/functional_tests/test_helpers.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* eslint-env jest */ - -import { format } from 'util'; - -export function checkMockConsoleLogSnapshot(logMock) { - const output = logMock.mock.calls - .reduce((acc, args) => `${acc}${format(...args)}\n`, '') - .replace(/(^ at.+[>)\d]$\n?)+/m, ' ...stack trace...'); - - expect(output).toMatchSnapshot(); -} From b61f052e50b23ec05d98e3384db97ec866022409 Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Wed, 3 Mar 2021 22:29:49 +0000 Subject: [PATCH 3/4] [Rename] kbn-test/src/failed_tests_reporter in packages directory to osd-test/failed_tests_reporter Signed-off-by: Mihir Soni --- .../src/failed_tests_reporter/README.md | 2 +- .../src/failed_tests_reporter/__fixtures__/cypress_report.xml | 0 .../src/failed_tests_reporter/__fixtures__/ftr_report.xml | 0 .../src/failed_tests_reporter/__fixtures__/index.ts | 0 .../src/failed_tests_reporter/__fixtures__/jest_report.xml | 0 .../src/failed_tests_reporter/__fixtures__/mocha_report.xml | 2 +- .../src/failed_tests_reporter/add_messages_to_report.test.ts | 4 ++-- .../src/failed_tests_reporter/add_messages_to_report.ts | 2 +- .../src/failed_tests_reporter/get_failures.test.ts | 2 +- .../src/failed_tests_reporter/get_failures.ts | 2 +- .../src/failed_tests_reporter/github_api.ts | 2 +- .../{kbn-test => osd-test}/src/failed_tests_reporter/index.ts | 0 .../src/failed_tests_reporter/issue_metadata.test.ts | 0 .../src/failed_tests_reporter/issue_metadata.ts | 2 +- .../src/failed_tests_reporter/report_failure.test.ts | 0 .../src/failed_tests_reporter/report_failure.ts | 0 .../src/failed_tests_reporter/report_metadata.test.ts | 0 .../src/failed_tests_reporter/report_metadata.ts | 0 .../failed_tests_reporter/run_failed_tests_reporter_cli.ts | 4 ++-- .../src/failed_tests_reporter/test_report.ts | 0 20 files changed, 11 insertions(+), 11 deletions(-) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/README.md (95%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/__fixtures__/cypress_report.xml (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/__fixtures__/ftr_report.xml (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/__fixtures__/index.ts (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/__fixtures__/jest_report.xml (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/__fixtures__/mocha_report.xml (94%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/add_messages_to_report.test.ts (99%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/add_messages_to_report.ts (98%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/get_failures.test.ts (99%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/get_failures.ts (95%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/github_api.ts (99%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/index.ts (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/issue_metadata.test.ts (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/issue_metadata.ts (97%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/report_failure.test.ts (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/report_failure.ts (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/report_metadata.test.ts (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/report_metadata.ts (100%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts (98%) rename packages/{kbn-test => osd-test}/src/failed_tests_reporter/test_report.ts (100%) diff --git a/packages/kbn-test/src/failed_tests_reporter/README.md b/packages/osd-test/src/failed_tests_reporter/README.md similarity index 95% rename from packages/kbn-test/src/failed_tests_reporter/README.md rename to packages/osd-test/src/failed_tests_reporter/README.md index 0473ae7357de..dba40bbd4c85 100644 --- a/packages/kbn-test/src/failed_tests_reporter/README.md +++ b/packages/osd-test/src/failed_tests_reporter/README.md @@ -10,7 +10,7 @@ To fetch some JUnit reports from a recent build on CI, visit its `Google Cloud S copy(`wget -x -nH --cut-dirs 5 -P "target/downloaded_junit" "${Array.from($$('a[href$=".xml"]')).filter(a => a.innerText === 'Download').map(a => a.href.replace('https://storage.cloud.google.com/', 'https://storage.googleapis.com/')).join('" "')}"`) ``` -This copies a script to download the reports, which you should execute in the root of the Kibana repository. +This copies a script to download the reports, which you should execute in the root of the Opensearch Dashboards repository. Next, run the CLI in `--no-github-update` mode so that it doesn't actually communicate with Github and `--no-report-update` to prevent the script from mutating the reports on disk and instead log the updated report. diff --git a/packages/kbn-test/src/failed_tests_reporter/__fixtures__/cypress_report.xml b/packages/osd-test/src/failed_tests_reporter/__fixtures__/cypress_report.xml similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/__fixtures__/cypress_report.xml rename to packages/osd-test/src/failed_tests_reporter/__fixtures__/cypress_report.xml diff --git a/packages/kbn-test/src/failed_tests_reporter/__fixtures__/ftr_report.xml b/packages/osd-test/src/failed_tests_reporter/__fixtures__/ftr_report.xml similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/__fixtures__/ftr_report.xml rename to packages/osd-test/src/failed_tests_reporter/__fixtures__/ftr_report.xml diff --git a/packages/kbn-test/src/failed_tests_reporter/__fixtures__/index.ts b/packages/osd-test/src/failed_tests_reporter/__fixtures__/index.ts similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/__fixtures__/index.ts rename to packages/osd-test/src/failed_tests_reporter/__fixtures__/index.ts diff --git a/packages/kbn-test/src/failed_tests_reporter/__fixtures__/jest_report.xml b/packages/osd-test/src/failed_tests_reporter/__fixtures__/jest_report.xml similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/__fixtures__/jest_report.xml rename to packages/osd-test/src/failed_tests_reporter/__fixtures__/jest_report.xml diff --git a/packages/kbn-test/src/failed_tests_reporter/__fixtures__/mocha_report.xml b/packages/osd-test/src/failed_tests_reporter/__fixtures__/mocha_report.xml similarity index 94% rename from packages/kbn-test/src/failed_tests_reporter/__fixtures__/mocha_report.xml rename to packages/osd-test/src/failed_tests_reporter/__fixtures__/mocha_report.xml index 64cb7ce551ee..1eb18ebdf337 100644 --- a/packages/kbn-test/src/failed_tests_reporter/__fixtures__/mocha_report.xml +++ b/packages/osd-test/src/failed_tests_reporter/__fixtures__/mocha_report.xml @@ -15,7 +15,7 @@ - at Function.getSnapshot (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-intake/node/immutable/kibana/packages/kbn-es/src/artifact.js:95:13) + at Function.getSnapshot (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-intake/node/immutable/kibana/packages/osd-opensearch/src/artifact.js:95:13) at process._tickCallback (internal/process/next_tick.js:68:7)]]> diff --git a/packages/kbn-test/src/failed_tests_reporter/add_messages_to_report.test.ts b/packages/osd-test/src/failed_tests_reporter/add_messages_to_report.test.ts similarity index 99% rename from packages/kbn-test/src/failed_tests_reporter/add_messages_to_report.test.ts rename to packages/osd-test/src/failed_tests_reporter/add_messages_to_report.test.ts index 505e898c62ad..acfd7ddeb6c6 100644 --- a/packages/kbn-test/src/failed_tests_reporter/add_messages_to_report.test.ts +++ b/packages/osd-test/src/failed_tests_reporter/add_messages_to_report.test.ts @@ -19,7 +19,7 @@ import Path from 'path'; -import { ToolingLog } from '@kbn/dev-utils'; +import { ToolingLog } from '@osd/dev-utils'; // @ts-ignore import { createPatch } from 'diff'; @@ -237,7 +237,7 @@ it('rewrites mocha reports with minimal changes', async () => { ‹/body› ‹/html› - at Function.getSnapshot (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-intake/node/immutable/kibana/packages/kbn-es/src/artifact.js:95:13) + at Function.getSnapshot (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-intake/node/immutable/kibana/packages/osd-es/src/artifact.js:95:13) - at process._tickCallback (internal/process/next_tick.js:68:7)]]› - ‹/failure› + at process._tickCallback (internal/process/next_tick.js:68:7) diff --git a/packages/kbn-test/src/failed_tests_reporter/add_messages_to_report.ts b/packages/osd-test/src/failed_tests_reporter/add_messages_to_report.ts similarity index 98% rename from packages/kbn-test/src/failed_tests_reporter/add_messages_to_report.ts rename to packages/osd-test/src/failed_tests_reporter/add_messages_to_report.ts index 27bf8a9c7549..0872c174da1b 100644 --- a/packages/kbn-test/src/failed_tests_reporter/add_messages_to_report.ts +++ b/packages/osd-test/src/failed_tests_reporter/add_messages_to_report.ts @@ -20,7 +20,7 @@ import Fs from 'fs'; import { promisify } from 'util'; -import { ToolingLog } from '@kbn/dev-utils'; +import { ToolingLog } from '@osd/dev-utils'; import xml2js from 'xml2js'; import { TestReport, makeFailedTestCaseIter } from './test_report'; diff --git a/packages/kbn-test/src/failed_tests_reporter/get_failures.test.ts b/packages/osd-test/src/failed_tests_reporter/get_failures.test.ts similarity index 99% rename from packages/kbn-test/src/failed_tests_reporter/get_failures.test.ts rename to packages/osd-test/src/failed_tests_reporter/get_failures.test.ts index f570ed36111b..932834ec4a70 100644 --- a/packages/kbn-test/src/failed_tests_reporter/get_failures.test.ts +++ b/packages/osd-test/src/failed_tests_reporter/get_failures.test.ts @@ -101,7 +101,7 @@ it('discovers failures in mocha report', async () => { - at Function.getSnapshot (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-intake/node/immutable/kibana/packages/kbn-es/src/artifact.js:95:13) + at Function.getSnapshot (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-intake/node/immutable/kibana/packages/osd-opensearch/src/artifact.js:95:13) at process._tickCallback (internal/process/next_tick.js:68:7) ", "likelyIrrelevant": true, diff --git a/packages/kbn-test/src/failed_tests_reporter/get_failures.ts b/packages/osd-test/src/failed_tests_reporter/get_failures.ts similarity index 95% rename from packages/kbn-test/src/failed_tests_reporter/get_failures.ts rename to packages/osd-test/src/failed_tests_reporter/get_failures.ts index be058791f737..8f62d67fa03a 100644 --- a/packages/kbn-test/src/failed_tests_reporter/get_failures.ts +++ b/packages/osd-test/src/failed_tests_reporter/get_failures.ts @@ -62,7 +62,7 @@ const isLikelyIrrelevant = (name: string, failure: string) => { return true; } - if (failure.includes('Unable to fetch Kibana status API response from Kibana')) { + if (failure.includes('Unable to fetch Opensearch Dashboards status API response from Opensearch Dashboards')) { return true; } diff --git a/packages/kbn-test/src/failed_tests_reporter/github_api.ts b/packages/osd-test/src/failed_tests_reporter/github_api.ts similarity index 99% rename from packages/kbn-test/src/failed_tests_reporter/github_api.ts rename to packages/osd-test/src/failed_tests_reporter/github_api.ts index a0e3bcafdf19..a45c0303820d 100644 --- a/packages/kbn-test/src/failed_tests_reporter/github_api.ts +++ b/packages/osd-test/src/failed_tests_reporter/github_api.ts @@ -21,7 +21,7 @@ import Url from 'url'; import Axios, { AxiosRequestConfig, AxiosInstance } from 'axios'; import parseLinkHeader from 'parse-link-header'; -import { ToolingLog, isAxiosResponseError, isAxiosRequestError } from '@kbn/dev-utils'; +import { ToolingLog, isAxiosResponseError, isAxiosRequestError } from '@osd/dev-utils'; const BASE_URL = 'https://api.github.com/repos/elastic/kibana/'; diff --git a/packages/kbn-test/src/failed_tests_reporter/index.ts b/packages/osd-test/src/failed_tests_reporter/index.ts similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/index.ts rename to packages/osd-test/src/failed_tests_reporter/index.ts diff --git a/packages/kbn-test/src/failed_tests_reporter/issue_metadata.test.ts b/packages/osd-test/src/failed_tests_reporter/issue_metadata.test.ts similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/issue_metadata.test.ts rename to packages/osd-test/src/failed_tests_reporter/issue_metadata.test.ts diff --git a/packages/kbn-test/src/failed_tests_reporter/issue_metadata.ts b/packages/osd-test/src/failed_tests_reporter/issue_metadata.ts similarity index 97% rename from packages/kbn-test/src/failed_tests_reporter/issue_metadata.ts rename to packages/osd-test/src/failed_tests_reporter/issue_metadata.ts index e313aefe8a2f..dff3d2813f3a 100644 --- a/packages/kbn-test/src/failed_tests_reporter/issue_metadata.ts +++ b/packages/osd-test/src/failed_tests_reporter/issue_metadata.ts @@ -1,4 +1,4 @@ -/* eslint-disable @kbn/eslint/require-license-header */ +/* eslint-disable @osd/eslint/require-license-header */ /* @notice * This product bundles code based on probot-metadata@1.0.0 which is diff --git a/packages/kbn-test/src/failed_tests_reporter/report_failure.test.ts b/packages/osd-test/src/failed_tests_reporter/report_failure.test.ts similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/report_failure.test.ts rename to packages/osd-test/src/failed_tests_reporter/report_failure.test.ts diff --git a/packages/kbn-test/src/failed_tests_reporter/report_failure.ts b/packages/osd-test/src/failed_tests_reporter/report_failure.ts similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/report_failure.ts rename to packages/osd-test/src/failed_tests_reporter/report_failure.ts diff --git a/packages/kbn-test/src/failed_tests_reporter/report_metadata.test.ts b/packages/osd-test/src/failed_tests_reporter/report_metadata.test.ts similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/report_metadata.test.ts rename to packages/osd-test/src/failed_tests_reporter/report_metadata.test.ts diff --git a/packages/kbn-test/src/failed_tests_reporter/report_metadata.ts b/packages/osd-test/src/failed_tests_reporter/report_metadata.ts similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/report_metadata.ts rename to packages/osd-test/src/failed_tests_reporter/report_metadata.ts diff --git a/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts b/packages/osd-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts similarity index 98% rename from packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts rename to packages/osd-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts index 93616ce78a04..560deb5ee641 100644 --- a/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts +++ b/packages/osd-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts @@ -19,8 +19,8 @@ import Path from 'path'; -import { REPO_ROOT } from '@kbn/utils'; -import { run, createFailError, createFlagError } from '@kbn/dev-utils'; +import { REPO_ROOT } from '@osd/utils'; +import { run, createFailError, createFlagError } from '@osd/dev-utils'; import globby from 'globby'; import { getFailures, TestFailure } from './get_failures'; diff --git a/packages/kbn-test/src/failed_tests_reporter/test_report.ts b/packages/osd-test/src/failed_tests_reporter/test_report.ts similarity index 100% rename from packages/kbn-test/src/failed_tests_reporter/test_report.ts rename to packages/osd-test/src/failed_tests_reporter/test_report.ts From eb926840caae87258d532763e29090df4f1c9232 Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Fri, 12 Mar 2021 01:12:18 +0000 Subject: [PATCH 4/4] [Rename] addressed review feedbacks --- packages/osd-test/src/failed_tests_reporter/issue_metadata.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/osd-test/src/failed_tests_reporter/issue_metadata.ts b/packages/osd-test/src/failed_tests_reporter/issue_metadata.ts index dff3d2813f3a..7fb8148a5b2a 100644 --- a/packages/osd-test/src/failed_tests_reporter/issue_metadata.ts +++ b/packages/osd-test/src/failed_tests_reporter/issue_metadata.ts @@ -29,7 +29,7 @@ * `prefix` is a string that can be used to namespace the metadata, defaults to `ci`. */ const PREFIX = 'failed-test'; -const REGEX = /\n\n/; +const REGEX = /\n\n/; function safeJsonParse(json: string, onError: any) { try { @@ -65,5 +65,5 @@ export function updateIssueMetadata(body: string, values: Record) { }); } - return `${body}\n\n`; + return `${body}\n\n`; }