-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Security Solution] Enable critical Rule Management tests in MKI periodic and 2nd quality gate pipelines #193666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e3027d7
789c777
8105bec
795e7c9
980b290
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import expect from 'expect'; | ||
| import { BulkActionTypeEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_management'; | ||
| import { getCustomQueryRuleParams, fetchRule } from '../../../utils'; | ||
| import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; | ||
| import { FtrProviderContext } from '../../../../../ftr_provider_context'; | ||
|
|
||
| export default ({ getService }: FtrProviderContext): void => { | ||
| const supertest = getService('supertest'); | ||
| const securitySolutionApi = getService('securitySolutionApi'); | ||
| const log = getService('log'); | ||
|
|
||
| describe('@ess @serverless @serverlessQA Bulk enable/disable', () => { | ||
| beforeEach(async () => { | ||
| await deleteAllRules(supertest, log); | ||
| }); | ||
|
|
||
| it('should enable rules', async () => { | ||
| const ruleId = 'ruleId'; | ||
| await createRule( | ||
| supertest, | ||
| log, | ||
| getCustomQueryRuleParams({ rule_id: ruleId, enabled: false }) | ||
| ); | ||
|
|
||
| const { body } = await securitySolutionApi.performRulesBulkAction({ | ||
| query: {}, | ||
| body: { action: BulkActionTypeEnum.enable }, | ||
| }); | ||
|
|
||
| expect(body.attributes.summary).toEqual({ failed: 0, skipped: 0, succeeded: 1, total: 1 }); | ||
|
|
||
| // Check that the updated rule is returned with the response | ||
| expect(body.attributes.results.updated[0].enabled).toEqual(true); | ||
|
|
||
| // Check that the updates have been persisted | ||
| const ruleBody = await fetchRule(supertest, { ruleId }); | ||
| expect(ruleBody.enabled).toEqual(true); | ||
| }); | ||
|
|
||
| it('should disable rules', async () => { | ||
| const ruleId = 'ruleId'; | ||
| await createRule( | ||
| supertest, | ||
| log, | ||
| getCustomQueryRuleParams({ rule_id: ruleId, enabled: true }) | ||
| ); | ||
|
|
||
| const { body } = await securitySolutionApi.performRulesBulkAction({ | ||
| query: {}, | ||
| body: { action: BulkActionTypeEnum.disable }, | ||
| }); | ||
|
|
||
| expect(body.attributes.summary).toEqual({ failed: 0, skipped: 0, succeeded: 1, total: 1 }); | ||
|
|
||
| // Check that the updated rule is returned with the response | ||
| expect(body.attributes.results.updated[0].enabled).toEqual(false); | ||
|
|
||
| // Check that the updates have been persisted | ||
| const ruleBody = await fetchRule(supertest, { ruleId }); | ||
| expect(ruleBody.enabled).toEqual(false); | ||
| }); | ||
| }); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ export default ({ getService }: FtrProviderContext): void => { | |
| const securitySolutionApi = getService('securitySolutionApi'); | ||
| const log = getService('log'); | ||
|
|
||
| describe('@ess @serverless import_rules', () => { | ||
| describe('@ess @serverless @serverlessQA import_rules', () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason to add I'm just thinking that the import function is becoming increasingly important, especially since it will be the main way to bulk create rules once the Bulk Create API is fully deprecated in 9.0
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The goal is to enable smoke testing for importing functionality. There is an assumption that a scenario when |
||
| describe('importing rules with an index', () => { | ||
| afterEach(async () => { | ||
| await deleteAllRules(supertest, log); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ export default ({ getService }: FtrProviderContext): void => { | |
| const log = getService('log'); | ||
| const utils = getService('securitySolutionUtils'); | ||
|
|
||
| describe('@ess @serverless find_rules', () => { | ||
| describe('@ess @serverless @skipInServerlessMKI find_rules', () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also here I'd like to understand the difference between Basic and Trial Licenses, and why we're adding the Basic tests to QA, but leaving Trial out
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The goal is to have critical functionality smoke tests running in MKI. If one test fails it will block a Serverless release and require our team to do a hotfix. More tests enabled the higher such risk but of course we want to deliver stable features. The decision is to find a balance in that trade off by enabling only basic license tests. It's a critical functionality and always gives an option for a user to roll back to a basic license and wait for the next Serverless release. Nothing blocks us from enabling more tests later on when it's necessary. |
||
| beforeEach(async () => { | ||
| await deleteAllRules(supertest, log); | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we have no test coverage for creating other rule types. But just wondering why you've decided to add this one to ServerlessKibanaQAGate. Do you think that there should be similar tests to this, one for each rule type, and all should be part of ServerlessKibanaQAGate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct we have a limited test coverage. The goal of this PR is to enable smoke tests from what's available. Since we have a test for new terms rule type it makes sense to enable it in MKI.