Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function createGetActionErrorLogTests({ getService }: FtrProvider
const supertest = getService('supertest');
const retry = getService('retry');
const es = getService('es');
const log = getService('log');
const esTestIndexTool = new ESTestIndexTool(es, retry);

const dateStart = new Date(Date.now() - 600000).toISOString();
Expand Down Expand Up @@ -147,7 +148,7 @@ export default function createGetActionErrorLogTests({ getService }: FtrProvider
.send(
getTestRuleData({
rule_type_id: 'test.cumulative-firing',
schedule: { interval: '6s' },
schedule: { interval: '1d' },
actions: [
{
id: createdConnector1.id,
Expand Down Expand Up @@ -175,6 +176,7 @@ export default function createGetActionErrorLogTests({ getService }: FtrProvider
);

expect(response.body.totalErrors).to.eql(2);
log.info(`response.body: ${JSON.stringify(response.body)}`);

const filteredResponse = await supertest.get(
`${getUrlPrefix(Spaces.space1.id)}/internal/alerting/rule/${
Expand All @@ -183,13 +185,15 @@ export default function createGetActionErrorLogTests({ getService }: FtrProvider
);

expect(filteredResponse.body.totalErrors).to.eql(1);
log.info(`filteredResponse.body: ${JSON.stringify(filteredResponse.body)}`);

// Fetch rule execution, try to filter on that
const execResponse = await supertest.get(
`${getUrlPrefix(Spaces.space1.id)}/internal/alerting/rule/${
createdRule.id
}/_execution_log?date_start=${dateStart}`
);
log.info(`execResponse.body: ${JSON.stringify(execResponse.body)}`);

const runId = execResponse.body.data[0].id;

Expand All @@ -199,13 +203,15 @@ export default function createGetActionErrorLogTests({ getService }: FtrProvider
}/_action_error_log?filter=kibana.alert.rule.execution.uuid:${runId}&date_start=${dateStart}`
);
expect(filteredByIdResponse.body.totalErrors).to.eql(2);
log.info(`filteredByIdResponse.body: ${JSON.stringify(filteredByIdResponse.body)}`);

const filteredByInvalidResponse = await supertest.get(
`${getUrlPrefix(Spaces.space1.id)}/internal/alerting/rule/${
createdRule.id
}/_action_error_log?filter=kibana.alert.rule.execution.uuid:doesnt_exist&date_start=${dateStart}`
);
expect(filteredByInvalidResponse.body.totalErrors).to.eql(0);
log.info(`filteredByInvalidResponse.body: ${JSON.stringify(filteredByInvalidResponse.body)}`);
});
});

Expand Down