Skip to content

Commit

Permalink
[Security Solution] Remove bulk create rules API calls from rule expo…
Browse files Browse the repository at this point in the history
…rt tests (#198953)

**Follow-up to:**
#197422 (comment)

## Summary

This PR manually "backports" some of the changes from
#197422 directly to the `8.x`
branch. Specifically, it removes API calls to the rules `_bulk_create`
API endpoint from the tests for exporting rules. This API endpoint has
been disabled in `main` (=> Serverless and Kibana 9.0) and should not be
used in code. This PR aims to reduce the chances of introducing
conflicts with any further changes to rule export tests.
  • Loading branch information
banderror authored Nov 6, 2024
1 parent 94dfe89 commit b4fcf8c
Showing 1 changed file with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ export default ({ getService }: FtrProviderContext): void => {
});

it('exports a set of custom installed rules via the _export API', async () => {
await securitySolutionApi
.bulkCreateRules({
body: [
getCustomQueryRuleParams({ rule_id: 'rule-id-1' }),
getCustomQueryRuleParams({ rule_id: 'rule-id-2' }),
],
})
.expect(200);
await Promise.all([
securitySolutionApi
.createRule({ body: getCustomQueryRuleParams({ rule_id: 'rule-id-1' }) })
.expect(200),
securitySolutionApi
.createRule({ body: getCustomQueryRuleParams({ rule_id: 'rule-id-2' }) })
.expect(200),
]);

const { body: exportResult } = await securitySolutionApi
.exportRules({ query: {}, body: null })
Expand Down Expand Up @@ -182,14 +182,14 @@ export default ({ getService }: FtrProviderContext): void => {
});

it('exports a set of custom and prebuilt installed rules via the _export API', async () => {
await securitySolutionApi
.bulkCreateRules({
body: [
getCustomQueryRuleParams({ rule_id: 'rule-id-1' }),
getCustomQueryRuleParams({ rule_id: 'rule-id-2' }),
],
})
.expect(200);
await Promise.all([
securitySolutionApi
.createRule({ body: getCustomQueryRuleParams({ rule_id: 'rule-id-1' }) })
.expect(200),
securitySolutionApi
.createRule({ body: getCustomQueryRuleParams({ rule_id: 'rule-id-2' }) })
.expect(200),
]);

const { body: exportResult } = await securitySolutionApi
.exportRules({ query: {}, body: null })
Expand Down Expand Up @@ -232,14 +232,14 @@ export default ({ getService }: FtrProviderContext): void => {
});

it('exports both custom and prebuilt rules when rule_ids are specified via the _export API', async () => {
await securitySolutionApi
.bulkCreateRules({
body: [
getCustomQueryRuleParams({ rule_id: 'rule-id-1' }),
getCustomQueryRuleParams({ rule_id: 'rule-id-2' }),
],
})
.expect(200);
await Promise.all([
securitySolutionApi
.createRule({ body: getCustomQueryRuleParams({ rule_id: 'rule-id-1' }) })
.expect(200),
securitySolutionApi
.createRule({ body: getCustomQueryRuleParams({ rule_id: 'rule-id-2' }) })
.expect(200),
]);

const { body: exportResult } = await securitySolutionApi
.exportRules({
Expand Down Expand Up @@ -277,14 +277,14 @@ export default ({ getService }: FtrProviderContext): void => {
});

it('exports a set of custom and prebuilt installed rules via the bulk_actions API', async () => {
await securitySolutionApi
.bulkCreateRules({
body: [
getCustomQueryRuleParams({ rule_id: 'rule-id-1' }),
getCustomQueryRuleParams({ rule_id: 'rule-id-2' }),
],
})
.expect(200);
await Promise.all([
securitySolutionApi
.createRule({ body: getCustomQueryRuleParams({ rule_id: 'rule-id-1' }) })
.expect(200),
securitySolutionApi
.createRule({ body: getCustomQueryRuleParams({ rule_id: 'rule-id-2' }) })
.expect(200),
]);

const { body: exportResult } = await securitySolutionApi
.performRulesBulkAction({
Expand Down

0 comments on commit b4fcf8c

Please sign in to comment.