Skip to content

Commit c4c20e4

Browse files
authored
feat(cdk-v2): fixing assertion tests to work with both v1 and v2 (#370)
* feat(cdk-v2): fixing assertion tests to work with both v1 and v2 * feat(cdk-v2): fixing assertion tests to work with both v1 and v2 * feat(cdk-v2): fixing assertion tests to work with both v1 and v2
1 parent 0dbe295 commit c4c20e4

File tree

8 files changed

+11
-525
lines changed

8 files changed

+11
-525
lines changed

.viperlightignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ source/patterns/@aws-solutions-constructs/aws-lambda-sqs/test/integ.existingFunc
1919
source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/test/integ.apigateway-sqs-crud.expected.json:201
2020
source/tools/cdk-integ-tools/package-lock.json:373
2121
source/patterns/@aws-solutions-constructs/core/test/step-function-helper.test.js:115
22-
source/patterns/@aws-solutions-constructs/core/test/lambda-helper.test.ts:297
22+
source/patterns/@aws-solutions-constructs/core/test/lambda-helper.test.ts:248
2323
source/patterns/@aws-solutions-constructs/aws-dynamodb-stream-lambda/test/dynamodb-stream-lambda.test.ts:102
2424
source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/test/dynamodbstreams-lambda.test.ts:102
2525
source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/test/iot-lambda-dynamodb.test.ts:219

source/patterns/@aws-solutions-constructs/aws-eventbridge-sns/test/eventbridge-sns-topic.test.ts

-57
Original file line numberDiff line numberDiff line change
@@ -213,63 +213,6 @@ test('check the sns topic properties with existing KMS key', () => {
213213
});
214214

215215
expect(stack).toHaveResource('AWS::KMS::Key', {
216-
KeyPolicy: {
217-
Statement: [
218-
{
219-
Action: [
220-
"kms:Create*",
221-
"kms:Describe*",
222-
"kms:Enable*",
223-
"kms:List*",
224-
"kms:Put*",
225-
"kms:Update*",
226-
"kms:Revoke*",
227-
"kms:Disable*",
228-
"kms:Get*",
229-
"kms:Delete*",
230-
"kms:ScheduleKeyDeletion",
231-
"kms:CancelKeyDeletion",
232-
"kms:GenerateDataKey",
233-
"kms:TagResource",
234-
"kms:UntagResource"
235-
],
236-
Effect: "Allow",
237-
Principal: {
238-
AWS: {
239-
"Fn::Join": [
240-
"",
241-
[
242-
"arn:",
243-
{
244-
Ref: "AWS::Partition"
245-
},
246-
":iam::",
247-
{
248-
Ref: "AWS::AccountId"
249-
},
250-
":root"
251-
]
252-
]
253-
}
254-
},
255-
Resource: "*"
256-
},
257-
{
258-
Action: [
259-
"kms:Decrypt",
260-
"kms:Encrypt",
261-
"kms:ReEncrypt*",
262-
"kms:GenerateDataKey*"
263-
],
264-
Effect: "Allow",
265-
Principal: {
266-
Service: "events.amazonaws.com"
267-
},
268-
Resource: "*"
269-
}
270-
],
271-
Version: "2012-10-17"
272-
},
273216
Description: "my-key",
274217
EnableKeyRotation: true
275218
});

source/patterns/@aws-solutions-constructs/aws-eventbridge-sqs/test/eventbridge-sqs-queue.test.ts

-57
Original file line numberDiff line numberDiff line change
@@ -101,63 +101,6 @@ test('check the sqs queue properties with existing KMS key', () => {
101101
});
102102

103103
expect(stack).toHaveResource('AWS::KMS::Key', {
104-
KeyPolicy: {
105-
Statement: [
106-
{
107-
Action: [
108-
"kms:Create*",
109-
"kms:Describe*",
110-
"kms:Enable*",
111-
"kms:List*",
112-
"kms:Put*",
113-
"kms:Update*",
114-
"kms:Revoke*",
115-
"kms:Disable*",
116-
"kms:Get*",
117-
"kms:Delete*",
118-
"kms:ScheduleKeyDeletion",
119-
"kms:CancelKeyDeletion",
120-
"kms:GenerateDataKey",
121-
"kms:TagResource",
122-
"kms:UntagResource"
123-
],
124-
Effect: "Allow",
125-
Principal: {
126-
AWS: {
127-
"Fn::Join": [
128-
"",
129-
[
130-
"arn:",
131-
{
132-
Ref: "AWS::Partition"
133-
},
134-
":iam::",
135-
{
136-
Ref: "AWS::AccountId"
137-
},
138-
":root"
139-
]
140-
]
141-
}
142-
},
143-
Resource: "*"
144-
},
145-
{
146-
Action: [
147-
"kms:Decrypt",
148-
"kms:Encrypt",
149-
"kms:ReEncrypt*",
150-
"kms:GenerateDataKey*"
151-
],
152-
Effect: "Allow",
153-
Principal: {
154-
Service: "events.amazonaws.com"
155-
},
156-
Resource: "*"
157-
}
158-
],
159-
Version: "2012-10-17"
160-
},
161104
Description: "my-key",
162105
EnableKeyRotation: true
163106
});

source/patterns/@aws-solutions-constructs/aws-events-rule-sns/test/events-rule-sns-topic.test.ts

-57
Original file line numberDiff line numberDiff line change
@@ -213,63 +213,6 @@ test('check the sns topic properties with existing KMS key', () => {
213213
});
214214

215215
expect(stack).toHaveResource('AWS::KMS::Key', {
216-
KeyPolicy: {
217-
Statement: [
218-
{
219-
Action: [
220-
"kms:Create*",
221-
"kms:Describe*",
222-
"kms:Enable*",
223-
"kms:List*",
224-
"kms:Put*",
225-
"kms:Update*",
226-
"kms:Revoke*",
227-
"kms:Disable*",
228-
"kms:Get*",
229-
"kms:Delete*",
230-
"kms:ScheduleKeyDeletion",
231-
"kms:CancelKeyDeletion",
232-
"kms:GenerateDataKey",
233-
"kms:TagResource",
234-
"kms:UntagResource"
235-
],
236-
Effect: "Allow",
237-
Principal: {
238-
AWS: {
239-
"Fn::Join": [
240-
"",
241-
[
242-
"arn:",
243-
{
244-
Ref: "AWS::Partition"
245-
},
246-
":iam::",
247-
{
248-
Ref: "AWS::AccountId"
249-
},
250-
":root"
251-
]
252-
]
253-
}
254-
},
255-
Resource: "*"
256-
},
257-
{
258-
Action: [
259-
"kms:Decrypt",
260-
"kms:Encrypt",
261-
"kms:ReEncrypt*",
262-
"kms:GenerateDataKey*"
263-
],
264-
Effect: "Allow",
265-
Principal: {
266-
Service: "events.amazonaws.com"
267-
},
268-
Resource: "*"
269-
}
270-
],
271-
Version: "2012-10-17"
272-
},
273216
Description: "my-key",
274217
EnableKeyRotation: true
275218
});

source/patterns/@aws-solutions-constructs/aws-events-rule-sqs/test/events-rule-sqs-queue.test.ts

-57
Original file line numberDiff line numberDiff line change
@@ -101,63 +101,6 @@ test('check the sqs queue properties with existing KMS key', () => {
101101
});
102102

103103
expect(stack).toHaveResource('AWS::KMS::Key', {
104-
KeyPolicy: {
105-
Statement: [
106-
{
107-
Action: [
108-
"kms:Create*",
109-
"kms:Describe*",
110-
"kms:Enable*",
111-
"kms:List*",
112-
"kms:Put*",
113-
"kms:Update*",
114-
"kms:Revoke*",
115-
"kms:Disable*",
116-
"kms:Get*",
117-
"kms:Delete*",
118-
"kms:ScheduleKeyDeletion",
119-
"kms:CancelKeyDeletion",
120-
"kms:GenerateDataKey",
121-
"kms:TagResource",
122-
"kms:UntagResource"
123-
],
124-
Effect: "Allow",
125-
Principal: {
126-
AWS: {
127-
"Fn::Join": [
128-
"",
129-
[
130-
"arn:",
131-
{
132-
Ref: "AWS::Partition"
133-
},
134-
":iam::",
135-
{
136-
Ref: "AWS::AccountId"
137-
},
138-
":root"
139-
]
140-
]
141-
}
142-
},
143-
Resource: "*"
144-
},
145-
{
146-
Action: [
147-
"kms:Decrypt",
148-
"kms:Encrypt",
149-
"kms:ReEncrypt*",
150-
"kms:GenerateDataKey*"
151-
],
152-
Effect: "Allow",
153-
Principal: {
154-
Service: "events.amazonaws.com"
155-
},
156-
Resource: "*"
157-
}
158-
],
159-
Version: "2012-10-17"
160-
},
161104
Description: "my-key",
162105
EnableKeyRotation: true
163106
});

0 commit comments

Comments
 (0)