Skip to content

chore(CI): clenaup network flow test#19414

Merged
janisz merged 4 commits intomasterfrom
cleanup_network_flow_test
Mar 16, 2026
Merged

chore(CI): clenaup network flow test#19414
janisz merged 4 commits intomasterfrom
cleanup_network_flow_test

Conversation

@janisz
Copy link
Copy Markdown
Contributor

@janisz janisz commented Mar 13, 2026

Description

Change deployments from list to map to allow direct access instead of find

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

Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
@janisz janisz requested review from parametalol and vikin91 March 13, 2026 12:03
@rhacs-bot
Copy link
Copy Markdown
Contributor

rhacs-bot commented Mar 13, 2026

Images are ready for the commit at c22c6cb.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-322-gc22c6cb604.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.71%. Comparing base (66a258b) to head (c22c6cb).
⚠️ Report is 10 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19414   +/-   ##
=======================================
  Coverage   49.70%   49.71%           
=======================================
  Files        2701     2701           
  Lines      203453   203453           
=======================================
+ Hits       101134   101138    +4     
+ Misses      94790    94787    -3     
+ Partials     7529     7528    -1     
Flag Coverage Δ
go-unit-tests 49.71% <ø> (+<0.01%) ⬆️

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.

Previous refactoring changed deployments from List to Map but missed
updating iteration and property access, causing test failures:
- GroovyCastException: iterating Map yields Map.Entry, not Deployment
- NullPointerException: Maps don't have .name property

Fixes:
- Use deployments.values() for iteration in destroyDeployments()
- Use deployments.keySet().join() for query string construction
- Add type annotations to modified lines (String, boolean)

User request: Fix test failures, keep diff minimal, add types only to changed lines

Partially AI-assisted.
@janisz janisz force-pushed the cleanup_network_flow_test branch from d3ee8bc to aefbfb4 Compare March 13, 2026 14:40
@janisz janisz requested a review from parametalol March 13, 2026 14:41
@janisz janisz changed the title chore(CI): clenaup netowrk flow test chore(CI): clenaup network flow test Mar 13, 2026
janisz added 2 commits March 13, 2026 16:59
The spread operator on a Map iterates over Map.Entry objects, not values.
Changed deployments*.namespace to deployments.values()*.namespace to fix
MissingPropertyException.

Partially AI-assisted.
@janisz janisz merged commit e97eee2 into master Mar 16, 2026
90 checks passed
@janisz janisz deleted the cleanup_network_flow_test branch March 16, 2026 11:15
janisz added a commit that referenced this pull request Apr 7, 2026
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>
janisz added a commit that referenced this pull request Apr 7, 2026
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>
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.

4 participants