diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/alert_suppression/machine_learning_rule.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/alert_suppression/machine_learning_rule.cy.ts index df32a30b019a3..92b85f69719a0 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/alert_suppression/machine_learning_rule.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/alert_suppression/machine_learning_rule.cy.ts @@ -39,9 +39,7 @@ import { visit } from '../../../../tasks/navigation'; import { getDetails } from '../../../../tasks/rule_details'; import { CREATE_RULE_URL } from '../../../../urls/navigation'; -// Failing: See https://github.com/elastic/kibana/issues/229861 -// Failing: See https://github.com/elastic/kibana/issues/229860 -describe.skip( +describe( 'Machine Learning Detection Rules - Alert suppression', { tags: ['@ess', '@serverless'], @@ -84,7 +82,7 @@ describe.skip( describe('when ML jobs have run', () => { before(() => { - cy.task('esArchiverLoad', { archiveName: '../auditbeat/hosts', type: 'ftr' }); + cy.task('esArchiverLoad', { archiveName: 'auditbeat/hosts', type: 'platform' }); setupMlModulesWithRetry({ moduleName: 'security_linux_v3' }); forceStartDatafeeds({ jobIds: [jobId] }); cy.task('esArchiverLoad', { archiveName: 'anomalies', type: 'ftr' }); @@ -92,7 +90,7 @@ describe.skip( after(() => { cy.task('esArchiverUnload', { archiveName: 'anomalies', type: 'ftr' }); - cy.task('esArchiverUnload', { archiveName: '../auditbeat/hosts', type: 'ftr' }); + cy.task('esArchiverUnload', { archiveName: 'auditbeat/hosts', type: 'platform' }); }); describe('when not all jobs are running', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_edit/machine_learning_rule.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_edit/machine_learning_rule.cy.ts index 664c60fe53f43..e6c26528ae50c 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_edit/machine_learning_rule.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_edit/machine_learning_rule.cy.ts @@ -39,8 +39,7 @@ import { visit } from '../../../../tasks/navigation'; import { assertDetailsNotExist, getDetails } from '../../../../tasks/rule_details'; import { RULES_MANAGEMENT_URL } from '../../../../urls/rules_management'; -// Failing: See https://github.com/elastic/kibana/issues/229859 -describe.skip( +describe( 'Machine Learning Detection Rules - Editing', { tags: ['@ess', '@serverless', '@skipInServerlessMKI'], @@ -56,12 +55,16 @@ describe.skip( ); // ensure no ML jobs are started before the test machineLearningJobIds.forEach((j) => forceStopAndCloseJob({ jobId: j })); + cy.task('esArchiverLoad', { archiveName: 'auditbeat/hosts', type: 'platform' }); + }); + + after(() => { + cy.task('esArchiverUnload', { archiveName: 'auditbeat/hosts', type: 'platform' }); }); beforeEach(() => { login(); deleteAlertsAndRules(); - cy.task('esArchiverLoad', { archiveName: '../auditbeat/hosts', type: 'ftr' }); setupMlModulesWithRetry({ moduleName: 'security_linux_v3' }); forceStartDatafeeds({ jobIds: [jobId] }); cy.task('esArchiverLoad', { archiveName: 'anomalies', type: 'ftr' }); diff --git a/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts b/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts index cf5db5e63ef47..dc40266d5682a 100644 --- a/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts +++ b/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts @@ -26,10 +26,7 @@ function createKibanaUrlWithAuth({ url, username, password }: ClientOptions) { return clientUrl.toString(); } -export const esArchiver = ( - on: Cypress.PluginEvents, - config: Cypress.PluginConfigOptions -): EsArchiver => { +export const esArchiver = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions): void => { const log = new ToolingLog({ level: 'verbose', writeTo: process.stdout }); const isServerless = config.env.IS_SERVERLESS; @@ -66,26 +63,29 @@ export const esArchiver = ( : {}), }); - const esArchiverInstance = new EsArchiver({ - log, - client, - kbnClient, - baseDir: '../es_archives', - }); - - const ftrEsArchiverInstance = new EsArchiver({ - log, - client, - kbnClient, - baseDir: '../../../solutions/security/test/fixtures/es_archives/security_solution', - }); + const esArchiverFactory = (baseDir: string) => + new EsArchiver({ + log, + client, + kbnClient, + baseDir, + }); + const cypressEsArchiverInstance = esArchiverFactory('../es_archives'); + const ftrEsArchiverInstance = esArchiverFactory( + '../../../solutions/security/test/fixtures/es_archives/security_solution' + ); + const platformEsArchiverInstance = esArchiverFactory( + '../../../platform/test/fixtures/es_archives' + ); on('task', { esArchiverLoad: async ({ archiveName, type = 'cypress', ...options }) => { if (type === 'cypress') { - return esArchiverInstance.load(archiveName, options); + return cypressEsArchiverInstance.load(archiveName, options); } else if (type === 'ftr') { return ftrEsArchiverInstance.load(archiveName, options); + } else if (type === 'platform') { + return platformEsArchiverInstance.load(archiveName, options); } else { throw new Error( `Unable to load the specified archive: ${JSON.stringify({ archiveName, type, options })}` @@ -94,14 +94,14 @@ export const esArchiver = ( }, esArchiverUnload: async ({ archiveName, type = 'cypress' }) => { if (type === 'cypress') { - return esArchiverInstance.unload(archiveName); + return cypressEsArchiverInstance.unload(archiveName); } else if (type === 'ftr') { return ftrEsArchiverInstance.unload(archiveName); + } else if (type === 'platform') { + return platformEsArchiverInstance.unload(archiveName); } else { throw new Error('It is not possible to unload the archive.'); } }, }); - - return esArchiverInstance; };