mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Fixes Failing test: X-Pack Alerting API Integration Tests.x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/alerting_and_actions_telemetry·ts - alerting api integration security and spaces enabled - Group 2 Alerting and Actions Telemetry test telemetry should retrieve telemetry data in the expected format (#214868)
Resolves https://github.com/elastic/kibana/issues/202564 ## Summary The test is testing for the number of alerts generated assuming the AAD rule runs 3 times (2 alerts per run). It looks like sometimes, the rule only runs twice before the telemetry is collected so this updates the test to verify the number of alerts based on the number of times the rule ran. --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
9bbfb7e7af
commit
5e4981f18f
1 changed files with 32 additions and 26 deletions
|
@ -28,8 +28,7 @@ export default function createAlertingAndActionsTelemetryTests({ getService }: F
|
|||
const supertestWithoutAuth = getService('supertestWithoutAuth');
|
||||
const configService = getService('config');
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/202564
|
||||
describe.skip('test telemetry', () => {
|
||||
describe('test telemetry', () => {
|
||||
const objectRemover = new ObjectRemover(supertest);
|
||||
const esQueryRuleId: { [key: string]: string } = {};
|
||||
const simulator = new OpenAISimulator({
|
||||
|
@ -243,28 +242,6 @@ export default function createAlertingAndActionsTelemetryTests({ getService }: F
|
|||
actions: [],
|
||||
},
|
||||
});
|
||||
// ES query rule
|
||||
esQueryRuleId[space.id] = await createRule({
|
||||
space: space.id,
|
||||
ruleOverwrites: {
|
||||
rule_type_id: '.es-query',
|
||||
schedule: { interval: '1h' },
|
||||
throttle: null,
|
||||
params: {
|
||||
size: 100,
|
||||
timeWindowSize: 5,
|
||||
timeWindowUnit: 'm',
|
||||
thresholdComparator: '>',
|
||||
threshold: [0],
|
||||
searchType: 'esqlQuery',
|
||||
esqlQuery: {
|
||||
esql: 'from .kibana-alerting-test-data | stats c = count(date) | where c < 0',
|
||||
},
|
||||
timeField: 'date_epoch_millis',
|
||||
},
|
||||
actions: [],
|
||||
},
|
||||
});
|
||||
// MW with both toggles off
|
||||
await createMaintenanceWindow({ spaceId: space.id });
|
||||
// MW with 'Repeat' toggle on and 'Filter alerts' toggle on
|
||||
|
@ -301,6 +278,29 @@ export default function createAlertingAndActionsTelemetryTests({ getService }: F
|
|||
});
|
||||
|
||||
rulesWithAAD.push(ruleWithAadId);
|
||||
|
||||
// ES query rule
|
||||
esQueryRuleId[space.id] = await createRule({
|
||||
space: space.id,
|
||||
ruleOverwrites: {
|
||||
rule_type_id: '.es-query',
|
||||
schedule: { interval: '1h' },
|
||||
throttle: null,
|
||||
params: {
|
||||
size: 100,
|
||||
timeWindowSize: 5,
|
||||
timeWindowUnit: 'm',
|
||||
thresholdComparator: '>',
|
||||
threshold: [0],
|
||||
searchType: 'esqlQuery',
|
||||
esqlQuery: {
|
||||
esql: 'from .kibana-alerting-test-data | stats c = count(date) | where c < 0',
|
||||
},
|
||||
timeField: 'date_epoch_millis',
|
||||
},
|
||||
actions: [],
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,8 +592,14 @@ export default function createAlertingAndActionsTelemetryTests({ getService }: F
|
|||
expect(telemetry.count_mw_with_repeat_toggle_on).to.equal(3);
|
||||
|
||||
// AAD alert counts
|
||||
expect(telemetry.count_alerts_total).to.be(6);
|
||||
expect(telemetry.count_alerts_by_rule_type['test__always-firing-alert-as-data']).to.be(6);
|
||||
const numAADexecutions =
|
||||
telemetry.count_rules_executions_by_type_per_day['test__always-firing-alert-as-data'];
|
||||
|
||||
// each rule execution reports 2 active alerts
|
||||
expect(telemetry.count_alerts_total).to.be(numAADexecutions * 2);
|
||||
expect(telemetry.count_alerts_by_rule_type['test__always-firing-alert-as-data']).to.be(
|
||||
numAADexecutions * 2
|
||||
);
|
||||
}
|
||||
|
||||
it('should retrieve telemetry data in the expected format', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue