Skip to content

Commit

Permalink
Risk score test unskip and clear transform (#168469)
Browse files Browse the repository at this point in the history
# Risk score test unskip and clear transform

Run 50 times and 100 times on flaky test runner and it was green

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Ryland Herrick <[email protected]>
(cherry picked from commit caeae04)
  • Loading branch information
nkhristinin committed Oct 13, 2023
1 parent 33f2b38 commit 4aed17e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import {
installLegacyRiskScore,
getLegacyRiskScoreDashboards,
clearLegacyDashboards,
deleteRiskEngineTask,
deleteAllRiskScores,
} from './utils';

// eslint-disable-next-line import/no-default-export
Expand All @@ -29,6 +31,16 @@ export default ({ getService }: FtrProviderContext) => {
const log = getService('log');

describe('Risk Engine', () => {
beforeEach(async () => {
await cleanRiskEngineConfig({ kibanaServer });
await deleteRiskEngineTask({ es, log });
await deleteAllRiskScores(log, es);
await clearTransforms({
es,
log,
});
});

afterEach(async () => {
await cleanRiskEngineConfig({
kibanaServer,
Expand All @@ -45,10 +57,11 @@ export default ({ getService }: FtrProviderContext) => {
supertest,
log,
});
await deleteRiskEngineTask({ es, log });
});

// FLAKY: https://github.com/elastic/kibana/issues/168376
describe.skip('init api', () => {
describe('init api', () => {
it('should return response with success status', async () => {
const response = await riskEngineRoutes.init();
expect(response.body).to.eql({
Expand Down Expand Up @@ -374,7 +387,7 @@ export default ({ getService }: FtrProviderContext) => {
});

// FLAKY: https://github.com/elastic/kibana/issues/168355
describe.skip('status api', () => {
describe('status api', () => {
it('should disable / enable risk engine', async () => {
const status1 = await riskEngineRoutes.getStatus();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
cleanRiskEngineConfig,
waitForRiskEngineTaskToBeGone,
deleteRiskScoreIndices,
clearTransforms,
} from './utils';

// eslint-disable-next-line import/no-default-export
Expand All @@ -37,8 +38,7 @@ export default ({ getService }: FtrProviderContext): void => {
const createAndSyncRuleAndAlerts = createAndSyncRuleAndAlertsFactory({ supertest, log });
const riskEngineRoutes = riskEngineRouteHelpersFactory(supertest);

// Failing: See https://github.com/elastic/kibana/issues/168424
describe.skip('Risk Engine - Risk Scoring Task', () => {
describe('Risk Engine - Risk Scoring Task', () => {
context('with auditbeat data', () => {
const { indexListOfDocuments } = dataGeneratorFactory({
es,
Expand All @@ -62,6 +62,7 @@ export default ({ getService }: FtrProviderContext): void => {
await deleteAllRiskScores(log, es);
await deleteAllAlerts(supertest, log, es);
await deleteAllRules(supertest, log);
await clearTransforms({ es, log });
});

afterEach(async () => {
Expand All @@ -70,6 +71,7 @@ export default ({ getService }: FtrProviderContext): void => {
await deleteAllRiskScores(log, es);
await deleteAllAlerts(supertest, log, es);
await deleteAllRules(supertest, log);
await clearTransforms({ es, log });
});

describe('with some alerts containing hosts', () => {
Expand All @@ -94,8 +96,7 @@ export default ({ getService }: FtrProviderContext): void => {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/168415
describe.skip('initializing the risk engine', () => {
describe('initializing the risk engine', () => {
beforeEach(async () => {
await riskEngineRoutes.init();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
waitForRiskScoresToBePresent,
riskEngineRouteHelpersFactory,
cleanRiskEngineConfig,
clearTransforms,
} from './utils';
import { dataGeneratorFactory } from '../../../utils/data_generator';

Expand Down Expand Up @@ -53,6 +54,7 @@ export default ({ getService }: FtrProviderContext) => {
await deleteRiskScoreIndices({ log, es });
await deleteAllAlerts(supertest, log, es);
await deleteAllRules(supertest, log);
await clearTransforms({ es, log });
});

describe('Risk engine not enabled', () => {
Expand All @@ -66,7 +68,7 @@ export default ({ getService }: FtrProviderContext) => {
});

// FLAKY: https://github.com/elastic/kibana/issues/168429
describe.skip('Risk engine enabled', () => {
describe('Risk engine enabled', () => {
let hostId: string;
let userId: string;

Expand Down Expand Up @@ -108,6 +110,7 @@ export default ({ getService }: FtrProviderContext) => {
await deleteRiskScoreIndices({ log, es });
await deleteAllAlerts(supertest, log, es);
await deleteAllRules(supertest, log);
await clearTransforms({ es, log });
});

it('should return riskEngineMetrics with expected values', async () => {
Expand Down

0 comments on commit 4aed17e

Please sign in to comment.