From ef8c44e932143d9fa0fff7fc1a691fc1edbc2e16 Mon Sep 17 00:00:00 2001 From: Dmitrii Date: Wed, 11 Dec 2024 14:30:07 +0100 Subject: [PATCH] Add logging and unskip test --- .../trial_license_complete_tier/prerelease_packages.ts | 2 +- .../bootstrap_prebuilt_rules.ts | 7 ++++--- .../trial_license_complete_tier/fleet_integration.ts | 2 +- .../rules/prebuilt_rules/delete_endpoint_fleet_package.ts | 7 ++++++- .../prebuilt_rules/delete_prebuilt_rules_fleet_package.ts | 8 +++++++- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/bundled_prebuilt_rules_package/trial_license_complete_tier/prerelease_packages.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/bundled_prebuilt_rules_package/trial_license_complete_tier/prerelease_packages.ts index edae7dd4eb014..a0e2e1ccbc0a8 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/bundled_prebuilt_rules_package/trial_license_complete_tier/prerelease_packages.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/bundled_prebuilt_rules_package/trial_license_complete_tier/prerelease_packages.ts @@ -35,7 +35,7 @@ export default ({ getService }: FtrProviderContext): void => { beforeEach(async () => { await deleteAllRules(supertest, log); await deleteAllPrebuiltRuleAssets(es, log); - await deletePrebuiltRulesFleetPackage(supertest); + await deletePrebuiltRulesFleetPackage(supertest, log); }); it('should install latest stable version and ignore prerelease packages', async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/bootstrap_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/bootstrap_prebuilt_rules.ts index 3d0cd40324dc6..4dc18ba24cf48 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/bootstrap_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/bootstrap_prebuilt_rules.ts @@ -17,12 +17,13 @@ import { deleteEndpointFleetPackage } from '../../../../utils/rules/prebuilt_rul export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); const securitySolutionApi = getService('securitySolutionApi'); + const log = getService('log'); // Failing: See https://github.com/elastic/kibana/issues/197108 - describe.skip('@ess @serverless @skipInServerlessMKI Bootstrap Prebuilt Rules', () => { + describe('@ess @serverless @skipInServerlessMKI Bootstrap Prebuilt Rules', () => { beforeEach(async () => { - await deletePrebuiltRulesFleetPackage(supertest); - await deleteEndpointFleetPackage(supertest); + await deletePrebuiltRulesFleetPackage(supertest, log); + await deleteEndpointFleetPackage(supertest, log); }); it('should install fleet packages required for detection engine to function', async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/fleet_integration.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/fleet_integration.ts index cb317870d3773..3a6e4c209a2c9 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/fleet_integration.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/fleet_integration.ts @@ -24,7 +24,7 @@ export default ({ getService }: FtrProviderContext): void => { describe('@ess @serverless @skipInServerlessMKI install_prebuilt_rules_from_real_package', () => { beforeEach(async () => { - await deletePrebuiltRulesFleetPackage(supertest); + await deletePrebuiltRulesFleetPackage(supertest, log); await deleteAllRules(supertest, log); await deleteAllTimelines(es, log); await deleteAllPrebuiltRuleAssets(es, log); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/delete_endpoint_fleet_package.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/delete_endpoint_fleet_package.ts index e53e24f98de3b..140cbd24f9708 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/delete_endpoint_fleet_package.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/delete_endpoint_fleet_package.ts @@ -8,13 +8,15 @@ import { epmRouteService } from '@kbn/fleet-plugin/common'; import { ENDPOINT_PACKAGE_NAME } from '@kbn/security-solution-plugin/common/detection_engine/constants'; import type SuperTest from 'supertest'; +import { ToolingLog } from '@kbn/tooling-log'; /** * Delete the endpoint package using fleet API. * * @param supertest Supertest instance */ -export async function deleteEndpointFleetPackage(supertest: SuperTest.Agent) { +export async function deleteEndpointFleetPackage(supertest: SuperTest.Agent, log: ToolingLog) { + log.debug('Checking if endpoint package is installed'); const resp = await supertest .get(epmRouteService.getInfoPath(ENDPOINT_PACKAGE_NAME)) .set('kbn-xsrf', 'true') @@ -22,9 +24,12 @@ export async function deleteEndpointFleetPackage(supertest: SuperTest.Agent) { .send(); if (resp.status === 200 && resp.body.response.status === 'installed') { + log.debug('Deleting endpoint package'); await supertest .delete(epmRouteService.getRemovePath(ENDPOINT_PACKAGE_NAME, resp.body.response.version)) .set('kbn-xsrf', 'true') .send({ force: true }); + + log.debug('Deleted endpoint package'); } } diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/delete_prebuilt_rules_fleet_package.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/delete_prebuilt_rules_fleet_package.ts index 930c9d39757f4..ccd41e4a88ecd 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/delete_prebuilt_rules_fleet_package.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/prebuilt_rules/delete_prebuilt_rules_fleet_package.ts @@ -7,6 +7,7 @@ import { epmRouteService } from '@kbn/fleet-plugin/common'; import { PREBUILT_RULES_PACKAGE_NAME } from '@kbn/security-solution-plugin/common/detection_engine/constants'; +import { ToolingLog } from '@kbn/tooling-log'; import type SuperTest from 'supertest'; /** @@ -14,7 +15,8 @@ import type SuperTest from 'supertest'; * * @param supertest Supertest instance */ -export async function deletePrebuiltRulesFleetPackage(supertest: SuperTest.Agent) { +export async function deletePrebuiltRulesFleetPackage(supertest: SuperTest.Agent, log: ToolingLog) { + log.debug('Checking if prebuilt rules package is installed'); const resp = await supertest .get(epmRouteService.getInfoPath(PREBUILT_RULES_PACKAGE_NAME)) .set('kbn-xsrf', 'true') @@ -22,11 +24,15 @@ export async function deletePrebuiltRulesFleetPackage(supertest: SuperTest.Agent .send(); if (resp.status === 200 && resp.body.response.status === 'installed') { + log.debug('Deleting prebuilt rules package'); await supertest .delete( epmRouteService.getRemovePath(PREBUILT_RULES_PACKAGE_NAME, resp.body.response.version) ) .set('kbn-xsrf', 'true') + .timeout(60000) .send({ force: true }); + + log.debug('Deleted prebuilt rules package'); } }