Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(standardize encryption props) Standardize how encryption properties are used for SNS/SQS constructs. #846

Merged
merged 2 commits into from
Nov 21, 2022

Conversation

georgebearden
Copy link
Contributor

This PR standardizes how encryption properties are used across all constructs that utilize SQS Queues or SNS Topics. The core sns-helper and sqs-helper classes have been updated to be aware of encryption properties of the underlying queueProps and topicProps properties respectively. This PR passes all existing tests, and includes new tests to cover the various ways encryption can be set.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: githubautobuild-for-cdk-v2
  • Commit ID: 4beac61
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@biffgaut biffgaut left a comment

Choose a reason for hiding this comment

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

As I read the unit tests for each construct, I got an impression that some only added 1 test while most added about 4. So I went and checked the path coverage for the affected constructs. While most were 100%, I also found:

Eventbridge-sqs 75%
Lambda-sns 90%
Lambda-sqs 77.7%

Can we check if the paths that we may have added are covered? Especially for the two in the seventies. (if you see a good way to get these in the 80's regardless of the reason, that would be great).

*/
readonly enableEncryptionWithCustomerManagedKey?: boolean;
readonly enableEncryptionWithCustomerManagedKey?: boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we dropping semicolons?

It makes us inconsistent across the library. I realize the Javascript (so therefore probably Typescript) provides "Automatic Semicolon Insertion" in "certain situations." Rather than depend upon everyone memorizing these "certain situations" we'll use semicolons everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The identified constructs above (eventbridge-sqs, lambda-sns, lambda-sqs) have updated tests and are now at 100% coverage.

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: githubautobuild-for-cdk-v2
  • Commit ID: 39c1708
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Comment on lines -99 to -101
if (props.deployVpc && props.existingVpc) {
throw new Error("More than 1 VPC specified in the properties");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted because this check is redundant and can never be hit. This check is already being done from the defaults.CheckProps call here

Comment on lines -117 to -119
if (props.deployVpc && props.existingVpc) {
throw new Error("More than 1 VPC specified in the properties");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted because this check is redundant and can never be hit. This check is already being done from the defaults.CheckProps call here****

expect(app).toThrowError('Error - Either provide an existingVpc or some combination of deployVpc and vpcProps, but not both.');
});

test('Queue purging flag grants correct permissions', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@biffgaut Let's follow up on an observation I made regarding this test.

@biffgaut biffgaut merged commit cdc0b5a into main Nov 21, 2022
@biffgaut biffgaut deleted the standardize-sns-sqs-encryption-properties branch November 21, 2022 15:49
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.

3 participants