ESD-1615-fix(nat-gateway): validate speed/session matrix on update path#515
ESD-1615-fix(nat-gateway): validate speed/session matrix on update path#515Phil-Browne wants to merge 4 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #515 +/- ##
=======================================
Coverage 79.29% 79.29%
=======================================
Files 193 193
Lines 18683 18688 +5
=======================================
+ Hits 14814 14819 +5
Misses 2820 2820
Partials 1049 1049
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR closes a validation gap in the NAT gateway update workflow by applying the same speed/session-count matrix validation that already existed on the create path, ensuring unsupported combinations are rejected client-side before hitting the API.
Changes:
- Refactors
validateNATGatewaySpeedSessionMatrixto acceptspeedandsessionCountdirectly (instead of a create request). - Adds matrix validation to
UpdateNATGatewayafter the partial-update merge so the effective (merged) values are validated. - Adds update-path test coverage for unsupported speed/session-count combinations and for “fail open” behavior when the matrix cannot be fetched.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/commands/nat_gateway/nat_gateway_actions.go | Refactors the matrix validation helper and applies it to the update path after defaults are merged. |
| internal/commands/nat_gateway/nat_gateway_test.go | Adds focused tests ensuring update rejects invalid matrix pairs and fails open when the matrix fetch fails. |
The speed/session-count availability matrix check ran only on create. Update accepts --speed/--session-count too, so an unsupported pair on update sailed past client-side checks straight to the API. Refactor the validator to take speed/session-count directly and call it from UpdateNATGateway after the partial-update merge, so it checks the effective values.
cfe783a to
a29aec3
Compare
|
The matrix check is correct on the create path, but on update it over-rejects. |
UpdateNATGateway ran the speed/session matrix check unconditionally after merging defaults, so a grandfathered gateway whose speed/session pair was later dropped from the matrix would fail a name/term/auto-renew-only update even though speed and session count weren't touched. Only validate when the post-merge speed or session count actually differs from the original.
|
Fixed in 9df9901. Rather than gating on Added a regression test ( |
…-gateway-update-matrix
…-gateway-update-matrix
Follow-up to #507. That PR added client-side speed/session-count matrix validation, but only on the create path.
nat-gateway update --speed X --session-count Ystill let an unsupported pair through to the API.validateNATGatewaySpeedSessionMatrixto take speed/session-count directly instead of the create request.UpdateNATGatewayafter the partial-update merge, so it validates the effective (merged) values.