-
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
test(cli): cdk import bundles and emits proper metadata #33372
base: main
Are you sure you want to change the base?
Conversation
…ith other synth methods
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33372 +/- ##
=======================================
Coverage 80.92% 80.92%
=======================================
Files 236 236
Lines 14256 14256
Branches 2491 2491
=======================================
Hits 11537 11537
Misses 2434 2434
Partials 285 285
Flags with carried forward coverage won't be shown. Click here to find out more.
|
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
* | ||
*/ | ||
integTest( | ||
'CDK import adds the metadata properties expected by sam, validates that bundling is not skipped', |
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.
Consider the issue we're trying to fix - does this test accurately simulate the scenario described in the issue?
It does address the root cause that we identified, but it doesn't give us enough guarantees that the original issue is actually fixed. It might be that something else will block the expected behavior. Think about the manual test you ran to validate the fix works, can you reproduce that manual test here?
- Deploy a stack with
NodeJsFunction
construct. - Create a bucket out of band
- Run
cdk import --resource-mappings
Should be feasible...
As for the scenarios you put here, they can serve as additional, quicker tests, that help us diagnose the issue in case of failures, but should not be the only ones. Prefer many small tests over fewer large complicated ones.
Also is the withSamIntegrationFixture
really needed here? I understand it might be convenient because it has constructs you want as well, but seems like it also has a bunch of other things that we don't need. See if you can write your own stack in the normal app fixture, tailored to your use case.
Improves testing for #33322.
Reason for this change
The original test (removed below) does not adequately test the CDK import fix from the above-mentioned PR. It calls CDK synth, but does not use the CLI and does not test
cdk import
.Description of changes
The test below covers many cases where code is supposed to be bundled, and appropriate metadata is supposed to be emitted. It ensures that CDK Import will bundle code when it synthesizes a new template.
Describe any new or updated permissions being added
No permissions changes.
Description of how you validated changes
This PR tests the feature. I ensured that the test failed on code prior to the change in PR #33322, and passes on code following the change.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license