Skip to content

Commit

Permalink
fix integrational tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guskovaue committed Oct 27, 2023
1 parent 865b46e commit 5045a47
Showing 1 changed file with 1 addition and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import expect from '@kbn/expect';
import { RuleActionTypes } from '@kbn/alerting-plugin/common';
import { omit } from 'lodash';
import { Spaces } from '../../../scenarios';
import { getUrlPrefix, getTestRuleData, ObjectRemover } from '../../../../common/lib';
Expand All @@ -26,7 +25,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
id: 'system-connector-test.system-action',
uuid: '123',
params: {},
type: RuleActionTypes.SYSTEM,
};

it('should bulk edit system actions correctly', async () => {
Expand Down Expand Up @@ -61,7 +59,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
connector_type_id: 'test.system-action',
params: {},
uuid: '123',
type: RuleActionTypes.SYSTEM,
},
]);
});
Expand All @@ -75,7 +72,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {

objectRemover.add(Spaces.space1.id, rule.id, 'rule', 'alerting');

for (const propertyToOmit of ['id', 'uuid']) {
for (const propertyToOmit of ['id']) {
const systemActionWithoutProperty = omit(systemAction, propertyToOmit);

const payload = {
Expand All @@ -97,49 +94,6 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
}
});

it('should throw 400 if the system action contain properties from the default actions', async () => {
const { body: rule } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`)
.set('kbn-xsrf', 'foo')
.send(getTestRuleData())
.expect(200);

objectRemover.add(Spaces.space1.id, rule.id, 'rule', 'alerting');

for (const propertyAdd of [
{ group: 'test' },
{
frequency: {
notify_when: 'onThrottleInterval' as const,
summary: true,
throttle: '1h',
},
},
{
alerts_filter: {
query: { dsl: '{test:1}', kql: 'test:1s', filters: [] },
},
},
]) {
const payload = {
ids: [rule.id],
operations: [
{
operation: 'add',
field: 'actions',
value: [{ ...systemAction, ...propertyAdd }],
},
],
};

await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/internal/alerting/rules/_bulk_edit`)
.set('kbn-xsrf', 'foo')
.send(payload)
.expect(400);
}
});

it('should throw 400 if the system action is missing required params', async () => {
const { body: rule } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`)
Expand Down

0 comments on commit 5045a47

Please sign in to comment.