Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -84,15 +82,15 @@ 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' });
});

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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 })}`
Expand All @@ -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;
};