Fixes Failing test: X-Pack Alerting API Integration Tests - Alerting - group3.x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group3/builtin_alert_types/es_query/rule·ts - Alerting builtin alertTypes es_query rule runs correctly: threshold on ungrouped hit count < > for esQuery search type (#215604)

Resolves https://github.com/elastic/kibana/issues/194701

## Summary

The rule conditions are testing that the doc count > -1 but we're
testing that the evaluated value is > 0. Because an evaluated value of 0
will also match the rule condition, occasionally this expect would fail.
Updated the test to match what is allowed by the rule condition.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Ying Mao 2025-03-28 14:40:18 -04:00 committed by GitHub
parent 0bb73eec2c
commit df728ab823
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -50,8 +50,7 @@ export default function ruleTests({ getService }: FtrProviderContext) {
{ label: 'host.name', searchPath: 'host.name' },
];
// FLAKY: https://github.com/elastic/kibana/issues/194701
describe.skip('rule', () => {
describe('rule', () => {
let endDate: string;
let connectorId: string;
const objectRemover = new ObjectRemover(supertest);
@ -183,7 +182,7 @@ export default function ruleTests({ getService }: FtrProviderContext) {
);
expect(alertDoc['kibana.alert.evaluation.threshold']).to.eql(-1);
const value = parseInt(alertDoc['kibana.alert.evaluation.value'], 10);
expect(value).greaterThan(0);
expect(value >= 0).to.be(true);
expect(alertDoc[ALERT_URL]).to.contain('/s/space1/app/');
expect(alertDoc['host.name']).to.eql(['host-1']);
expect(alertDoc['host.hostname']).to.eql(['host-1']);