chore(CI): convert DEPLOYMENTS to map in test files#19869
chore(CI): convert DEPLOYMENTS to map in test files#19869
Conversation
Replace List<Deployment> with Map<String, Deployment> in test files to eliminate O(n) linear searches when looking up deployments by name. Changed files use the pattern from PR #19414 (NetworkFlowTest): - Direct map access: DEPLOYMENTS[name] instead of .find { it.name == name } - Iteration: DEPLOYMENTS.values() for loops - Conversion: .collectEntries { [(it.name): it] } K8sEventDetectionTest required special handling due to dynamic registration pattern (empty map initialization and map assignment). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace List<Deployment> with Map<String, Deployment> in 4 more test files to eliminate O(n) linear searches when looking up deployments by name. Files updated: - ProcessBaselinesTest.groovy (7 .find usages → map access) - ProcessesListeningOnPortsTest.groovy (6 .find usages → map access) - DefaultPoliciesTest.groovy (1 .find usage → map access) - VulnScanWithGraphQLTest.groovy (1 .find usage → map access) Changes follow the pattern from PR #19414 (NetworkFlowTest): - Direct map access: DEPLOYMENTS[name] or targetDeployments[name] - Iteration: .values() for loops - Conversion: .collectEntries { [(it.name): it] } ProcessBaselinesTest required special handling as DEPLOYMENTS is created via .collect transformation before the .collectEntries conversion. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19869 +/- ##
==========================================
- Coverage 49.60% 49.58% -0.02%
==========================================
Files 2763 2766 +3
Lines 208339 208530 +191
==========================================
+ Hits 103344 103408 +64
- Misses 97330 97449 +119
- Partials 7665 7673 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 Build Images ReadyImages are ready for commit 142943e. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-576-g142943e521 |
|
@janisz: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Replace
List<Deployment>withMap<String, Deployment>in test files to eliminate searches when looking up deployments by name.Changed files use the pattern from PR
K8sEventDetectionTest required special handling due to dynamic
registration pattern (empty map initialization and map assignment).
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com
User-facing documentation
Testing and quality
Automated testing
How I validated my change
CI