Skip to content

Commit dd29bed

Browse files
committed
fix tests after adding enabled boolean in test utils
1 parent acfb15d commit dd29bed

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

x-pack/test/detection_engine_api_integration/basic/tests/import_rules.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default ({ getService }: FtrProviderContext): void => {
129129
await supertest
130130
.post(`${DETECTION_ENGINE_RULES_URL}/_import`)
131131
.set('kbn-xsrf', 'true')
132-
.attach('file', getSimpleRuleAsNdjson(['rule-1']), 'rules.ndjson')
132+
.attach('file', getSimpleRuleAsNdjson(['rule-1'], true), 'rules.ndjson')
133133
.expect(200);
134134

135135
const { body } = await supertest
@@ -330,7 +330,7 @@ export default ({ getService }: FtrProviderContext): void => {
330330
await supertest
331331
.post(`${DETECTION_ENGINE_RULES_URL}/_import`)
332332
.set('kbn-xsrf', 'true')
333-
.attach('file', getSimpleRuleAsNdjson(['rule-1']), 'rules.ndjson')
333+
.attach('file', getSimpleRuleAsNdjson(['rule-1'], true), 'rules.ndjson')
334334
.expect(200);
335335

336336
const simpleRule = getSimpleRule('rule-1');
@@ -422,13 +422,17 @@ export default ({ getService }: FtrProviderContext): void => {
422422
await supertest
423423
.post(`${DETECTION_ENGINE_RULES_URL}/_import`)
424424
.set('kbn-xsrf', 'true')
425-
.attach('file', getSimpleRuleAsNdjson(['rule-1', 'rule-2']), 'rules.ndjson')
425+
.attach('file', getSimpleRuleAsNdjson(['rule-1', 'rule-2'], true), 'rules.ndjson')
426426
.expect(200);
427427

428428
await supertest
429429
.post(`${DETECTION_ENGINE_RULES_URL}/_import`)
430430
.set('kbn-xsrf', 'true')
431-
.attach('file', getSimpleRuleAsNdjson(['rule-1', 'rule-2', 'rule-3']), 'rules.ndjson')
431+
.attach(
432+
'file',
433+
getSimpleRuleAsNdjson(['rule-1', 'rule-2', 'rule-3'], true),
434+
'rules.ndjson'
435+
)
432436
.expect(200);
433437

434438
const { body: bodyOfRule1 } = await supertest

x-pack/test/detection_engine_api_integration/security_and_spaces/tests/import_rules.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default ({ getService }: FtrProviderContext): void => {
129129
await supertest
130130
.post(`${DETECTION_ENGINE_RULES_URL}/_import`)
131131
.set('kbn-xsrf', 'true')
132-
.attach('file', getSimpleRuleAsNdjson(['rule-1']), 'rules.ndjson')
132+
.attach('file', getSimpleRuleAsNdjson(['rule-1'], true), 'rules.ndjson')
133133
.expect(200);
134134

135135
const { body } = await supertest
@@ -243,7 +243,7 @@ export default ({ getService }: FtrProviderContext): void => {
243243
await supertest
244244
.post(`${DETECTION_ENGINE_RULES_URL}/_import`)
245245
.set('kbn-xsrf', 'true')
246-
.attach('file', getSimpleRuleAsNdjson(['rule-1']), 'rules.ndjson')
246+
.attach('file', getSimpleRuleAsNdjson(['rule-1'], true), 'rules.ndjson')
247247
.expect(200);
248248

249249
const simpleRule = getSimpleRule('rule-1');
@@ -335,13 +335,17 @@ export default ({ getService }: FtrProviderContext): void => {
335335
await supertest
336336
.post(`${DETECTION_ENGINE_RULES_URL}/_import`)
337337
.set('kbn-xsrf', 'true')
338-
.attach('file', getSimpleRuleAsNdjson(['rule-1', 'rule-2']), 'rules.ndjson')
338+
.attach('file', getSimpleRuleAsNdjson(['rule-1', 'rule-2'], true), 'rules.ndjson')
339339
.expect(200);
340340

341341
await supertest
342342
.post(`${DETECTION_ENGINE_RULES_URL}/_import`)
343343
.set('kbn-xsrf', 'true')
344-
.attach('file', getSimpleRuleAsNdjson(['rule-1', 'rule-2', 'rule-3']), 'rules.ndjson')
344+
.attach(
345+
'file',
346+
getSimpleRuleAsNdjson(['rule-1', 'rule-2', 'rule-3'], true),
347+
'rules.ndjson'
348+
)
345349
.expect(200);
346350

347351
const { body: bodyOfRule1 } = await supertest

x-pack/test/detection_engine_api_integration/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const removeServerGeneratedPropertiesIncludingRuleId = (
5858
* @param ruleId
5959
* @param enabled Enables the rule on creation or not. Defaulted to false to enable it on import
6060
*/
61-
export const getSimpleRule = (ruleId = 'rule-1', enabled = false): CreateRulesSchema => ({
61+
export const getSimpleRule = (ruleId = 'rule-1', enabled = true): CreateRulesSchema => ({
6262
name: 'Simple Rule Query',
6363
description: 'Simple Rule Query',
6464
enabled,

0 commit comments

Comments
 (0)