fix(ecr): Repository.addToResourcePolicy returns incorrect result#21137
fix(ecr): Repository.addToResourcePolicy returns incorrect result#21137mergify[bot] merged 5 commits intoaws:mainfrom
Conversation
|
hmm… lets add test |
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
Thank you for your contribution. We'll need tests for this change before we can provide a meaningful review. Please also ensure the title and body of the PR align to the guidelines in the Pull Request section of our contributing guide.
|
Thank you for your comment. As a starting point, I reviewed the title and text of the PR. I'm going to add a test |
Pull request has been modified.
|
@Mergifyio update |
✅ Branch has been successfully updated |
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
I'd like to see a little bit more robust testing. Please see my comment below and let me know if you have any questions. Once you've made the change and/or if you have questions, please assign this review to me so I can follow up quickly.
| })).toThrow(/must follow the specified pattern/); | ||
| }); | ||
|
|
||
| test('return value addToResourcePolicy', () => { |
There was a problem hiding this comment.
Thanks for adding this test. Let's also add a test that looks at the actual output of calling this on a policy statement with concrete values. One test where the policy document is already defined and one where it is not.
There was a problem hiding this comment.
ok. Update to a test that checks all return values, not just singular
|
Did this build locally? I'm seeing that the build hangs in the same spot each time I run it in CodeBuild. |
|
@Mergifyio update |
✅ Branch has been successfully updated |
|
OK, so I pulled this down locally to run and see what the result was and I'm getting this |
Pull request has been modified.
9b11003 to
e78f43e
Compare
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
Looks good, just one more thing: Can you add one more test where there is already a policy document and test against the full output of that as well?
Pull request has been modified.
@TheRealAmazonKendra |
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
Looks good, just one more thing: Can you add one more test where there is already a policy document and test against the full output of that as well?
@TheRealAmazonKendra I tried to fix the test. I hope there is a corresponding image.
That test is great. I'd like a second test, though, where there is an already existing policy statement within the policy document and that the entire policy document is as expected after performing the mutation on it with const artifact = new ecr.Repository(stack, 'Repo1').addToResourcePolicy(policyStmt); Your test shows that it adds the statement to an empty policy document properly, but let's make sure it also adds it correctly to one with content already in it.
8937dd6 to
0483ae2
Compare
Pull request has been modified.
0483ae2 to
d90fc04
Compare
d90fc04 to
291351d
Compare
|
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). |
…s#21137) fixes aws#12412 To fix Repository.addToResourcePolicy returning incorrect result (false-> true) ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `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* ----
fixes #12412
To fix Repository.addToResourcePolicy returning incorrect result (false-> true)
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