Skip to content

test(#537): pin locked-down egress rule count - #543

Merged
LukasWodka merged 1 commit into
developfrom
test/537-egress-length-assert
Aug 3, 2026
Merged

test(#537): pin locked-down egress rule count#543
LukasWodka merged 1 commit into
developfrom
test/537-egress-length-assert

Conversation

@LukasWodka

@LukasWodka LukasWodka commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Fast-follow to #537@saqlainsyed007's test-robustness nit

Your suggestion on #537: assert the locked-down egress shape directly (lengthEqual on spec.egress) so a stray appended rule is caught, not just an index shift. Applied to both locked-down cases (deferred at merge to keep the approval).

One correction worth flagging: you suggested count: 3 for the pure locked-down case (DNS + MySQL + requests-proxy). It's actually 4egressProxy.enabled defaults true in values.yaml (only routeWorkloads defaults false), so the egress-proxy permit rule renders even when the case doesn't set it: DNS + MySQL + requests-proxy + egress-proxy. Both locked-down cases therefore assert count: 4, and I added a comment explaining the default so the next reader isn't surprised.

helm unittest — netpol suite 13/13, full chart 322/322.

Targets develop.

🤖 Generated with Claude Code


Note

Low Risk
Test-only changes to Helm unit tests; no runtime or template behavior is modified.

Overview
Helm unittest hardening for locked-down training NetworkPolicy cases: both tests now assert spec.egress has exactly 4 rules via lengthEqual, so an extra egress rule can’t land without failing the suite (follow-up to review on #537).

Comments document why the count is 4 (DNS, MySQL, requests-proxy, egress-proxy): egressProxy.enabled defaults true in chart values, so the egress-proxy permit rule is present even when a test case doesn’t set egressProxy.

Reviewed by Cursor Bugbot for commit 2a18e5c. Bugbot is set up for automated code reviews on this repo. Configure here.

Add direct `lengthEqual` assertions on spec.egress for the two locked-down
cases so a stray appended rule is caught, not just an index shift.

Correction vs the review suggestion: the locked-down case is 4 rules, not 3.
`egressProxy.enabled` DEFAULTS TRUE (values.yaml — only `routeWorkloads`
defaults false), so the egress-proxy permit rule renders even when the case
doesn't set it: DNS + MySQL + requests-proxy + egress-proxy. Both locked-down
cases assert count 4.

Fast-follow to the #537 review (non-blocking nit, deferred at merge).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka LukasWodka self-assigned this Aug 3, 2026
@LukasWodka

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2a18e5c. Configure here.

@saqlainsyed007 saqlainsyed007 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE — clean.

Verified the fast-follow against the template and values.yaml at head:

  • egressProxy.enabled does default true in values.yaml (only routeWorkloads defaults false), so your suggested count: 3 was indeed off by one — the egress-proxy permit rule (template rule 5, gated on .Values.egressProxy.enabled) renders even in the case that doesn't set egressProxy. count: 4 (DNS + MySQL + requests-proxy + egress-proxy) is the correct pin for both locked-down cases. Good catch on the correction, and the inline comment documenting the default is exactly the right call for the next reader.
  • The lengthEqual on spec.egress exercises the real rendered policy (not vacuous), and the counts are consistent with rule 2 dropping when allowExternalHttps: false (MySQL shifts to egress[1], requests-proxy to egress[2], egress-proxy at egress[3]).
  • Positional identity is pinned across the two cases (egress[1]=mysql, egress[2]=requests-proxy, egress[3]=egress-proxy), so the count assertion complements the identity checks rather than replacing them — a swapped rule at a pinned index still fails. No brittleness-vs-value gap worth blocking.

Consistent with the #537 change it follows. Ship it.

@LukasWodka
LukasWodka merged commit c5970e5 into develop Aug 3, 2026
24 checks passed
@LukasWodka

Copy link
Copy Markdown
Contributor Author

/fr-pass

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.

2 participants