Skip to content

Commit

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

This will backport the following commits from `main` to `8.11`:
- [Risk score test unskip and clear transform
(#168469)](#168469)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Khristinin
Nikita","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-13T06:47:36Z","message":"Risk
score test unskip and clear transform (#168469)\n\n# Risk score test
unskip and clear transform \r\n\r\n\r\nRun 50 times and 100 times on
flaky test runner and it was
green\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>\r\nCo-authored-by:
Ryland Herrick
<[email protected]>","sha":"caeae04fac6602d54a543ececa10fbd7c91ddd7c","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","v8.12.0"],"number":168469,"url":"https://github.com/elastic/kibana/pull/168469","mergeCommit":{"message":"Risk
score test unskip and clear transform (#168469)\n\n# Risk score test
unskip and clear transform \r\n\r\n\r\nRun 50 times and 100 times on
flaky test runner and it was
green\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>\r\nCo-authored-by:
Ryland Herrick
<[email protected]>","sha":"caeae04fac6602d54a543ececa10fbd7c91ddd7c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168469","number":168469,"mergeCommit":{"message":"Risk
score test unskip and clear transform (#168469)\n\n# Risk score test
unskip and clear transform \r\n\r\n\r\nRun 50 times and 100 times on
flaky test runner and it was
green\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>\r\nCo-authored-by:
Ryland Herrick
<[email protected]>","sha":"caeae04fac6602d54a543ececa10fbd7c91ddd7c"}}]}]
BACKPORT-->

Co-authored-by: Khristinin Nikita <[email protected]>
  • Loading branch information
rylnd and nkhristinin authored Oct 13, 2023
1 parent 9b7365b commit aebe730
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 aebe730

Please sign in to comment.