-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(assertions): allResources and allResourcesProperties methods #22007
Conversation
I don't think that I need to write an integration test for this PR, but please let me know if I do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
Thank you for your engagement and submitting a review.
I would like to prod a bit more in the reasoning that is behind your thinking that integ tests should not be part of this review: mind adding the insight?
if (result.match) { | ||
if (result.mismatches) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can a result
both match and mismatch (naming might be decreasing the ease of reading)?
Why are there no tests for the new functionality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took another look at this and decided to take mismatches
out of the MatchSuccess
. I agree it's confusing and after testing the functionality I realized I wasn't getting the information that I wanted in the error output.
I reworked the functionality for easier readability and better messaging
|
||
```ts | ||
template.allResources('Foo::Bar', { | ||
Properties: { Foo: 'Bar' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark about disambiguating stands for this example.
if (closestResult === undefined || closestResult.failCount > result.failCount) { | ||
closestResult = result; | ||
} | ||
} | ||
}, | ||
); | ||
if (Object.keys(matching).length > 0) { | ||
return { match: true, matches: matching }; | ||
return { match: true, matches: matching, analyzedCount: count, mismatches: closestResult }; | ||
} else { | ||
return { match: false, closestResult, analyzedCount: count }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add testing for the change around count
.
Unit tests are important here since we're changing functionality. I don't think Integration tests make sense since we aren't changing anything related to CloudFormation resources/asset deployment. |
Pull request has been modified.
export type MatchSuccess = { match: true, matches: { [key: string]: any }, analyzed: { [key: string]: any }, analyzedCount: number }; | ||
export type MatchFailure = { match: false, closestResult?: MatchResult, analyzed: { [key: string]: any }, analyzedCount: number }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we can technically remove analyzedCount
here, but I kept it since it's being used in other places and convenient to use.
If we want I can remove this field and update the other places to use Object.keys(analyzed).length
@Mergifyio update |
✅ Branch has been successfully updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Pull Request Linter fails with the following errors:
❌ Features must contain a change to an integration test file and the resulting snapshot.
PRs must pass status checks before we can provide a meaningful review.
@Naumel Is this good to go, or are there other changes needed? |
Pull request has been modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.
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). |
@Mergifyio refresh |
✅ Pull request refreshed |
Pull request has been modified.
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). |
Closes #21269
All Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integ
to deploy the infrastructure and generate the snapshot (i.e.yarn integ
without--dry-run
)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license