-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Response Ops][Task Manager] Adding integration test to ensure no WorkloadAggregator
errors when there are unrecognized task types.
#193479
Conversation
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#6983[❌] x-pack/test/plugin_api_integration/config.ts: 13/100 tests passed. |
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#6989[❌] x-pack/test/plugin_api_integration/config.ts: 12/100 tests passed. |
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#6991[❌] x-pack/test/plugin_api_integration/config.ts: 14/100 tests passed. |
ea470d6
to
c7cec63
Compare
WorkloadAggregator
errors when there are unrecognized task types.
Pinging @elastic/response-ops (Team:ResponseOps) |
Should we run the flaky tests again? Didn't see any running right now - or maybe you were using those for some research? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left a note about changing the task claimer :-)
const setupResult = await setupTestServers({ | ||
xpack: { | ||
task_manager: { | ||
claim_strategy: `update_by_query`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm ... should we test both claimers? I think for the test this is ultimately making, it's not needed.
But I was curious about hard-coding the claim_strategy
, and I did notice a lot of usage of claim_strategy: 'default'
in the code (search on claim_strategy
), which is presumably logging an error once, and then returning "the default". :-)
kibana/x-pack/plugins/task_manager/server/task_claimers/index.ts
Lines 52 to 65 in c28af87
export function getTaskClaimer(logger: Logger, strategy: string): TaskClaimerFn { | |
switch (strategy) { | |
case CLAIM_STRATEGY_UPDATE_BY_QUERY: | |
return claimAvailableTasksUpdateByQuery; | |
case CLAIM_STRATEGY_MGET: | |
return claimAvailableTasksMget; | |
} | |
if (!WarnedOnInvalidClaimer) { | |
WarnedOnInvalidClaimer = true; | |
logger.warn(`Unknown task claiming strategy "${strategy}", falling back to update_by_query`); | |
} | |
return claimAvailableTasksUpdateByQuery; | |
} |
So, thinking maybe change this to default
- if testing with one is fine. That way it'll track the default we use, when we switch the default to mget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I can remove the hard-coded claimer and it will just use whatever the default is, whenever we switch it, it'll test the default? That makes sense to me.
I can create a followup issue for the default
claim strategies. Probably an oversight from when we switched from default
to update_by_query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated all the claim_strategy: 'default'
to update_by_query
in this commit: a58040c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the hard-coded claim strategy in the jest integration test in this commit: f463ff7
I originally tried updating a functional test and was running the flaky test runner on that FT but abandoned that approach in favor of a jest integration test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @ymao1 |
…rkloadAggregator` errors when there are unrecognized task types. (elastic#193479) Fixes elastic/kibana-team#1036 ## Summary Adding integration test as RCA action for incident where unrecognized task types was causing issues generating the workload portion of the task manager health report. ## To verify Add this line to your code to that will throw an error when there are unrecognized task types when generating the health report ``` --- a/x-pack/plugins/task_manager/server/task_type_dictionary.ts +++ b/x-pack/plugins/task_manager/server/task_type_dictionary.ts @@ -128,6 +128,7 @@ export class TaskTypeDictionary { } public get(type: string): TaskDefinition | undefined { + this.ensureHas(type); return this.definitions.get(type); } ``` Run the integration test `node scripts/jest_integration.js x-pack/plugins/task_manager/server/integration_tests/removed_types.test.ts` and see that it fails because a `WorkloadAggregator` error is logged. --------- Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit 01eae15)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…no `WorkloadAggregator` errors when there are unrecognized task types. (#193479) (#194016) # Backport This will backport the following commits from `main` to `8.x`: - [[Response Ops][Task Manager] Adding integration test to ensure no `WorkloadAggregator` errors when there are unrecognized task types. (#193479)](#193479) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Ying Mao","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-25T14:22:11Z","message":"[Response Ops][Task Manager] Adding integration test to ensure no `WorkloadAggregator` errors when there are unrecognized task types. (#193479)\n\nFixes https://github.com/elastic/kibana-team/issues/1036\r\n\r\n## Summary\r\n\r\nAdding integration test as RCA action for incident where unrecognized\r\ntask types was causing issues generating the workload portion of the\r\ntask manager health report.\r\n\r\n## To verify\r\n\r\nAdd this line to your code to that will throw an error when there are\r\nunrecognized task types when generating the health report\r\n\r\n```\r\n--- a/x-pack/plugins/task_manager/server/task_type_dictionary.ts\r\n+++ b/x-pack/plugins/task_manager/server/task_type_dictionary.ts\r\n@@ -128,6 +128,7 @@ export class TaskTypeDictionary {\r\n }\r\n\r\n public get(type: string): TaskDefinition | undefined {\r\n+ this.ensureHas(type);\r\n return this.definitions.get(type);\r\n }\r\n```\r\n\r\nRun the integration test `node scripts/jest_integration.js\r\nx-pack/plugins/task_manager/server/integration_tests/removed_types.test.ts`\r\nand see that it fails because a `WorkloadAggregator` error is logged.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"01eae1556266c8377f6557f4ccacc53e0b4db7fc","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:Task Manager","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.16.0"],"title":"[Response Ops][Task Manager] Adding integration test to ensure no `WorkloadAggregator` errors when there are unrecognized task types.","number":193479,"url":"https://github.com/elastic/kibana/pull/193479","mergeCommit":{"message":"[Response Ops][Task Manager] Adding integration test to ensure no `WorkloadAggregator` errors when there are unrecognized task types. (#193479)\n\nFixes https://github.com/elastic/kibana-team/issues/1036\r\n\r\n## Summary\r\n\r\nAdding integration test as RCA action for incident where unrecognized\r\ntask types was causing issues generating the workload portion of the\r\ntask manager health report.\r\n\r\n## To verify\r\n\r\nAdd this line to your code to that will throw an error when there are\r\nunrecognized task types when generating the health report\r\n\r\n```\r\n--- a/x-pack/plugins/task_manager/server/task_type_dictionary.ts\r\n+++ b/x-pack/plugins/task_manager/server/task_type_dictionary.ts\r\n@@ -128,6 +128,7 @@ export class TaskTypeDictionary {\r\n }\r\n\r\n public get(type: string): TaskDefinition | undefined {\r\n+ this.ensureHas(type);\r\n return this.definitions.get(type);\r\n }\r\n```\r\n\r\nRun the integration test `node scripts/jest_integration.js\r\nx-pack/plugins/task_manager/server/integration_tests/removed_types.test.ts`\r\nand see that it fails because a `WorkloadAggregator` error is logged.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"01eae1556266c8377f6557f4ccacc53e0b4db7fc"}},"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/193479","number":193479,"mergeCommit":{"message":"[Response Ops][Task Manager] Adding integration test to ensure no `WorkloadAggregator` errors when there are unrecognized task types. (#193479)\n\nFixes https://github.com/elastic/kibana-team/issues/1036\r\n\r\n## Summary\r\n\r\nAdding integration test as RCA action for incident where unrecognized\r\ntask types was causing issues generating the workload portion of the\r\ntask manager health report.\r\n\r\n## To verify\r\n\r\nAdd this line to your code to that will throw an error when there are\r\nunrecognized task types when generating the health report\r\n\r\n```\r\n--- a/x-pack/plugins/task_manager/server/task_type_dictionary.ts\r\n+++ b/x-pack/plugins/task_manager/server/task_type_dictionary.ts\r\n@@ -128,6 +128,7 @@ export class TaskTypeDictionary {\r\n }\r\n\r\n public get(type: string): TaskDefinition | undefined {\r\n+ this.ensureHas(type);\r\n return this.definitions.get(type);\r\n }\r\n```\r\n\r\nRun the integration test `node scripts/jest_integration.js\r\nx-pack/plugins/task_manager/server/integration_tests/removed_types.test.ts`\r\nand see that it fails because a `WorkloadAggregator` error is logged.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"01eae1556266c8377f6557f4ccacc53e0b4db7fc"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Ying Mao <[email protected]>
Fixes https://github.com/elastic/kibana-team/issues/1036
Summary
Adding integration test as RCA action for incident where unrecognized task types was causing issues generating the workload portion of the task manager health report.
To verify
Add this line to your code to that will throw an error when there are unrecognized task types when generating the health report
Run the integration test
node scripts/jest_integration.js x-pack/plugins/task_manager/server/integration_tests/removed_types.test.ts
and see that it fails because aWorkloadAggregator
error is logged.