test(integ): add s3-asset-deploy integ (S3 zip asset upload + Lambda from local dir) - #832
Merged
Conversation
…ublishing Adds a new integration test that exercises cdkd's asset-publishing layer (FileAssetPublisher) during a real `cdkd deploy`, a path most existing Lambda fixtures skip (they use inline code or never assert the upload itself). The CdkdS3AssetDeployExample stack covers two asset paths: - A Lambda whose code comes from a local multi-file directory (lambda/ with handler + helpers/ + vendored/ Python sub-packages) so the synthesized asset is a genuine multi-file ZIP, forcing cdkd to zip the directory and upload it to the CDK bootstrap asset bucket, then wire the function Code.S3Bucket / Code.S3Key to the uploaded object. - A generic s3_assets.Asset (asset-data/) uploaded to the same bucket, with its resolved bucket/key threaded into the Lambda as CONFIG_BUCKET / CONFIG_KEY env vars (exercising cdkd's intrinsic resolver). verify.sh (BSD/macOS-portable, real rc + explicit "[verify] PASS"): - deploy, then assert CodeSize > 500 bytes (proves the function runs from the uploaded ZIP, not inline). - invoke the Lambda and assert the handler marker plus a non-zero configBytes from the generic-asset S3 read-back (proves both uploads reached AWS and the bucket/key env wiring resolved). - destroy and assert the Lambda + state file are gone with 0 errors. The bootstrap-bucket asset OBJECTS persist by design (cdkd does not own the CDK bootstrap bucket), so the script does not assert their absence. Adds the s3-asset-deploy scenario tag to the canonical taxonomy and regenerates the integ + scenario coverage matrices. Documents the new fixture in docs/changelog-cdkd.md. Not yet run against real AWS; needs /run-integ s3-asset-deploy before merge.
The changelog entry was missed in the fixture commit; add it here.
|
🎉 This PR is included in version 0.221.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the missing real-AWS integ for the S3 ZIP asset-upload deploy path. No existing fixture uses a generic
s3_assets.Assetand no verify.sh asserts the Lambda-code-from-local-dir upload (most lambda fixtures use inline code) — this fills the asset-layer gap (.claude/rules/assets.mdS3 file upload).Fixture (cheap, no VPC)
CdkdS3AssetDeployExample:AssetHandler(Python 3.12) fromlambda.Code.fromAsset('../lambda')— a real multi-file dir (handler + helpers/ + vendored/), forcing a genuine zip+upload (not inline). Synth confirmsCode.S3Bucket: {Fn::Sub: cdk-hnb659fds-assets-...}+Code.S3Key: <hash>.zip.s3assets.Asset(ConfigAsset) uploaded to the same bootstrap bucket; its resolved bucket/key threaded into the Lambda as env vars (exercises the intrinsic resolver) +grantRead.verify.sh asserts
deploy →
CodeSize > 500(proves uploaded zip, not inline) → invoke asserts the handler marker (the uploaded zip is the running code) + non-zeroconfigBytesfrom the generic-asset S3 read-back (both uploads reached AWS + bucket/key env wiring resolved) → destroy → Lambda + state gone. (Asset objects live in the shared CDK bootstrap bucket which cdkd does not own/delete — verify.sh notes this and does not assert their absence.)Real-AWS result
PASS — 0 errors, 0 orphans (44s).
Coverage matrices regenerated (union with the just-merged update-replace scenario).