feat(assertions): add function for verifying the number of matching resource properties#21707
feat(assertions): add function for verifying the number of matching resource properties#21707mergify[bot] merged 3 commits intoaws:mainfrom ddneilson:ddneilson/resource_properties_count
Conversation
This PR adds the `Template.resourcePropertiesCountIs()` method for counting the number of resources of a specified type whose `Properties` section matches given properties.
| // special case to exclude AbsentMatch because adding an empty Properties object will affect its evaluation. | ||
| if (!Matcher.isMatcher(props) || !(props instanceof AbsentMatch)) { | ||
| // amended needs to be a deep copy to avoid modifying the template. | ||
| amended = JSON.parse(JSON.stringify(template)); |
There was a problem hiding this comment.
This is a bonus little optimization that I noticed while in the code. Unconditionally stringifying and parsing a template will negatively impact performance; those are not cheap operations.
|
Regarding the PR Linter failure. It is failing due to this PR not adding integ tests. There are no integ tests in the assertions module; it's a testing module, not a constructs module. I see no point in adding integ tests of some sort to that module. |
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
Please make sure that your PR title confirms to the conventional commit standard (fix, feat, chore) and that it is written in a style that will reflect correctly in the change log (See Contributing Guide, Pull Requests)
Pull request has been modified.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This PR adds the
Template.resourcePropertiesCountIs()method for counting the number of resources of a specified type whosePropertiessection matches given properties.Implements: #21706
All Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integto deploy the infrastructure and generate the snapshot (i.e.yarn integwithout--dry-run)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license