fix(rds): add lower bound validation for ClusterInstance promotionTier#37519
fix(rds): add lower bound validation for ClusterInstance promotionTier#37519
Conversation
|
I think it's better to add a unit test. |
4342386 to
481aa21
Compare
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
@badmintoncryer |
|
|
||||||||||||||
|
|
||||||||||||||
481aa21 to
cc4a9de
Compare
|
Exemption Request This is a validation-only fix that rejects invalid input earlier (at synth time |
aws-cdk-automation
left a comment
There was a problem hiding this comment.
The pull request linter fails with the following errors:
❌ Fixes must contain a change to an integration test file and the resulting snapshot.
If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.
✅ A exemption request has been requested. Please wait for a maintainer's review.
| [-1, /promotionTier must be between 0-15/], | ||
| [16, /promotionTier must be between 0-15/], | ||
| ])('when promotionTier is %s', (promotionTier, errorMessage) => { |
There was a problem hiding this comment.
I think errorMessage variable is not needed.
| [-1, /promotionTier must be between 0-15/], | |
| [16, /promotionTier must be between 0-15/], | |
| ])('when promotionTier is %s', (promotionTier, errorMessage) => { | |
| -1, 16, | |
| ])('when promotionTier is %s', (promotionTier) => { |
promotionTier only validated the upper bound (> 15) but did not reject negative values. Added check for < 0 to match the documented range of 0-15 and the existing error message.
Issue # (if applicable)
Closes #37518
Reason for this change
ClusterInstance'spromotionTiervalidation only checkedthis.tier > 15butdid not reject negative values. The error message already stated "must be between
0-15", but the lower bound was not enforced. Negative values passed synth
silently and failed at CloudFormation deploy time.
Description of changes
Added
this.tier < 0to the existing validation condition inaurora-cluster-instance.ts:Added unit tests for both boundary violations (promotionTier: -1 and
promotionTier: 16) using test.each, following the existing pattern in
cluster.test.ts.
Describe any new or updated permissions being added
N/A. This is a validation-only change.
Description of how you validated changes
values
CloudFormation templates for valid inputs
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license