From 577efa9919ea30c11cb4fafee76042078d83eeff Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Mon, 4 Nov 2024 13:41:31 -0500 Subject: [PATCH 1/4] Add registry config for failing Jest integration tests + unskip --- .../integration_tests/cloud_preconfiguration.test.ts | 2 +- .../integration_tests/fixtures/cloud_kibana_config.ts | 5 +++++ .../fleet/server/integration_tests/ha_setup.test.ts | 7 ++++++- .../integration_tests/reset_preconfiguration.test.ts | 7 ++++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts b/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts index 9d529738aa6da..de5a04eb48afd 100644 --- a/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts @@ -31,7 +31,7 @@ import { const logFilePath = Path.join(__dirname, 'logs.log'); // Failing 9.0 version update: https://github.com/elastic/kibana/issues/192624 -describe.skip('Fleet cloud preconfiguration', () => { +describe('Fleet cloud preconfiguration', () => { let esServer: TestElasticsearchUtils; let kbnServer: TestKibanaUtils; diff --git a/x-pack/plugins/fleet/server/integration_tests/fixtures/cloud_kibana_config.ts b/x-pack/plugins/fleet/server/integration_tests/fixtures/cloud_kibana_config.ts index fa9770a58f44e..da1a0a9a68386 100644 --- a/x-pack/plugins/fleet/server/integration_tests/fixtures/cloud_kibana_config.ts +++ b/x-pack/plugins/fleet/server/integration_tests/fixtures/cloud_kibana_config.ts @@ -8,6 +8,11 @@ export const CLOUD_KIBANA_CONFIG = { xpack: { fleet: { + internal: { + registry: { + kibanaVersionCheckEnabled: false, + }, + }, packages: [ { name: 'apm', diff --git a/x-pack/plugins/fleet/server/integration_tests/ha_setup.test.ts b/x-pack/plugins/fleet/server/integration_tests/ha_setup.test.ts index c0405b2523fa7..1d34153fab262 100644 --- a/x-pack/plugins/fleet/server/integration_tests/ha_setup.test.ts +++ b/x-pack/plugins/fleet/server/integration_tests/ha_setup.test.ts @@ -91,7 +91,7 @@ const createAndSetupRoot = async (config?: object) => { * Verifies that multiple Kibana instances running in parallel will not create duplicate preconfiguration objects. */ // Failing 9.0 version update: https://github.com/elastic/kibana/issues/192624 -describe.skip('Fleet setup preconfiguration with multiple instances Kibana', () => { +describe('Fleet setup preconfiguration with multiple instances Kibana', () => { let esServer: TestElasticsearchUtils; // let esClient: Client; let roots: Root[] = []; @@ -175,6 +175,11 @@ describe.skip('Fleet setup preconfiguration with multiple instances Kibana', () const preconfiguration = { registryUrl, + internal: { + registry: { + kibanaVersionCheckEnabled: false, + }, + }, packages: [ { name: 'fleet_server', diff --git a/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts b/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts index b3d9b65a1f3ef..5720983bf1494 100644 --- a/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts @@ -23,7 +23,7 @@ import { useDockerRegistry, waitForFleetSetup, getSupertestWithAdminUser } from const logFilePath = Path.join(__dirname, 'logs.log'); // Failing 9.0 version update: https://github.com/elastic/kibana/issues/192624 -describe.skip('Fleet preconfiguration reset', () => { +describe('Fleet preconfiguration reset', () => { let esServer: TestElasticsearchUtils; let kbnServer: TestKibanaUtils; @@ -47,6 +47,11 @@ describe.skip('Fleet preconfiguration reset', () => { xpack: { fleet: { registryUrl, + internal: { + registry: { + kibanaVersionCheckEnabled: false, + }, + }, packages: [ { name: 'fleet_server', From d641d6636fc9f24348bc35ebf8313ae7c4e5f78b Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Fri, 8 Nov 2024 10:05:43 -0500 Subject: [PATCH 2/4] Update access to public for reset routes --- x-pack/plugins/fleet/server/routes/preconfiguration/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/fleet/server/routes/preconfiguration/index.ts b/x-pack/plugins/fleet/server/routes/preconfiguration/index.ts index e78396005d4c2..c79bb80874d29 100644 --- a/x-pack/plugins/fleet/server/routes/preconfiguration/index.ts +++ b/x-pack/plugins/fleet/server/routes/preconfiguration/index.ts @@ -18,7 +18,7 @@ export const registerRoutes = (router: FleetAuthzRouter) => { router.versioned .post({ path: PRECONFIGURATION_API_ROUTES.RESET_PATTERN, - access: 'internal', + access: 'public', fleetAuthz: { fleet: { all: true }, }, @@ -34,7 +34,7 @@ export const registerRoutes = (router: FleetAuthzRouter) => { router.versioned .post({ path: PRECONFIGURATION_API_ROUTES.RESET_ONE_PATTERN, - access: 'internal', + access: 'public', fleetAuthz: { fleet: { all: true }, }, From 3cabeebbc1d0093fc1f6c819b90b6b691cc04c49 Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Fri, 8 Nov 2024 11:27:09 -0500 Subject: [PATCH 3/4] Fix API version --- x-pack/plugins/fleet/server/routes/preconfiguration/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/fleet/server/routes/preconfiguration/index.ts b/x-pack/plugins/fleet/server/routes/preconfiguration/index.ts index c79bb80874d29..c62c86953acaa 100644 --- a/x-pack/plugins/fleet/server/routes/preconfiguration/index.ts +++ b/x-pack/plugins/fleet/server/routes/preconfiguration/index.ts @@ -25,7 +25,7 @@ export const registerRoutes = (router: FleetAuthzRouter) => { }) .addVersion( { - version: API_VERSIONS.internal.v1, + version: API_VERSIONS.public.v1, validate: false, }, @@ -41,7 +41,7 @@ export const registerRoutes = (router: FleetAuthzRouter) => { }) .addVersion( { - version: API_VERSIONS.internal.v1, + version: API_VERSIONS.public.v1, validate: { request: PostResetOnePreconfiguredAgentPoliciesSchema }, }, resetOnePreconfigurationHandler From 0679d557f096c71971d77bd4d28e7b9413784056 Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Sat, 9 Nov 2024 06:27:53 -0500 Subject: [PATCH 4/4] Set public version in tests --- .../integration_tests/reset_preconfiguration.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts b/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts index 5720983bf1494..65224e2408bd6 100644 --- a/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts @@ -258,7 +258,7 @@ describe('Fleet preconfiguration reset', () => { ); await resetAPI .set('kbn-sxrf', 'xx') - .set('Elastic-Api-Version', `${API_VERSIONS.internal.v1}`) + .set('Elastic-Api-Version', `${API_VERSIONS.public.v1}`) .expect(200) .send(); @@ -303,7 +303,7 @@ describe('Fleet preconfiguration reset', () => { ); await resetAPI .set('kbn-sxrf', 'xx') - .set('Elastic-Api-Version', `${API_VERSIONS.internal.v1}`) + .set('Elastic-Api-Version', `${API_VERSIONS.public.v1}`) .expect(200) .send(); @@ -341,7 +341,7 @@ describe('Fleet preconfiguration reset', () => { ); await resetAPI .set('kbn-sxrf', 'xx') - .set('Elastic-Api-Version', `${API_VERSIONS.internal.v1}`) + .set('Elastic-Api-Version', `${API_VERSIONS.public.v1}`) .expect(200) .send(); @@ -378,7 +378,7 @@ describe('Fleet preconfiguration reset', () => { ); await resetAPI .set('kbn-sxrf', 'xx') - .set('Elastic-Api-Version', `${API_VERSIONS.internal.v1}`) + .set('Elastic-Api-Version', `${API_VERSIONS.public.v1}`) .expect(200) .send();