Skip to content

Conversation

AntoniaSzecsi
Copy link

📬 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

  • RIE testing infrastructure: New make test-rie command for automated local testing
  • Docker setup: Dockerfile.rie with Rust toolchain and RIE pre-installed
  • Test handler: Demonstrates runtime functionality using local lambda_runtime crate
  • Documentation: Updated README with RIE testing section
  • Build automation: Script handles Docker build, compilation, and RIE startup

Usage

make test-rie

🔏 By submitting this pull request

  • I confirm that I've ran cargo +nightly fmt.
  • I confirm that I've ran cargo clippy --fix.
  • I confirm that I've made a best effort attempt to update all relevant documentation.
  • I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@jlizen jlizen left a 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, use examples/ 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.

@AntoniaSzecsi AntoniaSzecsi force-pushed the lszecsi/local-test-RIE branch 2 times, most recently from 7820afe to 6b31c83 Compare August 28, 2025 15:50
@AntoniaSzecsi AntoniaSzecsi force-pushed the lszecsi/local-test-RIE branch from 6b31c83 to 66cd017 Compare August 28, 2025 16:12
@AntoniaSzecsi
Copy link
Author

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:

  • Delete test-handler/ directory and .dockerignore file
  • Replace 'COPY . /build' with explicit COPY statements
  • Add dynamically handler selection based on MakeFile
  • Add GitHub Actions workflow for RIE testing

@AntoniaSzecsi AntoniaSzecsi requested a review from jlizen August 28, 2025 16:22
Copy link
Contributor

@jlizen jlizen left a 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
Copy link
Contributor

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
Copy link
Contributor

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/
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants