[8.x] Fix flaky test around search cancellation pt2 (#194687) (#194830)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Fix flaky test around search cancellation pt2
(#194687)](https://github.com/elastic/kibana/pull/194687)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Mike
Côté","email":"mikecote@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-03T12:23:57Z","message":"Fix
flaky test around search cancellation pt2 (#194687)\n\nResolves
https://github.com/elastic/kibana/issues/192914.\r\n\r\nFollow up from
https://github.com/elastic/kibana/pull/193008 as the\r\nGitHub issue got
re-opened\r\n(https://github.com/elastic/kibana/issues/192914#issuecomment-2383972707).\r\n\r\nIn
the first PR, I fixed the assertion on the error message, in this
PR,\r\nI'm fixing the assertion on the status reason which varies
from\r\n`timeout` and `execute` depending on where the error initiated
from\r\n(abort controller vs ES client).\r\n\r\nNote: Test is not
skipped as of PR creation\r\n\r\nFlaky test
runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7065","sha":"330862524d89a9ab9fcf8931169759a99e5e44a6","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.16.0"],"title":"Fix
flaky test around search cancellation
pt2","number":194687,"url":"https://github.com/elastic/kibana/pull/194687","mergeCommit":{"message":"Fix
flaky test around search cancellation pt2 (#194687)\n\nResolves
https://github.com/elastic/kibana/issues/192914.\r\n\r\nFollow up from
https://github.com/elastic/kibana/pull/193008 as the\r\nGitHub issue got
re-opened\r\n(https://github.com/elastic/kibana/issues/192914#issuecomment-2383972707).\r\n\r\nIn
the first PR, I fixed the assertion on the error message, in this
PR,\r\nI'm fixing the assertion on the status reason which varies
from\r\n`timeout` and `execute` depending on where the error initiated
from\r\n(abort controller vs ES client).\r\n\r\nNote: Test is not
skipped as of PR creation\r\n\r\nFlaky test
runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7065","sha":"330862524d89a9ab9fcf8931169759a99e5e44a6"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194687","number":194687,"mergeCommit":{"message":"Fix
flaky test around search cancellation pt2 (#194687)\n\nResolves
https://github.com/elastic/kibana/issues/192914.\r\n\r\nFollow up from
https://github.com/elastic/kibana/pull/193008 as the\r\nGitHub issue got
re-opened\r\n(https://github.com/elastic/kibana/issues/192914#issuecomment-2383972707).\r\n\r\nIn
the first PR, I fixed the assertion on the error message, in this
PR,\r\nI'm fixing the assertion on the status reason which varies
from\r\n`timeout` and `execute` depending on where the error initiated
from\r\n(abort controller vs ES client).\r\n\r\nNote: Test is not
skipped as of PR creation\r\n\r\nFlaky test
runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7065","sha":"330862524d89a9ab9fcf8931169759a99e5e44a6"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-10-04 00:01:22 +10:00 committed by GitHub
parent 2ac2f9a27e
commit 2377a4a10f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -146,7 +146,7 @@ export default function ruleTests({ getService }: FtrProviderContext) {
`test.cancellableRule:${ruleId}: execution cancelled due to timeout - exceeded rule type timeout of 3s`,
].includes(rule.execution_status.error.message)
).to.eql(true);
expect(rule.execution_status.error.reason).to.eql('timeout');
expect(['timeout', 'execute'].includes(rule.execution_status.error.reason)).to.eql(true);
});
it('throws an error if execution is short circuited', async () => {
@ -195,7 +195,7 @@ export default function ruleTests({ getService }: FtrProviderContext) {
`test.cancellableRule:${ruleId}: execution cancelled due to timeout - exceeded rule type timeout of 3s`,
].includes(rule.execution_status.error.message)
).to.eql(true);
expect(rule.execution_status.error.reason).to.eql('timeout');
expect(['timeout', 'execute'].includes(rule.execution_status.error.reason)).to.eql(true);
});
interface CreateRuleParams {

View file

@ -80,7 +80,7 @@ export default function ruleTests({ getService }: FtrProviderContext) {
`test.patternLongRunning.cancelAlertsOnRuleTimeout:${ruleId}: execution cancelled due to timeout - exceeded rule type timeout of 3s`,
].includes(lastErrorStatus?.error.message || '')
).to.eql(true);
expect(lastErrorStatus?.error.reason).to.eql('timeout');
expect(['timeout', 'execute'].includes(lastErrorStatus?.error.reason || '')).to.eql(true);
});
it('writes event log document for timeout for each rule execution that ends in timeout - some executions times out', async () => {