[8.16] 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) (#216368)

# Backport

This will backport the following commits from `main` to `8.16`:
- [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)](https://github.com/elastic/kibana/pull/215604)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2025-03-28T18:40:18Z","message":"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)\n\nResolves
https://github.com/elastic/kibana/issues/194701\n\n## Summary\n\nThe
rule conditions are testing that the doc count > -1 but we're\ntesting
that the evaluated value is > 0. Because an evaluated value of 0\nwill
also match the rule condition, occasionally this expect would
fail.\nUpdated the test to match what is allowed by the rule
condition.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"df728ab823e2fb007a816d98f99faf1fef558b4c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","v8.16.0","backport:version","v9.1.0","v8.19.0"],"title":"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","number":215604,"url":"https://github.com/elastic/kibana/pull/215604","mergeCommit":{"message":"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)\n\nResolves
https://github.com/elastic/kibana/issues/194701\n\n## Summary\n\nThe
rule conditions are testing that the doc count > -1 but we're\ntesting
that the evaluated value is > 0. Because an evaluated value of 0\nwill
also match the rule condition, occasionally this expect would
fail.\nUpdated the test to match what is allowed by the rule
condition.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"df728ab823e2fb007a816d98f99faf1fef558b4c"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/215604","number":215604,"mergeCommit":{"message":"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)\n\nResolves
https://github.com/elastic/kibana/issues/194701\n\n## Summary\n\nThe
rule conditions are testing that the doc count > -1 but we're\ntesting
that the evaluated value is > 0. Because an evaluated value of 0\nwill
also match the rule condition, occasionally this expect would
fail.\nUpdated the test to match what is allowed by the rule
condition.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"df728ab823e2fb007a816d98f99faf1fef558b4c"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ying Mao <ying.mao@elastic.co>
This commit is contained in:
Kibana Machine 2025-03-28 21:37:19 +01:00 committed by GitHub
parent a96987c38c
commit 91f571069c
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']);