Skip to content

Commit

Permalink
Fix flaky test around search cancellation pt2 (#194687)
Browse files Browse the repository at this point in the history
Resolves #192914.

Follow up from #193008 as the
GitHub issue got re-opened
(#192914 (comment)).

In the first PR, I fixed the assertion on the error message, in this PR,
I'm fixing the assertion on the status reason which varies from
`timeout` and `execute` depending on where the error initiated from
(abort controller vs ES client).

Note: Test is not skipped as of PR creation

Flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7065
  • Loading branch information
mikecote authored Oct 3, 2024
1 parent 6c3ecd7 commit 3308625
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 3308625

Please sign in to comment.