Skip to content

chore(CI): convert DEPLOYMENTS to map in test files#19869

Open
janisz wants to merge 2 commits intomasterfrom
simplify_deployments
Open

chore(CI): convert DEPLOYMENTS to map in test files#19869
janisz wants to merge 2 commits intomasterfrom
simplify_deployments

Conversation

@janisz
Copy link
Copy Markdown
Contributor

@janisz janisz commented Apr 7, 2026

Description

Replace List<Deployment> with Map<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

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

CI

janisz and others added 2 commits April 7, 2026 16:27
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
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.58%. Comparing base (a408a6b) to head (142943e).
⚠️ Report is 5 commits behind head on master.

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     
Flag Coverage Δ
go-unit-tests 49.58% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

🚀 Build Images Ready

Images are ready for commit 142943e. To use with deploy scripts:

export MAIN_IMAGE_TAG=4.11.x-576-g142943e521

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 7, 2026

@janisz: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/gke-qa-e2e-tests 142943e link false /test gke-qa-e2e-tests
ci/prow/gke-upgrade-tests 142943e link false /test gke-upgrade-tests
ci/prow/ocp-4-12-nongroovy-e2e-tests 142943e link false /test ocp-4-12-nongroovy-e2e-tests

Full PR test history. Your PR dashboard.

Details

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant