Skip to content

Commit

Permalink
[8.x] Fix flaky test around search cancellation pt2 (elastic#194687) (e…
Browse files Browse the repository at this point in the history
…lastic#194830)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Fix flaky test around search cancellation pt2
(elastic#194687)](elastic#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":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-03T12:23:57Z","message":"Fix
flaky test around search cancellation pt2 (elastic#194687)\n\nResolves
https://github.com/elastic/kibana/issues/192914.\r\n\r\nFollow up from
elastic#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 (elastic#194687)\n\nResolves
https://github.com/elastic/kibana/issues/192914.\r\n\r\nFollow up from
elastic#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 (elastic#194687)\n\nResolves
https://github.com/elastic/kibana/issues/192914.\r\n\r\nFollow up from
elastic#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é <[email protected]>
  • Loading branch information
kibanamachine and mikecote authored Oct 3, 2024
1 parent 2ac2f9a commit 2377a4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 2377a4a

Please sign in to comment.