Skip to content

Commit

Permalink
[9.0] Fixes Failing test: Jest Integration Tests.x-pack/platform/plug…
Browse files Browse the repository at this point in the history
…ins/shared/task_manager/server/integration_tests - unrecognized task types should be no workload aggregator errors when there are removed task types (#210399) (#210844)

# Backport

This will backport the following commits from `main` to `9.0`:
- [Fixes Failing test: Jest Integration
Tests.x-pack/platform/plugins/shared/task_manager/server/integration_tests
- unrecognized task types should be no workload aggregator errors when
there are removed task types
(#210399)](#210399)

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

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

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2025-02-12T14:30:38Z","message":"Fixes
Failing test: Jest Integration
Tests.x-pack/platform/plugins/shared/task_manager/server/integration_tests
- unrecognized task types should be no workload aggregator errors when
there are removed task types (#210399)\n\nResolves
https://github.com/elastic/kibana/issues/208459\r\n\r\n##
Summary\r\n\r\nThe fix added in
this\r\n[PR](#206598) to call
the\r\n`mark_removed_tasks_as_unrecognized` tasks sometimes throws an
error if\r\nthe task is in the middle of running. This PR adds a
try/catch and a\r\nretry to the `runSoon`
call.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"5500eab90ca7053a7741f9274e3886f4a7460228","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:Task
Manager","Team:ResponseOps","v9.0.0","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"Fixes
Failing test: Jest Integration
Tests.x-pack/platform/plugins/shared/task_manager/server/integration_tests
- unrecognized task types should be no workload aggregator errors when
there are removed task
types","number":210399,"url":"https://github.com/elastic/kibana/pull/210399","mergeCommit":{"message":"Fixes
Failing test: Jest Integration
Tests.x-pack/platform/plugins/shared/task_manager/server/integration_tests
- unrecognized task types should be no workload aggregator errors when
there are removed task types (#210399)\n\nResolves
https://github.com/elastic/kibana/issues/208459\r\n\r\n##
Summary\r\n\r\nThe fix added in
this\r\n[PR](#206598) to call
the\r\n`mark_removed_tasks_as_unrecognized` tasks sometimes throws an
error if\r\nthe task is in the middle of running. This PR adds a
try/catch and a\r\nretry to the `runSoon`
call.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"5500eab90ca7053a7741f9274e3886f4a7460228"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.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/210399","number":210399,"mergeCommit":{"message":"Fixes
Failing test: Jest Integration
Tests.x-pack/platform/plugins/shared/task_manager/server/integration_tests
- unrecognized task types should be no workload aggregator errors when
there are removed task types (#210399)\n\nResolves
https://github.com/elastic/kibana/issues/208459\r\n\r\n##
Summary\r\n\r\nThe fix added in
this\r\n[PR](#206598) to call
the\r\n`mark_removed_tasks_as_unrecognized` tasks sometimes throws an
error if\r\nthe task is in the middle of running. This PR adds a
try/catch and a\r\nretry to the `runSoon`
call.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"5500eab90ca7053a7741f9274e3886f4a7460228"}},{"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>
  • Loading branch information
kibanamachine and ymao1 authored Feb 12, 2025
1 parent 9bf5653 commit fa8594f
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ jest.mock('../monitoring/workload_statistics', () => {
};
});

// FLAKY: https://github.com/elastic/kibana/issues/208459
describe.skip('unrecognized task types', () => {
describe('unrecognized task types', () => {
let esServer: TestElasticsearchUtils;
let kibanaServer: TestKibanaUtils;
let taskManagerPlugin: TaskManagerStartContract;
Expand Down Expand Up @@ -114,8 +113,16 @@ describe.skip('unrecognized task types', () => {
taskIdsToRemove.push(notRegisteredTypeId);

// To be sure that the background task that marks removed tasks as unrecognized has run after the tasks were created
const runSoonResponse = await taskManagerPlugin.runSoon('mark_removed_tasks_as_unrecognized');
expect(runSoonResponse).toEqual({ id: 'mark_removed_tasks_as_unrecognized' });
await retry(async () => {
try {
const runSoonResponse = await taskManagerPlugin.runSoon(
'mark_removed_tasks_as_unrecognized'
);
expect(runSoonResponse).toEqual({ id: 'mark_removed_tasks_as_unrecognized' });
} catch (err) {
// ignore errors and retry
}
});

await retry(async () => {
const task = await getTask(kibanaServer.coreStart.elasticsearch.client.asInternalUser);
Expand Down

0 comments on commit fa8594f

Please sign in to comment.