-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] Adds extra cypress and integration tests for setup guide field #180638
Merged
dplumlee
merged 13 commits into
elastic:main
from
dplumlee:extra-setup-guide-field-tests
May 2, 2024
Merged
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5a52c88
adds cypress tests and setup field to integration tests
dplumlee eb5969c
updates tests
dplumlee 1f66f3b
removes field from asset schema
dplumlee df54389
Merge remote-tracking branch 'upstream/main' into extra-setup-guide-f…
dplumlee 7c429ab
updates tests to match defaultable scenarios
dplumlee f1504c9
Merge remote-tracking branch 'upstream/main' into extra-setup-guide-f…
dplumlee 8251d0e
fixes cypress test
dplumlee 6d2ed9b
updates tests
dplumlee 276fe82
fixes test spelling
dplumlee 5d63080
updates tests
dplumlee 46ee48b
Merge remote-tracking branch 'upstream/main' into extra-setup-guide-f…
dplumlee 942d0c2
Merge remote-tracking branch 'upstream/main' into extra-setup-guide-f…
dplumlee 05447ca
Merge remote-tracking branch 'upstream/main' into extra-setup-guide-f…
dplumlee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8,6 +8,7 @@ | |||||
import expect from 'expect'; | ||||||
|
||||||
import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common/constants'; | ||||||
import { BaseDefaultableFields } from '@kbn/security-solution-plugin/common/api/detection_engine'; | ||||||
import { FtrProviderContext } from '../../../../../ftr_provider_context'; | ||||||
import { binaryToString, getCustomQueryRuleParams } from '../../../utils'; | ||||||
import { | ||||||
|
@@ -20,6 +21,7 @@ export default ({ getService }: FtrProviderContext): void => { | |||||
const supertest = getService('supertest'); | ||||||
const log = getService('log'); | ||||||
const es = getService('es'); | ||||||
const securitySolutionApi = getService('securitySolutionApi'); | ||||||
|
||||||
describe('@ess @serverless export_rules', () => { | ||||||
describe('exporting rules', () => { | ||||||
|
@@ -63,6 +65,24 @@ export default ({ getService }: FtrProviderContext): void => { | |||||
expect(exportedRule).toMatchObject(ruleToExport); | ||||||
}); | ||||||
|
||||||
it('should export defaultable fields when values are set', async () => { | ||||||
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. Nit:
Suggested change
|
||||||
const defaultableFields: BaseDefaultableFields = { | ||||||
setup: '# some setup markdown', | ||||||
}; | ||||||
const ruleToExport = getCustomQueryRuleParams(defaultableFields); | ||||||
|
||||||
await securitySolutionApi.createRule({ body: ruleToExport }); | ||||||
|
||||||
const { body } = await securitySolutionApi | ||||||
dplumlee marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
.exportRules({ query: {}, body: null }) | ||||||
.expect(200) | ||||||
.parse(binaryToString); | ||||||
|
||||||
const exportedRule = JSON.parse(body.toString().split(/\n/)[0]); | ||||||
|
||||||
expect(exportedRule).toMatchObject(defaultableFields); | ||||||
}); | ||||||
|
||||||
it('should have export summary reflecting a number of rules', async () => { | ||||||
await createRule(supertest, log, getCustomQueryRuleParams()); | ||||||
|
||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks 👍
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.
@dplumlee @jpdjere Can you folks explain this change to me? Should
related_integrations
andrequired_fields
get the same treatment?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.
This is in reference to this comment, so yes if you're adding those fields to
BaseDefaultableFields
, they should respectively be removed in this type.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.
Got it. Removed "required_fields" in my required fields PR.