From 54a76ca3a5ef6120701733f1f583e4ff1266f70b Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Thu, 19 Feb 2026 16:46:33 +0000 Subject: [PATCH 01/30] refactor: :recycle: adding a new script that selectively builds specific examples --- Makefile | 7 +++++++ scripts/build-examples.sh | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 scripts/build-examples.sh diff --git a/Makefile b/Makefile index d27d0e47f..29bab7814 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,10 @@ INTEG_EXTENSIONS := extension-fn extension-trait logs-trait # Using musl to run extensions on both AL1 and AL2 INTEG_ARCH := x86_64-unknown-linux-musl RIE_MAX_CONCURRENCY ?= 4 +OUTPUT_DIR ?= /tmp/var-task +EXAMPLES ?= + +.PHONY: pr-check integration-tests check-event-features fmt build-examples test-rie test-rie-lmi define uppercase $(shell sed -r 's/(^|-)(\w)/\U\2/g' <<< $(1)) @@ -112,6 +116,9 @@ check-event-features: fmt: cargo +nightly fmt --all +build-examples: + ./scripts/build-examples.sh + test-rie: ./scripts/test-rie.sh $(EXAMPLE) diff --git a/scripts/build-examples.sh b/scripts/build-examples.sh new file mode 100755 index 000000000..fb4e276b6 --- /dev/null +++ b/scripts/build-examples.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +OUTPUT_DIR="${OUTPUT_DIR:-/tmp/var-task}" +EXAMPLES="${EXAMPLES:-}" + +mkdir -p "$OUTPUT_DIR" + +echo "Building examples: $(EXAMPLES)" + + +for example in ${EXAMPLES}; do + dir="examples/$example" + [ ! -f "$dir/Cargo.toml" ] && echo "✗ $example not found" && continue + + echo "Building $example..." + (cd "$dir" && cargo build --release) || continue + + [ -f "$dir/target/release/$example" ] && cp "$dir/target/release/$example" "$OUTPUT_DIR/" && echo "✓ $example" +done + +echo "" +ls -lh "$OUTPUT_DIR/" 2>/dev/null || echo "No binaries built" From 2cbcb4f844c677ce21d105c4bcb811fa1535e0de Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Thu, 19 Feb 2026 16:48:21 +0000 Subject: [PATCH 02/30] refactor: :recycle: add a custom lambda-entrypoint to select different binaries when called in the dockerfile. --- scripts/custom-lambda-entrypoint.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/custom-lambda-entrypoint.sh diff --git a/scripts/custom-lambda-entrypoint.sh b/scripts/custom-lambda-entrypoint.sh new file mode 100644 index 000000000..fb02b26c5 --- /dev/null +++ b/scripts/custom-lambda-entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# custom entrypoint script to allow selection of multiple rust binaries for dockerized tests +set -e + +HANDLER=${1:-basic-lambda} + +if [ -f "/var/task/$HANDLER" ]; then + ln -sf "/var/task/$HANDLER" "${LAMBDA_RUNTIME_DIR}/bootstrap" + exec /usr/local/bin/aws-lambda-rie "${LAMBDA_RUNTIME_DIR}/bootstrap" +else + echo "Error: Handler '$HANDLER' not found in /var/task" + echo "Available handlers:" + ls -la /var/task + exit 1 +fi From 7aa7c0b2173cfcbeccb056be91e46c376afefb0e Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Thu, 19 Feb 2026 16:51:37 +0000 Subject: [PATCH 03/30] refactor: :recycle: modifying dockerfile to include both the build script and the custom entrypoint. Changing test-rie signature. --- Dockerfile.rie | 26 +++++++++++++++++--------- Makefile | 2 +- scripts/test-rie.sh | 13 +++++-------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Dockerfile.rie b/Dockerfile.rie index 1a46b5771..350fda67a 100644 --- a/Dockerfile.rie +++ b/Dockerfile.rie @@ -1,25 +1,33 @@ FROM public.ecr.aws/lambda/provided:al2023 -RUN dnf install -y gcc +RUN dnf install -y gcc make RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" +ENV EXAMPLES="basic-lambda basic-lambda-concurrent" +ENV OUTPUT_DIR="/var/task" + 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 Cargo.* /build/ COPY lambda-runtime /build/lambda-runtime COPY lambda-runtime-api-client /build/lambda-runtime-api-client COPY lambda-events /build/lambda-events COPY lambda-http /build/lambda-http COPY lambda-extension /build/lambda-extension -COPY examples/${EXAMPLE} /build/examples/${EXAMPLE} +COPY examples /build/examples +COPY scripts/custom-lambda-entrypoint.sh /usr/local/bin/lambda-entrypoint +COPY scripts/build-examples.sh /build/ + +WORKDIR /build + +RUN chmod +x /usr/local/bin/lambda-entrypoint +RUN chmod +x build-examples.sh + +# Build only basic-lambda example +RUN ./build-examples.sh -WORKDIR /build/examples/${EXAMPLE} -RUN cargo build --release -RUN cp target/release/${EXAMPLE} ${LAMBDA_RUNTIME_DIR}/bootstrap -ENTRYPOINT [] -CMD [ "/usr/local/bin/aws-lambda-rie", "/var/runtime/bootstrap" ] \ No newline at end of file +ENTRYPOINT ["/usr/local/bin/lambda-entrypoint"] +CMD ["basic-lambda"] \ No newline at end of file diff --git a/Makefile b/Makefile index 29bab7814..95064ab80 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ build-examples: ./scripts/build-examples.sh test-rie: - ./scripts/test-rie.sh $(EXAMPLE) + ./scripts/test-rie.sh # Run RIE in Lambda Managed Instance (LMI) mode with concurrent polling. test-rie-lmi: diff --git a/scripts/test-rie.sh b/scripts/test-rie.sh index 3561a8ee5..928d212e7 100755 --- a/scripts/test-rie.sh +++ b/scripts/test-rie.sh @@ -1,12 +1,11 @@ #!/bin/bash set -euo pipefail -EXAMPLE=${1:-basic-lambda} # Optional: set RIE_MAX_CONCURRENCY to enable LMI mode (emulates AWS_LAMBDA_MAX_CONCURRENCY) RIE_MAX_CONCURRENCY=${RIE_MAX_CONCURRENCY:-} -echo "Building Docker image with RIE for example: $EXAMPLE..." -docker build -f Dockerfile.rie --build-arg EXAMPLE=$EXAMPLE -t rust-lambda-rie-test . +echo "Building Docker image with RIE" +docker build -f Dockerfile.rie -t rust-lambda-rie-test . echo "Starting RIE container on port 9000..." if [ -n "$RIE_MAX_CONCURRENCY" ]; then @@ -18,11 +17,9 @@ fi CONTAINER_PID=$! echo "Container started. Test with:" -if [ "$EXAMPLE" = "basic-lambda" ] || [ "$EXAMPLE" = "basic-lambda-concurrent" ]; then - echo "curl -XPOST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d '{\"command\": \"test from RIE\"}' -H 'Content-Type: application/json'" -else - echo "For example '$EXAMPLE', check examples/$EXAMPLE/src/main.rs for the expected payload format." -fi +echo "curl -XPOST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d '{\"command\": \"test from RIE\"}' -H 'Content-Type: application/json'" +echo "or for a specific example check under examples/ for the expected payload format." + echo "" echo "Press Ctrl+C to stop the container." From 9eb1b466609c9e06e9e68ac89a72c70e483df21c Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Thu, 19 Feb 2026 17:22:57 +0000 Subject: [PATCH 04/30] refactor: :recycle add nuke continaers to the makefile --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 95064ab80..428305d9b 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ RIE_MAX_CONCURRENCY ?= 4 OUTPUT_DIR ?= /tmp/var-task EXAMPLES ?= -.PHONY: pr-check integration-tests check-event-features fmt build-examples test-rie test-rie-lmi +.PHONY: pr-check integration-tests check-event-features fmt build-examples test-rie test-rie-lmi nuke define uppercase $(shell sed -r 's/(^|-)(\w)/\U\2/g' <<< $(1)) @@ -122,6 +122,10 @@ build-examples: test-rie: ./scripts/test-rie.sh +nuke: + docker kill $$(docker ps -q) + + # Run RIE in Lambda Managed Instance (LMI) mode with concurrent polling. test-rie-lmi: RIE_MAX_CONCURRENCY=$(RIE_MAX_CONCURRENCY) ./scripts/test-rie.sh $(EXAMPLE) From 8ce868b684c58a5b46fbc086e9fc7fec4899d038 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Fri, 20 Feb 2026 00:07:15 +0000 Subject: [PATCH 05/30] test: :sparkles: add harness testing capability --- .github/workflows/dockerized-test.yml | 24 ++++++++++++++ .gitignore | 1 + Dockerfile.rie | 24 +++++++------- Dockerfile.test-runner | 28 ++++++++++++++++ Makefile | 48 +++++++++++++++++++++++++-- test/dockerized/core.json | 19 +++++++++++ 6 files changed, 130 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/dockerized-test.yml create mode 100644 Dockerfile.test-runner create mode 100644 test/dockerized/core.json diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml new file mode 100644 index 000000000..cd0c8dde3 --- /dev/null +++ b/.github/workflows/dockerized-test.yml @@ -0,0 +1,24 @@ +name: dockerized-test + +on: + push: + branches: [ main ] + pull_request: + branches: [ '*' ] + workflow_dispatch: + +jobs: + dockerized-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Build the image + run: docker build . -t local/test -f Dockerfile.rie + + - name: Run tests + uses: aws/containerized-test-runner-for-aws-lambda@v1 + with: + suiteFileArray: '["./tests/dockerized/*.json"]' + dockerImageName: 'local/test' \ No newline at end of file diff --git a/.gitignore b/.gitignore index d5e188a43..de557146e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ target lambda-runtime/libtest.rmeta lambda-integration-tests/target Cargo.lock +.test-runner # Built AWS Lambda zipfile lambda.zip diff --git a/Dockerfile.rie b/Dockerfile.rie index 350fda67a..1dd2658ae 100644 --- a/Dockerfile.rie +++ b/Dockerfile.rie @@ -1,15 +1,11 @@ -FROM public.ecr.aws/lambda/provided:al2023 +FROM public.ecr.aws/lambda/provided:al2023 AS builder RUN dnf install -y gcc make RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" -ENV EXAMPLES="basic-lambda basic-lambda-concurrent" +ENV EXAMPLES="basic-lambda" ENV OUTPUT_DIR="/var/task" - -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 - COPY Cargo.* /build/ COPY lambda-runtime /build/lambda-runtime COPY lambda-runtime-api-client /build/lambda-runtime-api-client @@ -17,17 +13,21 @@ COPY lambda-events /build/lambda-events COPY lambda-http /build/lambda-http COPY lambda-extension /build/lambda-extension COPY examples /build/examples -COPY scripts/custom-lambda-entrypoint.sh /usr/local/bin/lambda-entrypoint COPY scripts/build-examples.sh /build/ WORKDIR /build +RUN chmod +x build-examples.sh && ./build-examples.sh -RUN chmod +x /usr/local/bin/lambda-entrypoint -RUN chmod +x build-examples.sh +# Final Image +FROM public.ecr.aws/lambda/provided:al2023 + +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 -# Build only basic-lambda example -RUN ./build-examples.sh +COPY scripts/custom-lambda-entrypoint.sh /usr/local/bin/lambda-entrypoint +RUN chmod +x /usr/local/bin/lambda-entrypoint +COPY --from=builder /var/task /var/task ENTRYPOINT ["/usr/local/bin/lambda-entrypoint"] -CMD ["basic-lambda"] \ No newline at end of file +CMD ["basic-lambda"] diff --git a/Dockerfile.test-runner b/Dockerfile.test-runner new file mode 100644 index 000000000..b6f377163 --- /dev/null +++ b/Dockerfile.test-runner @@ -0,0 +1,28 @@ +FROM python:3.11-slim + +# Install build dependencies for pyjq and Docker CLI +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + gcc \ + g++ \ + make \ + autoconf \ + automake \ + libtool \ + ca-certificates \ + curl \ + && curl -fsSL https://get.docker.com -o get-docker.sh \ + && sh get-docker.sh \ + && rm get-docker.sh \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# Copy the test runner source +COPY .test-runner/ . + +# Install the test runner +RUN pip install --no-cache-dir . + +# Set the entrypoint +ENTRYPOINT ["python", "-m", "containerized_test_runner.cli"] diff --git a/Makefile b/Makefile index 428305d9b..37e459f89 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,9 @@ RIE_MAX_CONCURRENCY ?= 4 OUTPUT_DIR ?= /tmp/var-task EXAMPLES ?= -.PHONY: pr-check integration-tests check-event-features fmt build-examples test-rie test-rie-lmi nuke +.PHONY: help pr-check integration-tests check-event-features fmt build-examples test-rie test-rie-lmi nuke test-dockerized + +.DEFAULT_GOAL := help define uppercase $(shell sed -r 's/(^|-)(\w)/\U\2/g' <<< $(1)) @@ -119,13 +121,55 @@ fmt: build-examples: ./scripts/build-examples.sh +test-dockerized: + @echo "Running dockerized tests locally..." + @echo "Building Docker image..." + docker build . -t local/test -f Dockerfile.rie + @echo "Setting up containerized test runner..." + @if [ ! -d ".test-runner" ]; then \ + echo "Cloning containerized-test-runner-for-aws-lambda..."; \ + git clone --quiet https://github.com/aws/containerized-test-runner-for-aws-lambda.git .test-runner; \ + fi + @echo "Building test runner Docker image..." + @docker build -t test-runner:local -f Dockerfile.test-runner . + @echo "Running tests in Docker..." + @echo "Running actual tests..." + @docker run --rm \ + -e DOCKER_API_VERSION=1.44 \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v "$(CURDIR)/tests/dockerized:/tests:ro" \ + test-runner:local \ + --test-image local/test \ + --debug \ + /tests/*.json + test-rie: ./scripts/test-rie.sh nuke: docker kill $$(docker ps -q) - # Run RIE in Lambda Managed Instance (LMI) mode with concurrent polling. test-rie-lmi: RIE_MAX_CONCURRENCY=$(RIE_MAX_CONCURRENCY) ./scripts/test-rie.sh $(EXAMPLE) + +help: ## Show this help message + @echo 'Usage: make [target]' + @echo '' + @echo 'Available targets:' + @echo ' pr-check Run pre-commit checks (fmt, clippy, tests)' + @echo ' integration-tests Build and run AWS integration tests' + @echo ' check-event-features Test individual event features' + @echo ' fmt Format code with cargo fmt' + @echo ' build-examples Build example Lambda functions' + @echo ' Usage: EXAMPLES="basic-lambda" make build-examples' + @echo ' test-rie Test Lambda with Runtime Interface Emulator' + @echo ' test-rie-lmi Test RIE in Lambda Managed Instance mode' + @echo ' Usage: RIE_MAX_CONCURRENCY=4 make test-rie-lmi' + @echo ' test-dockerized Run dockerized test harness' + @echo ' nuke Kill all running Docker containers' + @echo '' + @echo 'Environment variables:' + @echo ' EXAMPLES Space-separated list of examples to build' + @echo ' OUTPUT_DIR Directory for built binaries (default: /tmp/var-task)' + @echo ' RIE_MAX_CONCURRENCY Max concurrent Lambda invocations for LMI mode' diff --git a/test/dockerized/core.json b/test/dockerized/core.json new file mode 100644 index 000000000..5a21d0665 --- /dev/null +++ b/test/dockerized/core.json @@ -0,0 +1,19 @@ +{ + "tests": [ + { + "name": "test_echo", + "handler": "basic-lambda", + "request": { + "command": "test" + }, + "assertions": [ + { + "response": { + "msg": "Command test executed." + }, + "transform": "{msg: .msg}" + } + ] + } + ] +} From 72f658ee832c624efb1282cc46097641368e0fdc Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Fri, 20 Feb 2026 01:15:03 +0000 Subject: [PATCH 06/30] refactor: :recycle: some small fixes --- Dockerfile.rie | 7 ++++--- Makefile | 29 +++++++++++++++++------------ README.md | 19 +++++-------------- scripts/build-examples.sh | 14 +++++++------- scripts/test-rie.sh | 14 ++++++++------ tests/dockerized/core.json | 19 +++++++++++++++++++ 6 files changed, 60 insertions(+), 42 deletions(-) create mode 100644 tests/dockerized/core.json diff --git a/Dockerfile.rie b/Dockerfile.rie index 1dd2658ae..5d609ccf0 100644 --- a/Dockerfile.rie +++ b/Dockerfile.rie @@ -3,8 +3,9 @@ FROM public.ecr.aws/lambda/provided:al2023 AS builder RUN dnf install -y gcc make RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" -ENV EXAMPLES="basic-lambda" -ENV OUTPUT_DIR="/var/task" + +ARG HANDLERS_TO_BUILD="basic-lambda" +ARG OUTPUT_DIR="/var/task" COPY Cargo.* /build/ COPY lambda-runtime /build/lambda-runtime @@ -16,7 +17,7 @@ COPY examples /build/examples COPY scripts/build-examples.sh /build/ WORKDIR /build -RUN chmod +x build-examples.sh && ./build-examples.sh +RUN chmod +x build-examples.sh && HANDLERS_TO_BUILD="$HANDLERS_TO_BUILD" OUTPUT_DIR="$OUTPUT_DIR" ./build-examples.sh # Final Image FROM public.ecr.aws/lambda/provided:al2023 diff --git a/Makefile b/Makefile index 37e459f89..b475709bd 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,8 @@ INTEG_EXTENSIONS := extension-fn extension-trait logs-trait INTEG_ARCH := x86_64-unknown-linux-musl RIE_MAX_CONCURRENCY ?= 4 OUTPUT_DIR ?= /tmp/var-task -EXAMPLES ?= +HANDLERS_TO_BUILD ?= basic-lambda +HANDLER ?= basic-lambda .PHONY: help pr-check integration-tests check-event-features fmt build-examples test-rie test-rie-lmi nuke test-dockerized @@ -119,7 +120,10 @@ fmt: cargo +nightly fmt --all build-examples: - ./scripts/build-examples.sh + HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD} ./scripts/build-examples.sh + +nuke: + docker kill $$(docker ps -q) test-dockerized: @echo "Running dockerized tests locally..." @@ -144,14 +148,11 @@ test-dockerized: /tests/*.json test-rie: - ./scripts/test-rie.sh - -nuke: - docker kill $$(docker ps -q) + HANDLER="$(HANDLER)" ./scripts/test-rie.sh # Run RIE in Lambda Managed Instance (LMI) mode with concurrent polling. test-rie-lmi: - RIE_MAX_CONCURRENCY=$(RIE_MAX_CONCURRENCY) ./scripts/test-rie.sh $(EXAMPLE) + RIE_MAX_CONCURRENCY=$(RIE_MAX_CONCURRENCY) HANDLER="$(HANDLER)" ./scripts/test-rie.sh $(EXAMPLE) help: ## Show this help message @echo 'Usage: make [target]' @@ -162,14 +163,18 @@ help: ## Show this help message @echo ' check-event-features Test individual event features' @echo ' fmt Format code with cargo fmt' @echo ' build-examples Build example Lambda functions' - @echo ' Usage: EXAMPLES="basic-lambda" make build-examples' + @echo ' Usage: EXAMPLES="basic-lambda" OUTPUT_DIR=/make build-examples' @echo ' test-rie Test Lambda with Runtime Interface Emulator' + @echo ' Usage: HANDLERS_TO_BUILD="basic-lambda basic-sqs" make test-rie' + @echo ' Usage: HANDLERS_TO_BUILD="basic-lambda" HANDLER="basic-lambda" make test-rie' @echo ' test-rie-lmi Test RIE in Lambda Managed Instance mode' - @echo ' Usage: RIE_MAX_CONCURRENCY=4 make test-rie-lmi' + @echo ' Usage: RIE_MAX_CONCURRENCY=4 HANDLERS_TO_BUILD="basic-lambda-concurrent" make test-rie-lmi' @echo ' test-dockerized Run dockerized test harness' @echo ' nuke Kill all running Docker containers' @echo '' @echo 'Environment variables:' - @echo ' EXAMPLES Space-separated list of examples to build' - @echo ' OUTPUT_DIR Directory for built binaries (default: /tmp/var-task)' - @echo ' RIE_MAX_CONCURRENCY Max concurrent Lambda invocations for LMI mode' + @echo ' EXAMPLES Space-separated list of examples to build (for build-examples)' + @echo ' HANDLERS_TO_BUILD Space-separated list of handlers to build for RIE (for test-rie)' + @echo ' HANDLER Specific handler to run (defaults to first in HANDLERS_TO_BUILD)' + @echo ' OUTPUT_DIR Directory for built binaries (default: /tmp/var-task for build-examples, /var/task for Docker)' + @echo ' RIE_MAX_CONCURRENCY Max concurrent Lambda invocations for LMI mode (for test-rie-lmi)' diff --git a/README.md b/README.md index 6ff25c9b9..f1c7a5466 100644 --- a/README.md +++ b/README.md @@ -392,35 +392,26 @@ You can read more about how [cargo lambda watch](https://www.cargo-lambda.info/c ### Local testing with Runtime Interface Emulator (RIE) -For testing with the official AWS Lambda Runtime Interface Emulator, use the provided RIE testing infrastructure: +For testing with the official AWS Lambda Runtime Interface Emulator: ```bash make test-rie ``` -By default, this uses the `basic-lambda` example. To test a different example: +By default, this builds and tests the `basic-lambda` example. To build and test a custom handler: ```bash -make test-rie EXAMPLE=basic-sqs -make test-rie EXAMPLE=http-basic-lambda +HANDLER="basic-tenant-id" make test-rie ``` -To test Lambda Managed Instances (concurrent polling), use: +To test Lambda Managed Instances (concurrent polling): ```bash -make test-rie-lmi EXAMPLE=basic-lambda-concurrent +RIE_MAX_CONCURRENCY=4 make test-rie ``` -This command will: -1. Build a Docker image with Rust toolchain and RIE -2. Compile the specified example inside the Linux container -3. Start the RIE container on port 9000 -4. Display the appropriate curl command for testing - Different examples expect different payload formats. Check the example's source code in `examples/EXAMPLE_NAME/src/main.rs` -This provides automated testing with Docker and RIE, ensuring your Lambda functions work in a Linux environment identical to AWS Lambda. - ### Lambda Debug Proxy Lambdas can be run and debugged locally using a special [Lambda debug proxy](https://github.com/rimutaka/lambda-debug-proxy) (a non-AWS repo maintained by @rimutaka), which is a Lambda function that forwards incoming requests to one AWS SQS queue and reads responses from another queue. A local proxy running on your development computer reads the queue, calls your Lambda locally and sends back the response. This approach allows debugging of Lambda functions locally while being part of your AWS workflow. The Lambda handler code does not need to be modified between the local and AWS versions. diff --git a/scripts/build-examples.sh b/scripts/build-examples.sh index fb4e276b6..b479059dc 100755 --- a/scripts/build-examples.sh +++ b/scripts/build-examples.sh @@ -2,21 +2,21 @@ set -e OUTPUT_DIR="${OUTPUT_DIR:-/tmp/var-task}" -EXAMPLES="${EXAMPLES:-}" +HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD:-}" mkdir -p "$OUTPUT_DIR" -echo "Building examples: $(EXAMPLES)" +echo "Building handlers: ${HANDLERS_TO_BUILD}" -for example in ${EXAMPLES}; do - dir="examples/$example" - [ ! -f "$dir/Cargo.toml" ] && echo "✗ $example not found" && continue +for handler in ${HANDLERS_TO_BUILD}; do + dir="examples/$handler" + [ ! -f "$dir/Cargo.toml" ] && echo "✗ $handler not found" && continue - echo "Building $example..." + echo "Building $handler..." (cd "$dir" && cargo build --release) || continue - [ -f "$dir/target/release/$example" ] && cp "$dir/target/release/$example" "$OUTPUT_DIR/" && echo "✓ $example" + [ -f "$dir/target/release/$handler" ] && cp "$dir/target/release/$handler" "$OUTPUT_DIR/" && echo "✓ $handler" done echo "" diff --git a/scripts/test-rie.sh b/scripts/test-rie.sh index 928d212e7..67f3595ff 100755 --- a/scripts/test-rie.sh +++ b/scripts/test-rie.sh @@ -3,22 +3,24 @@ set -euo pipefail # Optional: set RIE_MAX_CONCURRENCY to enable LMI mode (emulates AWS_LAMBDA_MAX_CONCURRENCY) RIE_MAX_CONCURRENCY=${RIE_MAX_CONCURRENCY:-} +# Optional: specify which handler to run (defaults to first handler) +HANDLER=${HANDLER:-basic-lambda} -echo "Building Docker image with RIE" -docker build -f Dockerfile.rie -t rust-lambda-rie-test . +echo "Building Docker image with RIE (handlers: $HANDLER)" +docker build -f Dockerfile.rie --build-arg HANDLERS_TO_BUILD="$HANDLER" -t rust-lambda-rie-test . -echo "Starting RIE container on port 9000..." +echo "Starting RIE container on port 9000 with handler: $HANDLER" if [ -n "$RIE_MAX_CONCURRENCY" ]; then echo "Enabling LMI mode with AWS_LAMBDA_MAX_CONCURRENCY=$RIE_MAX_CONCURRENCY" - docker run -p 9000:8080 -e AWS_LAMBDA_MAX_CONCURRENCY="$RIE_MAX_CONCURRENCY" rust-lambda-rie-test & + docker run -p 9000:8080 -e AWS_LAMBDA_MAX_CONCURRENCY="$RIE_MAX_CONCURRENCY" rust-lambda-rie-test "$HANDLER" & else - docker run -p 9000:8080 rust-lambda-rie-test & + docker run -p 9000:8080 rust-lambda-rie-test "$HANDLER" & fi CONTAINER_PID=$! echo "Container started. Test with:" echo "curl -XPOST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d '{\"command\": \"test from RIE\"}' -H 'Content-Type: application/json'" -echo "or for a specific example check under examples/ for the expected payload format." +echo "or for a specific example check under examples/ for the expected payload format." echo "" echo "Press Ctrl+C to stop the container." diff --git a/tests/dockerized/core.json b/tests/dockerized/core.json new file mode 100644 index 000000000..03cee2a7b --- /dev/null +++ b/tests/dockerized/core.json @@ -0,0 +1,19 @@ +{ + "tests": [ + { + "name": "test_echo", + "handler": "basic-lambda", + "request": { + "command": "test" + }, + "assertions": [ + { + "response": { + "msg": "Command test executed." + }, + "transform": "{msg: .msg}" + } + ] + } + ] +} \ No newline at end of file From 2b40b80d515b837f8b9aaffcc317c21c6459a8e0 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Fri, 20 Feb 2026 01:34:15 +0000 Subject: [PATCH 07/30] chore: putting permission read --- .github/workflows/dockerized-test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index cd0c8dde3..58214cc02 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -1,5 +1,8 @@ name: dockerized-test +permissions: + contents: read + on: push: branches: [ main ] @@ -7,12 +10,13 @@ on: branches: [ '*' ] workflow_dispatch: + jobs: dockerized-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Build the image run: docker build . -t local/test -f Dockerfile.rie @@ -20,5 +24,5 @@ jobs: - name: Run tests uses: aws/containerized-test-runner-for-aws-lambda@v1 with: - suiteFileArray: '["./tests/dockerized/*.json"]' + suiteFileArray: '["./test/dockerized/*.json"]' dockerImageName: 'local/test' \ No newline at end of file From 707807436d527f8bed4e135ff45e134226f34c83 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Fri, 20 Feb 2026 01:49:58 +0000 Subject: [PATCH 08/30] chore: add readme for test-dockerized --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index f1c7a5466..6b7addf8a 100644 --- a/README.md +++ b/README.md @@ -412,6 +412,41 @@ RIE_MAX_CONCURRENCY=4 make test-rie Different examples expect different payload formats. Check the example's source code in `examples/EXAMPLE_NAME/src/main.rs` +### Dockerized test harness + +For automated testing with AWS's containerized test runner: + +```bash +make test-dockerized +``` + +This runs test suites defined in `test/dockerized/*.json` files using the [containerized-test-runner-for-aws-lambda](https://github.com/aws/containerized-test-runner-for-aws-lambda). Test suites specify handlers to test (from examples), request payloads, and expected response assertions. + +Example test suite (`test/dockerized/core.json`): +```json +{ + "tests": [ + { + "name": "test_echo", + "handler": "basic-lambda", + "request": { + "command": "test" + }, + "assertions": [ + { + "response": { + "msg": "Command test executed." + }, + "transform": "{msg: .msg}" + } + ] + } + ] +} +``` + +The `transform` field uses jq syntax to extract specific fields from responses before comparison, useful when responses include dynamic fields like request IDs. + ### Lambda Debug Proxy Lambdas can be run and debugged locally using a special [Lambda debug proxy](https://github.com/rimutaka/lambda-debug-proxy) (a non-AWS repo maintained by @rimutaka), which is a Lambda function that forwards incoming requests to one AWS SQS queue and reads responses from another queue. A local proxy running on your development computer reads the queue, calls your Lambda locally and sends back the response. This approach allows debugging of Lambda functions locally while being part of your AWS workflow. The Lambda handler code does not need to be modified between the local and AWS versions. From eff6892dd2d5fe814cfccc0383852fb96147c8a2 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Fri, 20 Feb 2026 02:15:21 +0000 Subject: [PATCH 09/30] chore: removing unused file --- tests/dockerized/core.json | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 tests/dockerized/core.json diff --git a/tests/dockerized/core.json b/tests/dockerized/core.json deleted file mode 100644 index 03cee2a7b..000000000 --- a/tests/dockerized/core.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "tests": [ - { - "name": "test_echo", - "handler": "basic-lambda", - "request": { - "command": "test" - }, - "assertions": [ - { - "response": { - "msg": "Command test executed." - }, - "transform": "{msg: .msg}" - } - ] - } - ] -} \ No newline at end of file From 5f048207e0c905bc3887dc9d9c9fb847cbf00c3c Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Fri, 20 Feb 2026 02:16:12 +0000 Subject: [PATCH 10/30] chore: removed unused file --- Makefile | 2 +- PR_DESCRIPTION.md | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 PR_DESCRIPTION.md diff --git a/Makefile b/Makefile index b475709bd..6fdcc7626 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ test-dockerized: @docker run --rm \ -e DOCKER_API_VERSION=1.44 \ -v /var/run/docker.sock:/var/run/docker.sock \ - -v "$(CURDIR)/tests/dockerized:/tests:ro" \ + -v "$(CURDIR)/test/dockerized:/tests:ro" \ test-runner:local \ --test-image local/test \ --debug \ diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md new file mode 100644 index 000000000..95bdf921b --- /dev/null +++ b/PR_DESCRIPTION.md @@ -0,0 +1,39 @@ +📬 *Issue #, if available:* + +N/A + +✍️ *Description of changes:* + +This PR adds Docker-based testing infrastructure using AWS's [containerized-test-runner-for-aws-lambda](https://github.com/aws/containerized-test-runner-for-aws-lambda), enabling automated testing of Lambda functions in a containerized environment that closely mirrors the AWS Lambda execution environment. + +The PR introduces a `test-dockerized` Makefile target that runs test suites defined in `test/dockerized/*.json` files. These test suites specify handlers to test (from the examples directory), request payloads, and expected response assertions with optional jq transforms for validation. + +The infrastructure reuses Lambda binaries from the `/examples` folder as test handlers, demonstrating the concept with an initial test case for `basic-lambda`. Additional tests and multi-concurrency scenarios can be added by creating new test suite JSON files. + +A GitHub Actions workflow provides CI/CD integration for automated testing on pull requests. + +## Testing + +Run dockerized tests locally: +```bash +make test-dockerized +``` + +Run RIE tests: +```bash +make test-rie +HANDLERS_TO_BUILD="basic-lambda basic-sqs" make test-rie +``` + +Build specific examples: +```bash +EXAMPLES="basic-lambda basic-lambda-concurrent" make build-examples +``` + +🔏 *By submitting this pull request* + +- [x] I confirm that I've ran `cargo +nightly fmt`. +- [x] I confirm that I've ran `cargo clippy --fix`. +- [x] I confirm that I've made a best effort attempt to update all relevant documentation. +- [x] I confirm that my contribution is made under the terms of the Apache 2.0 license.on. +- [x] I confirm that my contribution is made under the terms of the Apache 2.0 license. From d021b4862975c921302ecedf523c91af6c57f8f4 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Fri, 20 Feb 2026 15:35:55 +0000 Subject: [PATCH 11/30] refactor: :recycle: moving the environmental variables in a dedicated file, fix --- .env | 16 ++++++++++++++++ Dockerfile.rie | 2 +- Makefile | 16 +++++++++++++--- 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 000000000..2623ad16f --- /dev/null +++ b/.env @@ -0,0 +1,16 @@ +# Test configuration for RIE and dockerized tests +# Customize these values as needed for testing both local and on github + +# Handlers to build +HANDLERS_TO_BUILD=basic-lambda + +HANDLER=basic-lambda + +# Output directory for built binaries +OUTPUT_DIR="/tmp/var-task" + +# Max concurrent Lambda invocations for LMI mode +RIE_MAX_CONCURRENCY=4 + +# Setting new version of docker buildkit +DOCKER_BUILDKIT=1 diff --git a/Dockerfile.rie b/Dockerfile.rie index 5d609ccf0..180d6e3d6 100644 --- a/Dockerfile.rie +++ b/Dockerfile.rie @@ -17,7 +17,7 @@ COPY examples /build/examples COPY scripts/build-examples.sh /build/ WORKDIR /build -RUN chmod +x build-examples.sh && HANDLERS_TO_BUILD="$HANDLERS_TO_BUILD" OUTPUT_DIR="$OUTPUT_DIR" ./build-examples.sh +RUN chmod +x build-examples.sh && HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD} OUTPUT_DIR=${OUTPUT_DIR} ./build-examples.sh # Final Image FROM public.ecr.aws/lambda/provided:al2023 diff --git a/Makefile b/Makefile index 6fdcc7626..b65ce5ebb 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,12 @@ INTEG_EXTENSIONS := extension-fn extension-trait logs-trait INTEG_ARCH := x86_64-unknown-linux-musl RIE_MAX_CONCURRENCY ?= 4 OUTPUT_DIR ?= /tmp/var-task -HANDLERS_TO_BUILD ?= basic-lambda -HANDLER ?= basic-lambda +HANDLERS_TO_BUILD ?= +HANDLER ?= + +# Load environment variables from .env file if it exists +-include .env +export .PHONY: help pr-check integration-tests check-event-features fmt build-examples test-rie test-rie-lmi nuke test-dockerized @@ -128,7 +132,13 @@ nuke: test-dockerized: @echo "Running dockerized tests locally..." @echo "Building Docker image..." - docker build . -t local/test -f Dockerfile.rie + DOCKER_BUILDKIT=1 docker build \ + -t local/test \ + -f Dockerfile.rie \ + --build-arg HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD}" \ + --build-arg OUTPUT_DIR="${OUTPUT_DIR}" \ + . + @echo "Setting up containerized test runner..." @if [ ! -d ".test-runner" ]; then \ echo "Cloning containerized-test-runner-for-aws-lambda..."; \ From fbfa5e532b123c343edd7a90cf7bf9887bf4c0ad Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Fri, 20 Feb 2026 16:28:17 +0000 Subject: [PATCH 12/30] removing docker_buildkit --- .env | 3 --- Makefile | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.env b/.env index 2623ad16f..ffd8d09fb 100644 --- a/.env +++ b/.env @@ -11,6 +11,3 @@ OUTPUT_DIR="/tmp/var-task" # Max concurrent Lambda invocations for LMI mode RIE_MAX_CONCURRENCY=4 - -# Setting new version of docker buildkit -DOCKER_BUILDKIT=1 diff --git a/Makefile b/Makefile index b65ce5ebb..f353646cb 100644 --- a/Makefile +++ b/Makefile @@ -132,7 +132,7 @@ nuke: test-dockerized: @echo "Running dockerized tests locally..." @echo "Building Docker image..." - DOCKER_BUILDKIT=1 docker build \ + docker build \ -t local/test \ -f Dockerfile.rie \ --build-arg HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD}" \ From cf3320947473901b44847566c0d0099f60028ece Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Fri, 20 Feb 2026 17:29:43 +0000 Subject: [PATCH 13/30] chore: change the workflow version --- .github/workflows/dockerized-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 58214cc02..1d7097ce3 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -22,7 +22,7 @@ jobs: run: docker build . -t local/test -f Dockerfile.rie - name: Run tests - uses: aws/containerized-test-runner-for-aws-lambda@v1 + uses: aws/containerized-test-runner-for-aws-lambda@main with: suiteFileArray: '["./test/dockerized/*.json"]' dockerImageName: 'local/test' \ No newline at end of file From 82b5386a40692fa70053429e1ef16be8e6eae496 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 11:23:12 +0000 Subject: [PATCH 14/30] chore: setting up python 3.11 --- .github/workflows/dockerized-test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 1d7097ce3..1af18a775 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -18,6 +18,11 @@ jobs: steps: - uses: actions/checkout@v6 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Build the image run: docker build . -t local/test -f Dockerfile.rie From 36dea96a62e2784cb28ffaa63675f44371ece6c6 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 11:49:35 +0000 Subject: [PATCH 15/30] chore: fix problem with test --- Dockerfile.rie | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.rie b/Dockerfile.rie index 180d6e3d6..d9d181c14 100644 --- a/Dockerfile.rie +++ b/Dockerfile.rie @@ -22,13 +22,15 @@ RUN chmod +x build-examples.sh && HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD} OUTPUT_ # Final Image FROM public.ecr.aws/lambda/provided:al2023 +ARG OUTPUT_DIR="/var/task" + 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 COPY scripts/custom-lambda-entrypoint.sh /usr/local/bin/lambda-entrypoint RUN chmod +x /usr/local/bin/lambda-entrypoint -COPY --from=builder /var/task /var/task +COPY --from=builder ${OUTPUT_DIR} /var/task ENTRYPOINT ["/usr/local/bin/lambda-entrypoint"] CMD ["basic-lambda"] From f902d5b65f42c9925d2a3238478e18c2dd407a92 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 11:56:34 +0000 Subject: [PATCH 16/30] chore: syncing local and remote build --- .github/workflows/dockerized-test.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 1af18a775..64c4a64f3 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -23,8 +23,19 @@ jobs: with: python-version: '3.11' + - name: Load environment variables + run: | + if [ -f .env ]; then + export $(cat .env | grep -v '^#' | xargs) + echo "HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD}" >> $GITHUB_ENV + echo "OUTPUT_DIR=${OUTPUT_DIR}" >> $GITHUB_ENV + fi + - name: Build the image - run: docker build . -t local/test -f Dockerfile.rie + run: | + docker build . -t local/test -f Dockerfile.rie \ + --build-arg HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD}" \ + --build-arg OUTPUT_DIR="${OUTPUT_DIR}" - name: Run tests uses: aws/containerized-test-runner-for-aws-lambda@main From cb343deaa58b771b6c0feffa7a2546b0ce650cd9 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 12:01:52 +0000 Subject: [PATCH 17/30] chore: trying to source the env variable file --- .env | 2 +- .github/workflows/dockerized-test.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.env b/.env index ffd8d09fb..8b4457428 100644 --- a/.env +++ b/.env @@ -7,7 +7,7 @@ HANDLERS_TO_BUILD=basic-lambda HANDLER=basic-lambda # Output directory for built binaries -OUTPUT_DIR="/tmp/var-task" +OUTPUT_DIR=/tmp/var-task # Max concurrent Lambda invocations for LMI mode RIE_MAX_CONCURRENCY=4 diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 64c4a64f3..3b0353246 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -26,7 +26,9 @@ jobs: - name: Load environment variables run: | if [ -f .env ]; then - export $(cat .env | grep -v '^#' | xargs) + set -a + source .env + set +a echo "HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD}" >> $GITHUB_ENV echo "OUTPUT_DIR=${OUTPUT_DIR}" >> $GITHUB_ENV fi From d7ce866829e8486b115afde948913cf089afbd21 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 12:25:22 +0000 Subject: [PATCH 18/30] chore: inspecting the image in the docker actions --- .github/workflows/dockerized-test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 3b0353246..a7814202c 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -38,6 +38,13 @@ jobs: docker build . -t local/test -f Dockerfile.rie \ --build-arg HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD}" \ --build-arg OUTPUT_DIR="${OUTPUT_DIR}" + + - name: Verify image contents + run: | + echo "Checking /var/task contents:" + docker run --rm --entrypoint ls local/test -la /var/task + echo "Checking if basic-lambda binary exists:" + docker run --rm --entrypoint test local/test -f /var/task/basic-lambda && echo "Binary exists" || echo "Binary NOT found" - name: Run tests uses: aws/containerized-test-runner-for-aws-lambda@main From b79909b5ae99a6eb210302905bad2931f6b99c05 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 12:43:42 +0000 Subject: [PATCH 19/30] chore: add another test to check potential errors --- .github/workflows/dockerized-test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index a7814202c..51730ac06 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -38,13 +38,13 @@ jobs: docker build . -t local/test -f Dockerfile.rie \ --build-arg HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD}" \ --build-arg OUTPUT_DIR="${OUTPUT_DIR}" - - - name: Verify image contents + + - name: Test container manually run: | - echo "Checking /var/task contents:" - docker run --rm --entrypoint ls local/test -la /var/task - echo "Checking if basic-lambda binary exists:" - docker run --rm --entrypoint test local/test -f /var/task/basic-lambda && echo "Binary exists" || echo "Binary NOT found" + docker run -d --name test-container -p 9000:8080 local/test basic-lambda + sleep 10 + docker logs test-container + docker kill test-container || true - name: Run tests uses: aws/containerized-test-runner-for-aws-lambda@main From d5c8bd70b9ec713e60088199fdd47ca090cccf7b Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 12:48:59 +0000 Subject: [PATCH 20/30] chore: another test --- .github/workflows/dockerized-test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 51730ac06..10ca054ba 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -42,7 +42,12 @@ jobs: - name: Test container manually run: | docker run -d --name test-container -p 9000:8080 local/test basic-lambda - sleep 10 + sleep 15 + echo "Container logs after startup:" + docker logs test-container + echo "Attempting to invoke function:" + curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"command":"test"}' || echo "Invocation failed" + echo "Final container logs:" docker logs test-container docker kill test-container || true From 0c7dedb0a7d983937d6d18ce22e08392409614dc Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 13:57:15 +0000 Subject: [PATCH 21/30] chore: see what happens to the test action if I'm putting 5 seconds to wait --- .github/workflows/dockerized-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 10ca054ba..7beed3450 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -42,7 +42,7 @@ jobs: - name: Test container manually run: | docker run -d --name test-container -p 9000:8080 local/test basic-lambda - sleep 15 + sleep 5 echo "Container logs after startup:" docker logs test-container echo "Attempting to invoke function:" From 68b38a466d2383deb3d9a2bb2919b95c4f0e8721 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 14:51:25 +0000 Subject: [PATCH 22/30] chore: another manual test --- .github/workflows/dockerized-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 7beed3450..4eef0a866 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -41,12 +41,12 @@ jobs: - name: Test container manually run: | - docker run -d --name test-container -p 9000:8080 local/test basic-lambda + docker run -d --name test-container -p 8080 local/test basic-lambda sleep 5 echo "Container logs after startup:" docker logs test-container echo "Attempting to invoke function:" - curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"command":"test"}' || echo "Invocation failed" + curl -XPOST "http://localhost:8080/2015-03-31/functions/function/invocations" -d '{"command":"test"}' || echo "Invocation failed" echo "Final container logs:" docker logs test-container docker kill test-container || true From 5916174b79e4585d9ea75b8bee25747b590a321f Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 16:08:19 +0000 Subject: [PATCH 23/30] chore: putting the port mapping back and trying with one second timeout --- .github/workflows/dockerized-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 4eef0a866..c078e353d 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -41,12 +41,12 @@ jobs: - name: Test container manually run: | - docker run -d --name test-container -p 8080 local/test basic-lambda - sleep 5 + docker run -d --name test-container -p 9000:8080 local/test basic-lambda + sleep 1 echo "Container logs after startup:" docker logs test-container echo "Attempting to invoke function:" - curl -XPOST "http://localhost:8080/2015-03-31/functions/function/invocations" -d '{"command":"test"}' || echo "Invocation failed" + curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"command":"test"}' || echo "Invocation failed" echo "Final container logs:" docker logs test-container docker kill test-container || true From 099892365baba2f6cfe0d6d525583464feeca641 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Mon, 23 Feb 2026 16:29:53 +0000 Subject: [PATCH 24/30] chore: setting debugger on --- .github/workflows/dockerized-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index c078e353d..7562980fd 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -14,6 +14,8 @@ on: jobs: dockerized-test: runs-on: ubuntu-latest + env: + ACTIONS_STEP_DEBUG: true steps: - uses: actions/checkout@v6 From f2e23707b09dbf56e8c08f73eb3f912abe04bc43 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Tue, 24 Feb 2026 16:33:52 +0000 Subject: [PATCH 25/30] chore: modifying the makefile to adapt it to the new test runner --- .github/workflows/dockerized-test.yml | 4 ++-- Dockerfile.test-runner | 28 --------------------------- Makefile | 3 ++- 3 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 Dockerfile.test-runner diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 7562980fd..eaab67ed2 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -20,10 +20,10 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up Python 3.11 + - name: Set up Python 3.14 uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.14 - name: Load environment variables run: | diff --git a/Dockerfile.test-runner b/Dockerfile.test-runner deleted file mode 100644 index b6f377163..000000000 --- a/Dockerfile.test-runner +++ /dev/null @@ -1,28 +0,0 @@ -FROM python:3.11-slim - -# Install build dependencies for pyjq and Docker CLI -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - ca-certificates \ - curl \ - && curl -fsSL https://get.docker.com -o get-docker.sh \ - && sh get-docker.sh \ - && rm get-docker.sh \ - && rm -rf /var/lib/apt/lists/* - -WORKDIR /app - -# Copy the test runner source -COPY .test-runner/ . - -# Install the test runner -RUN pip install --no-cache-dir . - -# Set the entrypoint -ENTRYPOINT ["python", "-m", "containerized_test_runner.cli"] diff --git a/Makefile b/Makefile index f353646cb..2bb81a1e0 100644 --- a/Makefile +++ b/Makefile @@ -145,10 +145,11 @@ test-dockerized: git clone --quiet https://github.com/aws/containerized-test-runner-for-aws-lambda.git .test-runner; \ fi @echo "Building test runner Docker image..." - @docker build -t test-runner:local -f Dockerfile.test-runner . + @docker build -t test-runner:local -f .test-runner/Dockerfile .test-runner @echo "Running tests in Docker..." @echo "Running actual tests..." @docker run --rm \ + --entrypoint suite \ -e DOCKER_API_VERSION=1.44 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v "$(CURDIR)/test/dockerized:/tests:ro" \ From d7595ec3d3b5587e0badf483524572f0df3e91e7 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Tue, 24 Feb 2026 16:42:40 +0000 Subject: [PATCH 26/30] chore: fix error in github actions --- .github/workflows/dockerized-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index eaab67ed2..ba205502e 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Python 3.14 uses: actions/setup-python@v5 with: - python-version: '3.14 + python-version: '3.14' - name: Load environment variables run: | From 838ac5791e0b7e4ad5fcd5e5f9f32be30037c3c4 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Tue, 24 Feb 2026 17:35:27 +0000 Subject: [PATCH 27/30] chore: some more changes --- .env | 2 +- .github/workflows/dockerized-test.yml | 28 +++++++++++-------------- .gitignore | 4 ++++ Dockerfile.rie | 26 ----------------------- Makefile | 29 +++++++++++++------------- test/dockerized/{ => suites}/core.json | 0 6 files changed, 31 insertions(+), 58 deletions(-) rename test/dockerized/{ => suites}/core.json (100%) diff --git a/.env b/.env index 8b4457428..00993d713 100644 --- a/.env +++ b/.env @@ -7,7 +7,7 @@ HANDLERS_TO_BUILD=basic-lambda HANDLER=basic-lambda # Output directory for built binaries -OUTPUT_DIR=/tmp/var-task +OUTPUT_DIR=test/dockerized/tasks # Max concurrent Lambda invocations for LMI mode RIE_MAX_CONCURRENCY=4 diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index ba205502e..cac167967 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -20,6 +20,9 @@ jobs: steps: - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - name: Set up Python 3.14 uses: actions/setup-python@v5 with: @@ -35,26 +38,19 @@ jobs: echo "OUTPUT_DIR=${OUTPUT_DIR}" >> $GITHUB_ENV fi - - name: Build the image + - name: Build Lambda artifacts for testing run: | - docker build . -t local/test -f Dockerfile.rie \ - --build-arg HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD}" \ - --build-arg OUTPUT_DIR="${OUTPUT_DIR}" - - - name: Test container manually + mkdir -p test/dockerized/tasks + OUTPUT_DIR="$(pwd)/test/dockerized/tasks" make build-examples + ls -la test/dockerized/tasks/ + + - name: Build base test image with RIE and custom entrypoint run: | - docker run -d --name test-container -p 9000:8080 local/test basic-lambda - sleep 1 - echo "Container logs after startup:" - docker logs test-container - echo "Attempting to invoke function:" - curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"command":"test"}' || echo "Invocation failed" - echo "Final container logs:" - docker logs test-container - docker kill test-container || true + docker build . -t local/test-base -f Dockerfile.rie - name: Run tests uses: aws/containerized-test-runner-for-aws-lambda@main with: suiteFileArray: '["./test/dockerized/*.json"]' - dockerImageName: 'local/test' \ No newline at end of file + dockerImageName: 'local/test-base' + taskFolder: './test/dockerized/tasks' \ No newline at end of file diff --git a/.gitignore b/.gitignore index de557146e..0652944cd 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,7 @@ build node_modules cdk.out + +# Test artifacts +Dockerfile.test-with-tasks +test/dockerized/tasks/ diff --git a/Dockerfile.rie b/Dockerfile.rie index d9d181c14..b36b1f28c 100644 --- a/Dockerfile.rie +++ b/Dockerfile.rie @@ -1,36 +1,10 @@ -FROM public.ecr.aws/lambda/provided:al2023 AS builder - -RUN dnf install -y gcc make -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -ENV PATH="/root/.cargo/bin:${PATH}" - -ARG HANDLERS_TO_BUILD="basic-lambda" -ARG OUTPUT_DIR="/var/task" - -COPY Cargo.* /build/ -COPY lambda-runtime /build/lambda-runtime -COPY lambda-runtime-api-client /build/lambda-runtime-api-client -COPY lambda-events /build/lambda-events -COPY lambda-http /build/lambda-http -COPY lambda-extension /build/lambda-extension -COPY examples /build/examples -COPY scripts/build-examples.sh /build/ - -WORKDIR /build -RUN chmod +x build-examples.sh && HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD} OUTPUT_DIR=${OUTPUT_DIR} ./build-examples.sh - -# Final Image FROM public.ecr.aws/lambda/provided:al2023 -ARG OUTPUT_DIR="/var/task" - 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 COPY scripts/custom-lambda-entrypoint.sh /usr/local/bin/lambda-entrypoint RUN chmod +x /usr/local/bin/lambda-entrypoint -COPY --from=builder ${OUTPUT_DIR} /var/task - ENTRYPOINT ["/usr/local/bin/lambda-entrypoint"] CMD ["basic-lambda"] diff --git a/Makefile b/Makefile index 2bb81a1e0..e6960b73c 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ INTEG_EXTENSIONS := extension-fn extension-trait logs-trait # Using musl to run extensions on both AL1 and AL2 INTEG_ARCH := x86_64-unknown-linux-musl RIE_MAX_CONCURRENCY ?= 4 -OUTPUT_DIR ?= /tmp/var-task +OUTPUT_DIR ?= test/dockerized/tasks HANDLERS_TO_BUILD ?= HANDLER ?= @@ -124,19 +124,18 @@ fmt: cargo +nightly fmt --all build-examples: - HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD} ./scripts/build-examples.sh + HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD} OUTPUT_DIR=${OUTPUT_DIR} ./scripts/build-examples.sh nuke: docker kill $$(docker ps -q) -test-dockerized: +test-dockerized: build-examples @echo "Running dockerized tests locally..." - @echo "Building Docker image..." + + @echo "Building base Docker image with RIE and custom entrypoint..." docker build \ - -t local/test \ + -t local/test-base \ -f Dockerfile.rie \ - --build-arg HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD}" \ - --build-arg OUTPUT_DIR="${OUTPUT_DIR}" \ . @echo "Setting up containerized test runner..." @@ -146,17 +145,17 @@ test-dockerized: fi @echo "Building test runner Docker image..." @docker build -t test-runner:local -f .test-runner/Dockerfile .test-runner + @echo "Running tests in Docker..." - @echo "Running actual tests..." @docker run --rm \ - --entrypoint suite \ - -e DOCKER_API_VERSION=1.44 \ + -e INPUT_SUITE_FILE_ARRAY='["./test/dockerized/suites/*.json"]' \ + -e DOCKER_IMAGE_NAME=local/test-base \ + -e TASK_FOLDER=./test/dockerized/tasks \ + -e GITHUB_WORKSPACE=/workspace \ -v /var/run/docker.sock:/var/run/docker.sock \ - -v "$(CURDIR)/test/dockerized:/tests:ro" \ - test-runner:local \ - --test-image local/test \ - --debug \ - /tests/*.json + -v "$(CURDIR):/workspace" \ + -w /workspace \ + test-runner:local test-rie: HANDLER="$(HANDLER)" ./scripts/test-rie.sh diff --git a/test/dockerized/core.json b/test/dockerized/suites/core.json similarity index 100% rename from test/dockerized/core.json rename to test/dockerized/suites/core.json From 2103e0e01550094958505ab65b8070bcc52a96eb Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Tue, 24 Feb 2026 17:46:21 +0000 Subject: [PATCH 28/30] chore: fix backward compatibility with previous tests --- .github/workflows/dockerized-test.yml | 2 +- Dockerfile.rie | 23 +++++++++++++++++++---- Dockerfile.test | 10 ++++++++++ Makefile | 2 +- scripts/test-rie.sh | 23 ++++++++++++----------- 5 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 Dockerfile.test diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index cac167967..3db212740 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -46,7 +46,7 @@ jobs: - name: Build base test image with RIE and custom entrypoint run: | - docker build . -t local/test-base -f Dockerfile.rie + docker build . -t local/test-base -f Dockerfile.test - name: Run tests uses: aws/containerized-test-runner-for-aws-lambda@main diff --git a/Dockerfile.rie b/Dockerfile.rie index b36b1f28c..1a46b5771 100644 --- a/Dockerfile.rie +++ b/Dockerfile.rie @@ -1,10 +1,25 @@ FROM public.ecr.aws/lambda/provided:al2023 +RUN dnf install -y gcc +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + 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 -COPY scripts/custom-lambda-entrypoint.sh /usr/local/bin/lambda-entrypoint -RUN chmod +x /usr/local/bin/lambda-entrypoint +ARG EXAMPLE=basic-lambda + +COPY Cargo.* /build/ +COPY lambda-runtime /build/lambda-runtime +COPY lambda-runtime-api-client /build/lambda-runtime-api-client +COPY lambda-events /build/lambda-events +COPY lambda-http /build/lambda-http +COPY lambda-extension /build/lambda-extension +COPY examples/${EXAMPLE} /build/examples/${EXAMPLE} + +WORKDIR /build/examples/${EXAMPLE} +RUN cargo build --release +RUN cp target/release/${EXAMPLE} ${LAMBDA_RUNTIME_DIR}/bootstrap -ENTRYPOINT ["/usr/local/bin/lambda-entrypoint"] -CMD ["basic-lambda"] +ENTRYPOINT [] +CMD [ "/usr/local/bin/aws-lambda-rie", "/var/runtime/bootstrap" ] \ No newline at end of file diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 000000000..b36b1f28c --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,10 @@ +FROM public.ecr.aws/lambda/provided:al2023 + +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 + +COPY scripts/custom-lambda-entrypoint.sh /usr/local/bin/lambda-entrypoint +RUN chmod +x /usr/local/bin/lambda-entrypoint + +ENTRYPOINT ["/usr/local/bin/lambda-entrypoint"] +CMD ["basic-lambda"] diff --git a/Makefile b/Makefile index e6960b73c..d4ffa4ba4 100644 --- a/Makefile +++ b/Makefile @@ -135,7 +135,7 @@ test-dockerized: build-examples @echo "Building base Docker image with RIE and custom entrypoint..." docker build \ -t local/test-base \ - -f Dockerfile.rie \ + -f Dockerfile.test \ . @echo "Setting up containerized test runner..." diff --git a/scripts/test-rie.sh b/scripts/test-rie.sh index 67f3595ff..c5949fe8f 100755 --- a/scripts/test-rie.sh +++ b/scripts/test-rie.sh @@ -1,28 +1,29 @@ #!/bin/bash set -euo pipefail +EXAMPLE=${1:-basic-lambda} # Optional: set RIE_MAX_CONCURRENCY to enable LMI mode (emulates AWS_LAMBDA_MAX_CONCURRENCY) RIE_MAX_CONCURRENCY=${RIE_MAX_CONCURRENCY:-} -# Optional: specify which handler to run (defaults to first handler) -HANDLER=${HANDLER:-basic-lambda} -echo "Building Docker image with RIE (handlers: $HANDLER)" -docker build -f Dockerfile.rie --build-arg HANDLERS_TO_BUILD="$HANDLER" -t rust-lambda-rie-test . +echo "Building Docker image with RIE for example: $EXAMPLE..." +docker build -f Dockerfile.rie --build-arg EXAMPLE=$EXAMPLE -t rust-lambda-rie-test . -echo "Starting RIE container on port 9000 with handler: $HANDLER" +echo "Starting RIE container on port 9000..." if [ -n "$RIE_MAX_CONCURRENCY" ]; then echo "Enabling LMI mode with AWS_LAMBDA_MAX_CONCURRENCY=$RIE_MAX_CONCURRENCY" - docker run -p 9000:8080 -e AWS_LAMBDA_MAX_CONCURRENCY="$RIE_MAX_CONCURRENCY" rust-lambda-rie-test "$HANDLER" & + docker run -p 9000:8080 -e AWS_LAMBDA_MAX_CONCURRENCY="$RIE_MAX_CONCURRENCY" rust-lambda-rie-test & else - docker run -p 9000:8080 rust-lambda-rie-test "$HANDLER" & + docker run -p 9000:8080 rust-lambda-rie-test & fi CONTAINER_PID=$! echo "Container started. Test with:" -echo "curl -XPOST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d '{\"command\": \"test from RIE\"}' -H 'Content-Type: application/json'" -echo "or for a specific example check under examples/ for the expected payload format." - +if [ "$EXAMPLE" = "basic-lambda" ] || [ "$EXAMPLE" = "basic-lambda-concurrent" ]; then + echo "curl -XPOST 'http://localhost:9000/2015-03-31/functions/function/invocations' -d '{\"command\": \"test from RIE\"}' -H 'Content-Type: application/json'" +else + echo "For example '$EXAMPLE', check examples/$EXAMPLE/src/main.rs for the expected payload format." +fi echo "" echo "Press Ctrl+C to stop the container." -wait $CONTAINER_PID +wait $CONTAINER_PID \ No newline at end of file From fda045cfc203040224c2dfeee118595fd50bef01 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Tue, 24 Feb 2026 17:49:03 +0000 Subject: [PATCH 29/30] chore: fix issue in github actions --- .github/workflows/dockerized-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 3db212740..f40e0cb91 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -51,6 +51,6 @@ jobs: - name: Run tests uses: aws/containerized-test-runner-for-aws-lambda@main with: - suiteFileArray: '["./test/dockerized/*.json"]' + suiteFileArray: '["./test/dockerized/suites/*.json"]' dockerImageName: 'local/test-base' taskFolder: './test/dockerized/tasks' \ No newline at end of file From 50666bc2ba4509d5ac4291ab7c23025a8a811acc Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 25 Feb 2026 13:54:19 +0000 Subject: [PATCH 30/30] chore: other fixes --- .github/workflows/dockerized-test.yml | 9 ------- PR_DESCRIPTION.md | 39 --------------------------- 2 files changed, 48 deletions(-) delete mode 100644 PR_DESCRIPTION.md diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index f40e0cb91..01c2df9e3 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -14,20 +14,11 @@ on: jobs: dockerized-test: runs-on: ubuntu-latest - env: - ACTIONS_STEP_DEBUG: true - steps: - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - - - name: Set up Python 3.14 - uses: actions/setup-python@v5 - with: - python-version: '3.14' - - name: Load environment variables run: | if [ -f .env ]; then diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md deleted file mode 100644 index 95bdf921b..000000000 --- a/PR_DESCRIPTION.md +++ /dev/null @@ -1,39 +0,0 @@ -📬 *Issue #, if available:* - -N/A - -✍️ *Description of changes:* - -This PR adds Docker-based testing infrastructure using AWS's [containerized-test-runner-for-aws-lambda](https://github.com/aws/containerized-test-runner-for-aws-lambda), enabling automated testing of Lambda functions in a containerized environment that closely mirrors the AWS Lambda execution environment. - -The PR introduces a `test-dockerized` Makefile target that runs test suites defined in `test/dockerized/*.json` files. These test suites specify handlers to test (from the examples directory), request payloads, and expected response assertions with optional jq transforms for validation. - -The infrastructure reuses Lambda binaries from the `/examples` folder as test handlers, demonstrating the concept with an initial test case for `basic-lambda`. Additional tests and multi-concurrency scenarios can be added by creating new test suite JSON files. - -A GitHub Actions workflow provides CI/CD integration for automated testing on pull requests. - -## Testing - -Run dockerized tests locally: -```bash -make test-dockerized -``` - -Run RIE tests: -```bash -make test-rie -HANDLERS_TO_BUILD="basic-lambda basic-sqs" make test-rie -``` - -Build specific examples: -```bash -EXAMPLES="basic-lambda basic-lambda-concurrent" make build-examples -``` - -🔏 *By submitting this pull request* - -- [x] I confirm that I've ran `cargo +nightly fmt`. -- [x] I confirm that I've ran `cargo clippy --fix`. -- [x] I confirm that I've made a best effort attempt to update all relevant documentation. -- [x] I confirm that my contribution is made under the terms of the Apache 2.0 license.on. -- [x] I confirm that my contribution is made under the terms of the Apache 2.0 license.