Skip to content
Merged
Show file tree
Hide file tree
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 @@ -180,9 +180,7 @@ export const findThresholdSignals = async ({
searchAfterResults.searchErrors.push(...searchErrors);
loggedRequests.push(...(thresholdLoggedRequests ?? []));

if (isEmpty(searchErrors)) {
searchAfterResults.searchErrors.push(...searchErrors);
} else if (searchResult.aggregations != null) {
if (searchResult.aggregations != null) {
const docCount = searchResult.hits.total.value;
if (
docCount >= threshold.value &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ export default ({ getService }: FtrProviderContext) => {
expect(logs[0].warnings).not.toContain(getMaxAlertsWarning());
});

it('generates alerts from Threshold rules when threshold is met and no field is defined', async () => {
const rule: ThresholdRuleCreateProps = {
...getThresholdRuleForAlertTesting(['auditbeat-*']),
threshold: {
field: [],
value: 100,
},
};
const { previewId } = await previewRule({ supertest, rule });
const previewAlerts = await getPreviewAlerts({ es, previewId });
expect(previewAlerts.length).toEqual(1);
});

it('generates 2 alerts from Threshold rules when threshold is met', async () => {
const rule: ThresholdRuleCreateProps = {
...getThresholdRuleForAlertTesting(['auditbeat-*']),
Expand Down