You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(cli): cdk import works when used on a stack containing a nodejs lambda function (#33372)
### 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 old test is removed.
The new test ensures that `cdk import` works when an already-deployed stack contains a NodeJSFunction lambda. In our test, we deploy a stack containing a NodeJSFunction Lambda. We also create, orphan, and import an S3 bucket, which replicates the customer scenario in issue #31999.
The test:
1. Installs `esbuild` so that we can use it for bundling.
2. Deploys a NodeJSFunction and an S3 bucket.
3. Orphans the S3 bucket but allows the bucket to persist (not destroyed).
4. Imports the S3 bucket into the template using its `BucketName` property.
The test will fail if the import operation fails for any reason.
The test does not assert any specific values or patterns for asset metadata keys. When investigating the issue, the metadata keys were different when using import-synth (skipped bundling) and deploy/diff/synth (did not skip bundling). The difference in the keys was another symptom of the same issue.
### 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
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
0 commit comments