Skip to content

Commit

Permalink
[Entity Analytics] Remove everything except esarchiver calls from `…
Browse files Browse the repository at this point in the history
…before` and `after` calls in cypress tests (#177175)

## Summary

A couple of small tweaks to our cypress tests to move any non-archiver
code out of `before` and `after` hooks and into `beforeEach`.

Flaky test run serverless and ess
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5219
✅ ✅

See #174247 for context

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
hop-dev and kibanamachine authored Feb 20, 2024
1 parent 64f7037 commit a6a0c12
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ import { deleteRiskEngineConfiguration } from '../../../tasks/api_calls/risk_eng
const spaceId = 'default';

describe('Upgrade risk scores', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
beforeEach(() => {
login();
deleteRiskEngineConfiguration();
createRule(getNewRule({ rule_id: 'rule1' }));
});

describe('show upgrade risk button', () => {
beforeEach(() => {
login();
deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId });
deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId });
installLegacyRiskScoreModule(RiskScoreEntity.host, spaceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,25 @@ describe(
},
},
() => {
before(() => {
beforeEach(() => {
cy.task('esArchiverLoad', { archiveName: 'risk_scores_new_complete_data' });
cy.task('esArchiverLoad', { archiveName: 'query_alert', useCreate: true, docsOnly: true });
cy.task('esArchiverLoad', { archiveName: 'user_managed_data' });
enableAssetCriticality();
mockRiskEngineEnabled();
login();
visitWithTimeRange(ALERTS_URL);
waitForAlerts();
});

after(() => {
afterEach(() => {
cy.task('esArchiverUnload', 'risk_scores_new_complete_data');
cy.task('esArchiverUnload', 'user_managed_data');
deleteAlertsAndRules(); // esArchiverUnload doesn't work properly when using with `useCreate` and `docsOnly` flags
deleteCriticality({ idField: 'host.name', idValue: SIEM_KIBANA_HOST_NAME });
deleteCriticality({ idField: 'user.name', idValue: USER_NAME });
});

beforeEach(() => {
mockRiskEngineEnabled();
login();
visitWithTimeRange(ALERTS_URL);
waitForAlerts();
});

describe('User details', () => {
it('should display entity flyout and open risk input panel', () => {
expandFirstAlertUserFlyout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('risk tab', { tags: ['@ess', '@serverless'] }, () => {
// FLAKY: https://github.com/elastic/kibana/issues/169034
describe.skip('with legacy risk score', () => {
before(() => {
// illegal_argument_exception: unknown setting [index.lifecycle.rollover_alias]
cy.task('esArchiverLoad', { archiveName: 'risk_hosts' });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { mockRiskEngineEnabled } from '../../../tasks/entity_analytics';
describe('All hosts table', { tags: ['@ess', '@serverless'] }, () => {
describe('with legacy risk score', () => {
before(() => {
// illegal_argument_exception: unknown setting [index.lifecycle.name]
cy.task('esArchiverLoad', { archiveName: 'risk_hosts' });
});

Expand All @@ -39,7 +38,6 @@ describe('All hosts table', { tags: ['@ess', '@serverless'] }, () => {

describe('with new risk score', () => {
before(() => {
// illegal_argument_exception: unknown setting [index.lifecycle.name]
cy.task('esArchiverLoad', { archiveName: 'risk_scores_new' });
});

Expand Down

0 comments on commit a6a0c12

Please sign in to comment.