Skip to content

Commit 18b1e81

Browse files
committed
test(kbn-evals-suite-security-alert-triage): accommodate the batch size limit introduced for bulk alert attachments
1 parent 6d24793 commit 18b1e81

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

x-pack/solutions/security/packages/kbn-evals-suite-security-alert-triage/evals/alert_triage_quality.spec.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ import {
3939
// ── Constants ─────────────────────────────────────────────────────────────────
4040

4141
const ALERTS_INDEX = '.alerts-security.alerts-default';
42+
const ALERTS_BATCH_MAX_SIZE = 20;
43+
44+
const toAlertAttachments = (ids: string[]) => {
45+
const batches = [];
46+
for (let i = 0; i < ids.length; i += ALERTS_BATCH_MAX_SIZE) {
47+
batches.push({
48+
type: 'security.alerts',
49+
data: { alertIds: ids.slice(i, i + ALERTS_BATCH_MAX_SIZE) },
50+
});
51+
}
52+
return batches;
53+
};
4254

4355
// ── Types ─────────────────────────────────────────────────────────────────────
4456

@@ -198,9 +210,7 @@ evaluate.describe(
198210
'list the affected host names, and provide specific remediation steps for each.',
199211
},
200212
metadata: {
201-
attachments: [
202-
{ type: 'security.alerts', data: { alertIds: PRIORITY_TRIAGE_IDS } },
203-
],
213+
attachments: toAlertAttachments(PRIORITY_TRIAGE_IDS),
204214
},
205215
},
206216
],
@@ -239,9 +249,7 @@ evaluate.describe(
239249
'progression on that host, recommending immediate investigation or containment.',
240250
},
241251
metadata: {
242-
attachments: [
243-
{ type: 'security.alerts', data: { alertIds: ENTITY_CORRELATION_IDS } },
244-
],
252+
attachments: toAlertAttachments(ENTITY_CORRELATION_IDS),
245253
},
246254
},
247255
],

0 commit comments

Comments
 (0)