From 95d0d28ae3c8e862ac5bf360ac29c331cd92dc04 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 17 Aug 2023 12:25:05 +0200 Subject: [PATCH 01/24] added smoke test --- .../jest.integration.config.js | 13 +++++++++ .../src/zdt/integration_tests/smoke.test.ts | 22 +++++++++++++++ .../core-test-helpers-kbn-server/index.ts | 9 ++++++- .../src/create_serverless_root.ts | 27 +++++++++++++++++++ .../core-test-helpers-kbn-server/src/index.ts | 3 +++ 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.integration.config.js create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts create mode 100644 packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.integration.config.js b/packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.integration.config.js new file mode 100644 index 0000000000000..199da769236ba --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.integration.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_integration_node', + rootDir: '../../../..', + roots: ['/packages/core/saved-objects/core-saved-objects-migration-server-internal'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts new file mode 100644 index 0000000000000..746b18f96f5c5 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { createServerlessES, TestServerlessESUtils } from '@kbn/core-test-helpers-kbn-server'; + +describe('smoke', () => { + let serverlessES: TestServerlessESUtils; + beforeEach(() => { + serverlessES = createServerlessES(); + }); + afterEach(async () => { + await serverlessES?.stop(); + }); + test('it can start ES serverless', async () => { + expect(true).toBe(true); + }); +}); diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts index a9a992daae212..a4785cb4fbb56 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts @@ -12,7 +12,14 @@ export { createRoot, createRootWithCorePlugins, createTestServers, + createServerlessES, request, } from './src'; -export type { HttpMethod, TestElasticsearchUtils, TestKibanaUtils, TestUtils } from './src'; +export type { + HttpMethod, + TestElasticsearchUtils, + TestKibanaUtils, + TestUtils, + TestServerlessESUtils, +} from './src'; diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts new file mode 100644 index 0000000000000..9d489878194c2 --- /dev/null +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { Cluster } from '@kbn/es'; +import { ToolingLog } from '@kbn/tooling-log'; +import execa from 'execa'; + +export type TestServerlessESUtils = ReturnType; + +export const createServerlessES = () => { + const log = new ToolingLog(); + const cluster = new Cluster({ log }); + return { + start: async () => { + await cluster.runServerless(); + }, + stop: async () => { + // hack to stop the ES cluster + await execa('docker', ['container stop es01 es02 es03']); + }, + }; +}; diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts index 7a8e231066f8b..9f88564d6e9f4 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts @@ -15,4 +15,7 @@ export { request, } from './create_root'; +export { createServerlessES } from './create_serverless_root'; +export type { TestServerlessESUtils } from './create_serverless_root'; + export type { HttpMethod, TestElasticsearchUtils, TestKibanaUtils, TestUtils } from './create_root'; From 0263712164d19007adf52a2397455d919d953795 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 17 Aug 2023 10:33:00 +0000 Subject: [PATCH 02/24] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- .../core-saved-objects-migration-server-internal/tsconfig.json | 1 + .../core/test-helpers/core-test-helpers-kbn-server/tsconfig.json | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json b/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json index 7a7583be64ab3..3a4fd4cec5089 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json @@ -32,6 +32,7 @@ "@kbn/core-saved-objects-base-server-mocks", "@kbn/core-elasticsearch-server-internal", "@kbn/core-node-server", + "@kbn/core-test-helpers-kbn-server", ], "exclude": [ "target/**/*", diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/tsconfig.json b/packages/core/test-helpers/core-test-helpers-kbn-server/tsconfig.json index b5342c23fba2b..8afae2b7d74c3 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/tsconfig.json +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/tsconfig.json @@ -18,6 +18,7 @@ "@kbn/core-root-server-internal", "@kbn/repo-info", "@kbn/repo-packages", + "@kbn/es", ], "exclude": [ "target/**/*", From 6574294c90ada810b54e199ab0f3b95d0279c521 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 17 Aug 2023 13:27:17 +0200 Subject: [PATCH 03/24] fix some issues and start Kibana in serverless mode --- .../src/zdt/integration_tests/smoke.test.ts | 24 ++++++++++-- .../core-test-helpers-kbn-server/index.ts | 2 + .../src/create_serverless_root.ts | 39 ++++++++++++++++--- .../core-test-helpers-kbn-server/src/index.ts | 4 +- 4 files changed, 59 insertions(+), 10 deletions(-) diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts index 746b18f96f5c5..5d6ddc5bbefdb 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts @@ -6,17 +6,35 @@ * Side Public License, v 1. */ -import { createServerlessES, TestServerlessESUtils } from '@kbn/core-test-helpers-kbn-server'; +import { + createServerlessES, + createServerlessKibana, + TestServerlessESUtils, + TestServerlessKibanaUtils, + request, +} from '@kbn/core-test-helpers-kbn-server'; describe('smoke', () => { let serverlessES: TestServerlessESUtils; + let serverlessKibana: TestServerlessKibanaUtils; + jest.setTimeout(60_000); beforeEach(() => { serverlessES = createServerlessES(); + serverlessKibana = createServerlessKibana(); }); afterEach(async () => { await serverlessES?.stop(); + await serverlessKibana?.shutdown(); }); - test('it can start ES serverless', async () => { - expect(true).toBe(true); + test('it can start Kibana and ES serverless', async () => { + async function doIt() { + await serverlessES.start(); + await serverlessKibana.preboot(); + await serverlessKibana.setup(); + await serverlessKibana.start(); + } + await expect(doIt()).resolves.toBe(undefined); + const { body } = await request.get(serverlessKibana, '/api/status').expect(200); + expect(body).toMatchObject({ status: { overall: { level: 'available' } } }); }); }); diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts index a4785cb4fbb56..68b756f4f9166 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts @@ -13,6 +13,7 @@ export { createRootWithCorePlugins, createTestServers, createServerlessES, + createServerlessKibana, request, } from './src'; @@ -22,4 +23,5 @@ export type { TestKibanaUtils, TestUtils, TestServerlessESUtils, + TestServerlessKibanaUtils, } from './src'; diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts index 9d489878194c2..298ed04c22d31 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts @@ -5,23 +5,52 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ - +import { defaultsDeep } from 'lodash'; import { Cluster } from '@kbn/es'; +import Path from 'path'; +import { REPO_ROOT } from '@kbn/repo-info'; import { ToolingLog } from '@kbn/tooling-log'; import execa from 'execa'; +import { CliArgs } from '@kbn/config'; +import { createRoot } from './create_root'; export type TestServerlessESUtils = ReturnType; export const createServerlessES = () => { - const log = new ToolingLog(); + const log = new ToolingLog({ + level: 'info', + writeTo: process.stdout, + }); const cluster = new Cluster({ log }); - return { + const api = { start: async () => { - await cluster.runServerless(); + await Promise.race([ + cluster.runServerless({ + basePath: Path.join(REPO_ROOT, '.es/es_test_serverless'), + }), + new Promise((res) => setTimeout(res, 60000)), + ]); }, stop: async () => { // hack to stop the ES cluster - await execa('docker', ['container stop es01 es02 es03']); + await execa('docker', ['container', 'stop', 'es01', 'es02', 'es03']); }, }; + + return api; +}; + +export type TestServerlessKibanaUtils = ReturnType; + +export const createServerlessKibana = (settings = {}, cliArgs: Partial = {}) => { + const defaults = { + server: { + port: 5620, + }, + elasticsearch: { + serviceAccountToken: 'BEEF', + }, + }; + + return createRoot(defaultsDeep(settings, defaults), { ...cliArgs, serverless: true }); }; diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts index 9f88564d6e9f4..76aafe7e1f898 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts @@ -15,7 +15,7 @@ export { request, } from './create_root'; -export { createServerlessES } from './create_serverless_root'; -export type { TestServerlessESUtils } from './create_serverless_root'; +export { createServerlessES, createServerlessKibana } from './create_serverless_root'; +export type { TestServerlessESUtils, TestServerlessKibanaUtils } from './create_serverless_root'; export type { HttpMethod, TestElasticsearchUtils, TestKibanaUtils, TestUtils } from './create_root'; From 67ba9491a242cd3ccf9c291517912c29c424dac3 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 17 Aug 2023 13:36:15 +0200 Subject: [PATCH 04/24] make start ES more robust... --- .../src/create_serverless_root.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts index 298ed04c22d31..9b264a157894a 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts @@ -22,13 +22,25 @@ export const createServerlessES = () => { writeTo: process.stdout, }); const cluster = new Cluster({ log }); + + let started = false; const api = { start: async () => { + if (started) throw new Error('ES already started!'); await Promise.race([ - cluster.runServerless({ - basePath: Path.join(REPO_ROOT, '.es/es_test_serverless'), + cluster + .runServerless({ + basePath: Path.join(REPO_ROOT, '.es/es_test_serverless'), + }) + .then(() => { + started = true; + }), + new Promise((res) => setTimeout(res, 60000)).then(async () => { + if (!started) { + await api.stop().catch(() => undefined); + throw new Error(`could not start ES serverless in 60 seconds ( ,_,)`); + } }), - new Promise((res) => setTimeout(res, 60000)), ]); }, stop: async () => { From cee9fed683f94d364569900f1051f5c5dd7395f3 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 17 Aug 2023 14:38:05 +0200 Subject: [PATCH 05/24] log in to docker --- .buildkite/scripts/steps/code_coverage/jest_integration.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.buildkite/scripts/steps/code_coverage/jest_integration.sh b/.buildkite/scripts/steps/code_coverage/jest_integration.sh index cb59d15c612fc..892f476a7fc48 100755 --- a/.buildkite/scripts/steps/code_coverage/jest_integration.sh +++ b/.buildkite/scripts/steps/code_coverage/jest_integration.sh @@ -5,6 +5,8 @@ set -euo pipefail source .buildkite/scripts/common/util.sh source .buildkite/scripts/steps/code_coverage/util.sh +echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co + is_test_execution_step .buildkite/scripts/bootstrap.sh From 4c5f8d61fe6866fec2b4aa69fb9b15c717f2dae1 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 17 Aug 2023 15:54:06 +0200 Subject: [PATCH 06/24] log in to docker --- .buildkite/scripts/steps/code_coverage/jest_integration.sh | 2 -- .buildkite/scripts/steps/test/jest_integration.sh | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/steps/code_coverage/jest_integration.sh b/.buildkite/scripts/steps/code_coverage/jest_integration.sh index 892f476a7fc48..cb59d15c612fc 100755 --- a/.buildkite/scripts/steps/code_coverage/jest_integration.sh +++ b/.buildkite/scripts/steps/code_coverage/jest_integration.sh @@ -5,8 +5,6 @@ set -euo pipefail source .buildkite/scripts/common/util.sh source .buildkite/scripts/steps/code_coverage/util.sh -echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co - is_test_execution_step .buildkite/scripts/bootstrap.sh diff --git a/.buildkite/scripts/steps/test/jest_integration.sh b/.buildkite/scripts/steps/test/jest_integration.sh index fd7b9a1d6ad54..275784b2c16cb 100755 --- a/.buildkite/scripts/steps/test/jest_integration.sh +++ b/.buildkite/scripts/steps/test/jest_integration.sh @@ -8,5 +8,9 @@ is_test_execution_step .buildkite/scripts/bootstrap.sh +echo '--- Log in to docker' +echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co + + echo '--- Jest Integration Tests' .buildkite/scripts/steps/test/jest_parallel.sh jest.integration.config.js From 9ebb55df86a75729e89a7f29c2ee5279e8c4b094 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 17 Aug 2023 18:09:56 +0200 Subject: [PATCH 07/24] longer timeout --- .../src/zdt/integration_tests/smoke.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts index 5d6ddc5bbefdb..d37f888e13fbd 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts @@ -17,7 +17,7 @@ import { describe('smoke', () => { let serverlessES: TestServerlessESUtils; let serverlessKibana: TestServerlessKibanaUtils; - jest.setTimeout(60_000); + jest.setTimeout(180_000); beforeEach(() => { serverlessES = createServerlessES(); serverlessKibana = createServerlessKibana(); From 51301794e984c3b9b06d459e745a69f9f5598075 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 17 Aug 2023 23:43:22 +0200 Subject: [PATCH 08/24] move to test file to src/core --- .../jest.integration.config.js | 13 ------------- .../serverless/jest.integration.config.js | 19 +++++++++++++++++++ .../migrations/serverless}/smoke.test.ts | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-) delete mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.integration.config.js create mode 100644 src/core/server/integration_tests/saved_objects/migrations/serverless/jest.integration.config.js rename {packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests => src/core/server/integration_tests/saved_objects/migrations/serverless}/smoke.test.ts (96%) diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.integration.config.js b/packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.integration.config.js deleted file mode 100644 index 199da769236ba..0000000000000 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.integration.config.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -module.exports = { - preset: '@kbn/test/jest_integration_node', - rootDir: '../../../..', - roots: ['/packages/core/saved-objects/core-saved-objects-migration-server-internal'], -}; diff --git a/src/core/server/integration_tests/saved_objects/migrations/serverless/jest.integration.config.js b/src/core/server/integration_tests/saved_objects/migrations/serverless/jest.integration.config.js new file mode 100644 index 0000000000000..47be0f99f42b9 --- /dev/null +++ b/src/core/server/integration_tests/saved_objects/migrations/serverless/jest.integration.config.js @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + // TODO replace the line below with + // preset: '@kbn/test/jest_integration_node + // to do so, we must fix all integration tests first + // see https://github.com/elastic/kibana/pull/130255/ + preset: '@kbn/test/jest_integration', + rootDir: '../../../../../../..', + roots: ['/src/core/server/integration_tests/saved_objects/migrations/serverless'], + // must override to match all test given there is no `integration_tests` subfolder + testMatch: ['**/*.test.{js,mjs,ts,tsx}'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts b/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts similarity index 96% rename from packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts rename to src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts index d37f888e13fbd..1b8d0e607f085 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/integration_tests/smoke.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts @@ -17,7 +17,7 @@ import { describe('smoke', () => { let serverlessES: TestServerlessESUtils; let serverlessKibana: TestServerlessKibanaUtils; - jest.setTimeout(180_000); + jest.setTimeout(300_000); // five mins :shrug: beforeEach(() => { serverlessES = createServerlessES(); serverlessKibana = createServerlessKibana(); From 3319e5fc8539e94e2c07f3877f1537d154837e00 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 17 Aug 2023 23:45:28 +0200 Subject: [PATCH 09/24] remove circular deps --- .../core-saved-objects-migration-server-internal/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json b/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json index 3a4fd4cec5089..7a7583be64ab3 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json @@ -32,7 +32,6 @@ "@kbn/core-saved-objects-base-server-mocks", "@kbn/core-elasticsearch-server-internal", "@kbn/core-node-server", - "@kbn/core-test-helpers-kbn-server", ], "exclude": [ "target/**/*", From 6fcf0452366161daf866afeb1cf1965a38835db9 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Mon, 21 Aug 2023 10:28:45 +0200 Subject: [PATCH 10/24] added logs --- .../saved_objects/migrations/serverless/smoke.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts b/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts index 1b8d0e607f085..dfb164b113d85 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts @@ -29,9 +29,13 @@ describe('smoke', () => { test('it can start Kibana and ES serverless', async () => { async function doIt() { await serverlessES.start(); + console.log('ES STARTED'); await serverlessKibana.preboot(); + console.log('KIBANA PREBOOTED'); await serverlessKibana.setup(); + console.log('KIBANA SETUP'); await serverlessKibana.start(); + console.log('KIBANA STARTED'); } await expect(doIt()).resolves.toBe(undefined); const { body } = await request.get(serverlessKibana, '/api/status').expect(200); From 0efae80186ec7049fe4d34bff9b79f5815ce1619 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Mon, 21 Aug 2023 10:45:23 +0200 Subject: [PATCH 11/24] [temp] enable console logs --- packages/kbn-test/src/jest/setup/disable_console_logs.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/kbn-test/src/jest/setup/disable_console_logs.js b/packages/kbn-test/src/jest/setup/disable_console_logs.js index 8ed12141e9a4f..e2d6b6f72667c 100644 --- a/packages/kbn-test/src/jest/setup/disable_console_logs.js +++ b/packages/kbn-test/src/jest/setup/disable_console_logs.js @@ -7,6 +7,6 @@ */ // on CI these logs just muddy up the console and produce a ton of unnecessary noise -console.log = () => {}; -console.error = () => {}; -console.warn = () => {}; +// console.log = () => {}; +// console.error = () => {}; +// console.warn = () => {}; From 6446381c5972f40938613f8faf241bc8bc43972c Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Mon, 21 Aug 2023 11:02:08 +0200 Subject: [PATCH 12/24] simplify, longer timeout, more logs --- .../src/create_serverless_root.ts | 20 +++---------------- .../migrations/serverless/smoke.test.ts | 3 ++- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts index 9b264a157894a..92ecfda6302d7 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts @@ -23,25 +23,11 @@ export const createServerlessES = () => { }); const cluster = new Cluster({ log }); - let started = false; const api = { start: async () => { - if (started) throw new Error('ES already started!'); - await Promise.race([ - cluster - .runServerless({ - basePath: Path.join(REPO_ROOT, '.es/es_test_serverless'), - }) - .then(() => { - started = true; - }), - new Promise((res) => setTimeout(res, 60000)).then(async () => { - if (!started) { - await api.stop().catch(() => undefined); - throw new Error(`could not start ES serverless in 60 seconds ( ,_,)`); - } - }), - ]); + await cluster.runServerless({ + basePath: Path.join(REPO_ROOT, '.es/es_test_serverless'), + }); }, stop: async () => { // hack to stop the ES cluster diff --git a/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts b/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts index dfb164b113d85..ece87fdd38b41 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts @@ -17,7 +17,7 @@ import { describe('smoke', () => { let serverlessES: TestServerlessESUtils; let serverlessKibana: TestServerlessKibanaUtils; - jest.setTimeout(300_000); // five mins :shrug: + jest.setTimeout(600_000); beforeEach(() => { serverlessES = createServerlessES(); serverlessKibana = createServerlessKibana(); @@ -28,6 +28,7 @@ describe('smoke', () => { }); test('it can start Kibana and ES serverless', async () => { async function doIt() { + console.log('ES STARTING'); await serverlessES.start(); console.log('ES STARTED'); await serverlessKibana.preboot(); From cf66e67b131fa90b5b59cc018fe43328d3991947 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Mon, 21 Aug 2023 12:13:07 +0200 Subject: [PATCH 13/24] add bash trap cmd --- .buildkite/scripts/steps/test/jest_integration.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/scripts/steps/test/jest_integration.sh b/.buildkite/scripts/steps/test/jest_integration.sh index 275784b2c16cb..66b0133e14907 100755 --- a/.buildkite/scripts/steps/test/jest_integration.sh +++ b/.buildkite/scripts/steps/test/jest_integration.sh @@ -10,6 +10,7 @@ is_test_execution_step echo '--- Log in to docker' echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co +trap 'docker logout docker.elastic.co' EXIT echo '--- Jest Integration Tests' From d336c1e83731644d0943763e02768455ff59fe87 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 23 Aug 2023 14:54:42 +0200 Subject: [PATCH 14/24] revert console overrides and docker login --- .buildkite/scripts/steps/test/jest_integration.sh | 5 ----- packages/kbn-test/src/jest/setup/disable_console_logs.js | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.buildkite/scripts/steps/test/jest_integration.sh b/.buildkite/scripts/steps/test/jest_integration.sh index 66b0133e14907..fd7b9a1d6ad54 100755 --- a/.buildkite/scripts/steps/test/jest_integration.sh +++ b/.buildkite/scripts/steps/test/jest_integration.sh @@ -8,10 +8,5 @@ is_test_execution_step .buildkite/scripts/bootstrap.sh -echo '--- Log in to docker' -echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co -trap 'docker logout docker.elastic.co' EXIT - - echo '--- Jest Integration Tests' .buildkite/scripts/steps/test/jest_parallel.sh jest.integration.config.js diff --git a/packages/kbn-test/src/jest/setup/disable_console_logs.js b/packages/kbn-test/src/jest/setup/disable_console_logs.js index e2d6b6f72667c..8ed12141e9a4f 100644 --- a/packages/kbn-test/src/jest/setup/disable_console_logs.js +++ b/packages/kbn-test/src/jest/setup/disable_console_logs.js @@ -7,6 +7,6 @@ */ // on CI these logs just muddy up the console and produce a ton of unnecessary noise -// console.log = () => {}; -// console.error = () => {}; -// console.warn = () => {}; +console.log = () => {}; +console.error = () => {}; +console.warn = () => {}; From 11d496ae931885307eca48541f168862bb0e55c9 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 23 Aug 2023 14:56:43 +0200 Subject: [PATCH 15/24] tiny refactor --- .../src/create_serverless_root.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts index 92ecfda6302d7..c04e5026c7b81 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts @@ -40,15 +40,14 @@ export const createServerlessES = () => { export type TestServerlessKibanaUtils = ReturnType; +const defaults = { + server: { + port: 5620, + }, + elasticsearch: { + serviceAccountToken: 'BEEF', + }, +}; export const createServerlessKibana = (settings = {}, cliArgs: Partial = {}) => { - const defaults = { - server: { - port: 5620, - }, - elasticsearch: { - serviceAccountToken: 'BEEF', - }, - }; - return createRoot(defaultsDeep(settings, defaults), { ...cliArgs, serverless: true }); }; From 56b80f2fd1ce8b66d9edb5933d64fb6b071c1de6 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 23 Aug 2023 14:58:37 +0200 Subject: [PATCH 16/24] move smoke to new dir --- .../migrations}/jest.integration.config.js | 0 .../serverless => serverless/migrations}/smoke.test.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/core/server/integration_tests/saved_objects/{migrations/serverless => serverless/migrations}/jest.integration.config.js (100%) rename src/core/server/integration_tests/saved_objects/{migrations/serverless => serverless/migrations}/smoke.test.ts (100%) diff --git a/src/core/server/integration_tests/saved_objects/migrations/serverless/jest.integration.config.js b/src/core/server/integration_tests/saved_objects/serverless/migrations/jest.integration.config.js similarity index 100% rename from src/core/server/integration_tests/saved_objects/migrations/serverless/jest.integration.config.js rename to src/core/server/integration_tests/saved_objects/serverless/migrations/jest.integration.config.js diff --git a/src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts similarity index 100% rename from src/core/server/integration_tests/saved_objects/migrations/serverless/smoke.test.ts rename to src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts From 60b28ed18e96e813f467ddc23e183126515fba45 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 23 Aug 2023 14:58:56 +0200 Subject: [PATCH 17/24] delete console logs --- .../saved_objects/serverless/migrations/smoke.test.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts index ece87fdd38b41..255c1940d398e 100644 --- a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts +++ b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts @@ -28,15 +28,10 @@ describe('smoke', () => { }); test('it can start Kibana and ES serverless', async () => { async function doIt() { - console.log('ES STARTING'); await serverlessES.start(); - console.log('ES STARTED'); await serverlessKibana.preboot(); - console.log('KIBANA PREBOOTED'); await serverlessKibana.setup(); - console.log('KIBANA SETUP'); await serverlessKibana.start(); - console.log('KIBANA STARTED'); } await expect(doIt()).resolves.toBe(undefined); const { body } = await request.get(serverlessKibana, '/api/status').expect(200); From f8429e7c2e0a32dbcdd3840e557dd499b88e1862 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 23 Aug 2023 15:01:03 +0200 Subject: [PATCH 18/24] fix roots --- .../serverless/migrations/jest.integration.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/server/integration_tests/saved_objects/serverless/migrations/jest.integration.config.js b/src/core/server/integration_tests/saved_objects/serverless/migrations/jest.integration.config.js index 47be0f99f42b9..7341478b60a69 100644 --- a/src/core/server/integration_tests/saved_objects/serverless/migrations/jest.integration.config.js +++ b/src/core/server/integration_tests/saved_objects/serverless/migrations/jest.integration.config.js @@ -13,7 +13,7 @@ module.exports = { // see https://github.com/elastic/kibana/pull/130255/ preset: '@kbn/test/jest_integration', rootDir: '../../../../../../..', - roots: ['/src/core/server/integration_tests/saved_objects/migrations/serverless'], + roots: ['/src/core/server/integration_tests/saved_objects/serverless/migrations'], // must override to match all test given there is no `integration_tests` subfolder testMatch: ['**/*.test.{js,mjs,ts,tsx}'], }; From 5d8c454e73d33fd3c867a9eb8d8c5ef6dc252909 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 23 Aug 2023 15:34:21 +0200 Subject: [PATCH 19/24] refactor to match contract of existing jest integration utils --- .../core-test-helpers-kbn-server/index.ts | 3 +- .../src/create_serverless_root.ts | 70 ++++++++++++++----- .../core-test-helpers-kbn-server/src/index.ts | 9 ++- .../serverless/migrations/smoke.test.ts | 28 ++++---- 4 files changed, 72 insertions(+), 38 deletions(-) diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts index 68b756f4f9166..eac1a3472ebb4 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/index.ts @@ -12,8 +12,7 @@ export { createRoot, createRootWithCorePlugins, createTestServers, - createServerlessES, - createServerlessKibana, + createTestServerlessInstances, request, } from './src'; diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts index c04e5026c7b81..151260f1c87c1 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts @@ -12,33 +12,67 @@ import { REPO_ROOT } from '@kbn/repo-info'; import { ToolingLog } from '@kbn/tooling-log'; import execa from 'execa'; import { CliArgs } from '@kbn/config'; -import { createRoot } from './create_root'; +import { createRoot, type TestElasticsearchUtils, type TestKibanaUtils } from './create_root'; -export type TestServerlessESUtils = ReturnType; +export type TestServerlessESUtils = Pick; +export type TestServerlessKibanaUtils = TestKibanaUtils; +export interface TestServerlessUtils { + startES: () => Promise; + startKibana: (abortSignal?: AbortSignal) => Promise; +} -export const createServerlessES = () => { +export function createTestServerlessInstances({ + adjustTimeout, +}: { + adjustTimeout: (timeout: number) => void; +}): TestServerlessUtils { + const esUtils = createServerlessES(); + const kbUtils = createServerlessKibana(); + adjustTimeout?.(120_000); + return { + startES: async () => { + const { stop } = await esUtils.start(); + return { + es: esUtils.es, + stop, + }; + }, + startKibana: async (abortSignal) => { + abortSignal?.addEventListener('abort', async () => await kbUtils.shutdown()); + await kbUtils.preboot(); + const coreSetup = await kbUtils.setup(); + const coreStart = await kbUtils.start(); + return { + root: kbUtils, + coreSetup, + coreStart, + stop: kbUtils.shutdown.bind(kbUtils), + }; + }, + }; +} + +function createServerlessES() { const log = new ToolingLog({ level: 'info', writeTo: process.stdout, }); - const cluster = new Cluster({ log }); - - const api = { + const es = new Cluster({ log }); + return { + es, start: async () => { - await cluster.runServerless({ + await es.runServerless({ basePath: Path.join(REPO_ROOT, '.es/es_test_serverless'), }); - }, - stop: async () => { - // hack to stop the ES cluster - await execa('docker', ['container', 'stop', 'es01', 'es02', 'es03']); + return { + stop: async () => { + // hack to stop the ES cluster + await execa('docker', ['container', 'stop', 'es01', 'es02', 'es03']); + }, + }; }, }; - - return api; -}; - -export type TestServerlessKibanaUtils = ReturnType; +} const defaults = { server: { @@ -48,6 +82,6 @@ const defaults = { serviceAccountToken: 'BEEF', }, }; -export const createServerlessKibana = (settings = {}, cliArgs: Partial = {}) => { +function createServerlessKibana(settings = {}, cliArgs: Partial = {}) { return createRoot(defaultsDeep(settings, defaults), { ...cliArgs, serverless: true }); -}; +} diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts index 76aafe7e1f898..6fb64a34a0035 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/index.ts @@ -15,7 +15,12 @@ export { request, } from './create_root'; -export { createServerlessES, createServerlessKibana } from './create_serverless_root'; -export type { TestServerlessESUtils, TestServerlessKibanaUtils } from './create_serverless_root'; +export { createTestServerlessInstances } from './create_serverless_root'; + +export type { + TestServerlessUtils, + TestServerlessESUtils, + TestServerlessKibanaUtils, +} from './create_serverless_root'; export type { HttpMethod, TestElasticsearchUtils, TestKibanaUtils, TestUtils } from './create_root'; diff --git a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts index 255c1940d398e..1d884706fc8ba 100644 --- a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts +++ b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts @@ -7,34 +7,30 @@ */ import { - createServerlessES, - createServerlessKibana, + request, TestServerlessESUtils, TestServerlessKibanaUtils, - request, + createTestServerlessInstances, } from '@kbn/core-test-helpers-kbn-server'; describe('smoke', () => { let serverlessES: TestServerlessESUtils; let serverlessKibana: TestServerlessKibanaUtils; - jest.setTimeout(600_000); - beforeEach(() => { - serverlessES = createServerlessES(); - serverlessKibana = createServerlessKibana(); + let root: TestServerlessKibanaUtils['root']; + beforeEach(async () => { + const { startES, startKibana } = createTestServerlessInstances({ + adjustTimeout: jest.setTimeout, + }); + serverlessES = await startES(); + serverlessKibana = await startKibana(); + root = serverlessKibana.root; }); afterEach(async () => { await serverlessES?.stop(); - await serverlessKibana?.shutdown(); + await serverlessKibana?.stop(); }); test('it can start Kibana and ES serverless', async () => { - async function doIt() { - await serverlessES.start(); - await serverlessKibana.preboot(); - await serverlessKibana.setup(); - await serverlessKibana.start(); - } - await expect(doIt()).resolves.toBe(undefined); - const { body } = await request.get(serverlessKibana, '/api/status').expect(200); + const { body } = await request.get(root, '/api/status').expect(200); expect(body).toMatchObject({ status: { overall: { level: 'available' } } }); }); }); From 8157d88e53db99725788803d3c5ea8f53e51ae58 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 23 Aug 2023 15:35:08 +0200 Subject: [PATCH 20/24] added comment about skipped test --- .../saved_objects/serverless/migrations/smoke.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts index 1d884706fc8ba..940ea4a160cb6 100644 --- a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts +++ b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts @@ -13,7 +13,10 @@ import { createTestServerlessInstances, } from '@kbn/core-test-helpers-kbn-server'; -describe('smoke', () => { +/** + * Until we merge https://github.com/elastic/kibana/pull/162673 this test should remain skipped. + */ +describe.skip('smoke', () => { let serverlessES: TestServerlessESUtils; let serverlessKibana: TestServerlessKibanaUtils; let root: TestServerlessKibanaUtils['root']; From 3cad9bb287b839e52a4bf407cdd3afe0663306b2 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 24 Aug 2023 10:40:28 +0200 Subject: [PATCH 21/24] added a doc comment --- .../src/create_serverless_root.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts index 151260f1c87c1..d8acd32c3cda8 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts @@ -21,6 +21,12 @@ export interface TestServerlessUtils { startKibana: (abortSignal?: AbortSignal) => Promise; } +/** + * See docs in {@link TestUtils}. This function provides the same utilities but + * configured serverless. + * + * @note requires a Docker installation to be running + */ export function createTestServerlessInstances({ adjustTimeout, }: { From f0cd6a4eb855b7700918d20f4c87ce9e0af6ae5b Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 24 Aug 2023 10:42:42 +0200 Subject: [PATCH 22/24] fix typo --- .../core-test-helpers-kbn-server/src/create_serverless_root.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts index d8acd32c3cda8..43d5619f89200 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts @@ -23,7 +23,7 @@ export interface TestServerlessUtils { /** * See docs in {@link TestUtils}. This function provides the same utilities but - * configured serverless. + * configured for serverless. * * @note requires a Docker installation to be running */ From 40037b4df387bfc8585121672bd3601f3ec6615b Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 24 Aug 2023 11:52:15 +0200 Subject: [PATCH 23/24] added some serverless options --- .../src/create_serverless_root.ts | 9 ++++++++- .../saved_objects/serverless/migrations/smoke.test.ts | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts index 43d5619f89200..0ff24ed58af09 100644 --- a/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts +++ b/packages/core/test-helpers/core-test-helpers-kbn-server/src/create_serverless_root.ts @@ -82,7 +82,14 @@ function createServerlessES() { const defaults = { server: { - port: 5620, + restrictInternalApis: true, + versioned: { + versionResolution: 'newest', + strictClientVersionCheck: false, + }, + }, + migrations: { + algorithm: 'zdt', }, elasticsearch: { serviceAccountToken: 'BEEF', diff --git a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts index 940ea4a160cb6..9bf6eb9de9b04 100644 --- a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts +++ b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts @@ -16,7 +16,7 @@ import { /** * Until we merge https://github.com/elastic/kibana/pull/162673 this test should remain skipped. */ -describe.skip('smoke', () => { +describe('smoke', () => { let serverlessES: TestServerlessESUtils; let serverlessKibana: TestServerlessKibanaUtils; let root: TestServerlessKibanaUtils['root']; From 718e7f091b95e400f254909b14903e47f80c5514 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 24 Aug 2023 11:54:12 +0200 Subject: [PATCH 24/24] keep it skipped --- .../saved_objects/serverless/migrations/smoke.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts index 9bf6eb9de9b04..940ea4a160cb6 100644 --- a/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts +++ b/src/core/server/integration_tests/saved_objects/serverless/migrations/smoke.test.ts @@ -16,7 +16,7 @@ import { /** * Until we merge https://github.com/elastic/kibana/pull/162673 this test should remain skipped. */ -describe('smoke', () => { +describe.skip('smoke', () => { let serverlessES: TestServerlessESUtils; let serverlessKibana: TestServerlessKibanaUtils; let root: TestServerlessKibanaUtils['root'];