-
Notifications
You must be signed in to change notification settings - Fork 371
Add local testing infrastructure with AWS Lambda Runtime Interface Emulator (RIE) #1033
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
base: main
Are you sure you want to change the base?
Conversation
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.
This seems like a great addition! Thanks for this!
I'd like to see a couple of changes:
- remove
test-handler
crate, useexamples/
instead (ideally dynamically selected based on make, but i'd be happy with just a simple one being hardcoded with a RAEDME note on how to go and change it) - dockerfile not relying on exclusions but rather inclusions for future maintainability
Non-blocking: Is there any possibility of also throwing this into a github actions workflow (.github
folder) so that we can get end to end validation of one of our simpler examples on PR? Currently we wait until merge to run integration tests, which isn't ideal, since they are using real AWS calls. No worries if you don't have time for this, just would be pretty neat.
7820afe
to
6b31c83
Compare
6b31c83
to
66cd017
Compare
Thank you for the feedback and for taking the time to review my changes! I hope this resolves the comments. I apologise for the long commit, here is the summary of changes:
|
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 refactor looks great. Just need a tweak to the dockerfile to fix the CI failure as mentioned in the comment.
ADD https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie /usr/local/bin/aws-lambda-rie | ||
RUN chmod +x /usr/local/bin/aws-lambda-rie | ||
|
||
ARG EXAMPLE=basic-lambda |
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.
nice!
CONTAINER_PID=$! | ||
|
||
echo "Container started. Test with:" | ||
if [ "$EXAMPLE" = "basic-lambda" ]; then |
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.
This is a good middle ground for making it turnkey, thanks.
|
||
ARG EXAMPLE=basic-lambda | ||
|
||
COPY Cargo.toml Cargo.lock /build/ |
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.
This is causing CI failures since we don't currently have Cargo.lock
checked in (perhaps we should start, that decision predates me maintaining):
#11 [ 6/15] COPY Cargo.toml Cargo.lock /build/
#11 ERROR: failed to calculate checksum of ref 1acf8ebc-766d-4eb7-bec2-c07f6b4097da::cdqmyuggq2sgi9amxlakl71dj: "/Cargo.lock": not found
https://github.com/awslabs/aws-lambda-rust-runtime/actions/runs/17301603573/job/49114895249?pr=1033
Maybe just do COPY Cargo.*
to sidestep this issue and be agnostic about whether Cargo.lock is available?
Certainly you could update CI to use cargo-generate-lockfile but that seems kind of annoying.
📬 Issue #, if available:
✍️ Description of changes:
Summary
This PR adds local testing capabilities using the official AWS Lambda Runtime Interface Emulator (RIE), enabling developers to test the Rust runtime libraries in a containerized environment that matches AWS Lambda's runtime.
Changes
make test-rie
command for automated local testingDockerfile.rie
with Rust toolchain and RIE pre-installedlambda_runtime
crateUsage
🔏 By submitting this pull request
cargo +nightly fmt
.cargo clippy --fix
.