You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(sqs): does not print all failed validations for Queue props (#33070)
### Issue #33098Closes#33098.
### Reason for this change
When initializing a new SQS Queue, props validation throws an error at the first validation issue encountered. If there are multiple validation issues, the user is only informed of the first one.
### Description of changes
Using `validateAllProps` presents all validation errors to the user at once. If `redriveAllowPolicy` is enabled, the policy will also be evaluated in the same way.
### Describe any new or updated permissions being added
No permissions changes.
### Description of how you validated changes
Adjusted and added unit tests. Ran integration tests.
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@@ -62,18 +63,29 @@ test('with a dead letter queue', () => {
62
63
expect(queue.deadLetterQueue).toEqual(dlqProps);
63
64
});
64
65
66
+
test('multiple prop validation errors are presented to the user (out-of-range retentionPeriod and deliveryDelay)',()=>{
67
+
// GIVEN
68
+
conststack=newStack();
69
+
70
+
// THEN
71
+
expect(()=>newsqs.Queue(stack,'MyQueue',{
72
+
retentionPeriod: Duration.seconds(30),
73
+
deliveryDelay: Duration.minutes(16),
74
+
})).toThrow('Queue initialization failed due to the following validation error(s):\n- delivery delay must be between 0 and 900 seconds, but 960 was provided\n- message retention period must be between 60 and 1,209,600 seconds, but 30 was provided');
75
+
});
76
+
65
77
test('message retention period must be between 1 minute to 14 days',()=>{
})).toThrow('Queue initialization failed due to the following validation error(s):\n- message retention period must be between 60 and 1,209,600 seconds, but 30 was provided');
})).toThrow('Queue initialization failed due to the following validation error(s):\n- message retention period must be between 60 and 1,209,600 seconds, but 1296000 was provided');
77
89
});
78
90
79
91
test('message retention period can be provided as a parameter',()=>{
@@ -155,6 +167,65 @@ test('addToPolicy will automatically create a policy for this queue', () => {
.toThrow("Queue initialization failed due to the following validation error(s):\n- sourceQueues cannot be configured when RedrivePermission is set to 'allowAll' or 'denyAll'");
196
+
});
197
+
198
+
test('throws when sourceQueues is not provided with BY_QUEUE permission',()=>{
.toThrow("Queue initialization failed due to the following validation error(s):\n- At least one source queue must be specified when RedrivePermission is set to 'byQueue'");
210
+
});
211
+
212
+
test('throws when more than 10 sourceQueues are provided',()=>{
.toThrow("Queue initialization failed due to the following validation error(s):\n- Up to 10 sourceQueues can be specified. Set RedrivePermission to 'allowAll' to specify more");
0 commit comments