Skip to content

Commit 56c87ce

Browse files
authored
[ML] Anomaly Explorer: Improves Alerting table in Explorer functional test (#241286)
Follow up to #236600 The test was taking quite a long time due to the job and alerting rule configuration. This PR changes the result type to `record`, shortens the alert interval to `10s`, and removes the 1-minute sleep, so the test should finish more quickly.
1 parent 3fc66f8 commit 56c87ce

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

x-pack/platform/test/functional_with_es_ssl/apps/discover_ml/ml/alerts_table_in_explorer.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function getAnomalyDetectionConfig(): Job {
2020
description: '',
2121
groups: ['real-time', 'anomaly-alerting-ui'],
2222
analysis_config: {
23-
bucket_span: '1m',
23+
bucket_span: '15s',
2424
detectors: [{ function: 'mean', field_name: 'value', partition_field_name: 'key' }],
2525
influencers: ['key'],
2626
},
@@ -99,10 +99,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
9999
});
100100
}
101101

102-
async function sleep(ms: number) {
103-
return new Promise((resolve) => setTimeout(resolve, ms));
104-
}
105-
106102
async function createAnomalyDetectionRuleViaUI() {
107103
// Navigate to alerts and actions page
108104
await ml.navigation.navigateToAlertsAndAction();
@@ -115,15 +111,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
115111

116112
// Configure alert parameters
117113
await ml.alerting.selectJobs([AD_JOB_ID]);
118-
await ml.alerting.selectResultType('bucket');
114+
await ml.alerting.selectResultType('record');
119115
await ml.alerting.setSeverity(0);
120116

121117
// Set advanced settings
122118
await ml.alerting.setTopNBuckets(3);
123119

124120
// Set alert name and interval
125121
await pageObjects.triggersActionsUI.setAlertName('ml-explorer-alert-ui');
126-
await pageObjects.triggersActionsUI.setAlertInterval(1, 'm');
122+
await pageObjects.triggersActionsUI.setAlertInterval(10, 's');
127123

128124
// Save the alert
129125
await pageObjects.triggersActionsUI.saveAlert();
@@ -201,9 +197,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
201197
// Ingest anomalous data to trigger the alert
202198
await ingestAnomalousDoc(BASIC_TEST_DATA_INDEX);
203199

204-
// Wait for ML bucket to finalize (bucket_span is 1m)
205-
await sleep(60 * 1000);
206-
207200
// Wait for alert to be created
208201
await waitForAlertsInIndex(1);
209202

0 commit comments

Comments
 (0)