Skip to content

Commit 838ac57

Browse files
committed
chore: some more changes
1 parent d7595ec commit 838ac57

6 files changed

Lines changed: 31 additions & 58 deletions

File tree

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ HANDLERS_TO_BUILD=basic-lambda
77
HANDLER=basic-lambda
88

99
# Output directory for built binaries
10-
OUTPUT_DIR=/tmp/var-task
10+
OUTPUT_DIR=test/dockerized/tasks
1111

1212
# Max concurrent Lambda invocations for LMI mode
1313
RIE_MAX_CONCURRENCY=4

.github/workflows/dockerized-test.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v6
2222

23+
- uses: dtolnay/rust-toolchain@stable
24+
- uses: Swatinem/rust-cache@v2
25+
2326
- name: Set up Python 3.14
2427
uses: actions/setup-python@v5
2528
with:
@@ -35,26 +38,19 @@ jobs:
3538
echo "OUTPUT_DIR=${OUTPUT_DIR}" >> $GITHUB_ENV
3639
fi
3740
38-
- name: Build the image
41+
- name: Build Lambda artifacts for testing
3942
run: |
40-
docker build . -t local/test -f Dockerfile.rie \
41-
--build-arg HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD}" \
42-
--build-arg OUTPUT_DIR="${OUTPUT_DIR}"
43-
44-
- name: Test container manually
43+
mkdir -p test/dockerized/tasks
44+
OUTPUT_DIR="$(pwd)/test/dockerized/tasks" make build-examples
45+
ls -la test/dockerized/tasks/
46+
47+
- name: Build base test image with RIE and custom entrypoint
4548
run: |
46-
docker run -d --name test-container -p 9000:8080 local/test basic-lambda
47-
sleep 1
48-
echo "Container logs after startup:"
49-
docker logs test-container
50-
echo "Attempting to invoke function:"
51-
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"command":"test"}' || echo "Invocation failed"
52-
echo "Final container logs:"
53-
docker logs test-container
54-
docker kill test-container || true
49+
docker build . -t local/test-base -f Dockerfile.rie
5550
5651
- name: Run tests
5752
uses: aws/containerized-test-runner-for-aws-lambda@main
5853
with:
5954
suiteFileArray: '["./test/dockerized/*.json"]'
60-
dockerImageName: 'local/test'
55+
dockerImageName: 'local/test-base'
56+
taskFolder: './test/dockerized/tasks'

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ build
1717

1818
node_modules
1919
cdk.out
20+
21+
# Test artifacts
22+
Dockerfile.test-with-tasks
23+
test/dockerized/tasks/

Dockerfile.rie

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,10 @@
1-
FROM public.ecr.aws/lambda/provided:al2023 AS builder
2-
3-
RUN dnf install -y gcc make
4-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
5-
ENV PATH="/root/.cargo/bin:${PATH}"
6-
7-
ARG HANDLERS_TO_BUILD="basic-lambda"
8-
ARG OUTPUT_DIR="/var/task"
9-
10-
COPY Cargo.* /build/
11-
COPY lambda-runtime /build/lambda-runtime
12-
COPY lambda-runtime-api-client /build/lambda-runtime-api-client
13-
COPY lambda-events /build/lambda-events
14-
COPY lambda-http /build/lambda-http
15-
COPY lambda-extension /build/lambda-extension
16-
COPY examples /build/examples
17-
COPY scripts/build-examples.sh /build/
18-
19-
WORKDIR /build
20-
RUN chmod +x build-examples.sh && HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD} OUTPUT_DIR=${OUTPUT_DIR} ./build-examples.sh
21-
22-
# Final Image
231
FROM public.ecr.aws/lambda/provided:al2023
242

25-
ARG OUTPUT_DIR="/var/task"
26-
273
ADD https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie /usr/local/bin/aws-lambda-rie
284
RUN chmod +x /usr/local/bin/aws-lambda-rie
295

306
COPY scripts/custom-lambda-entrypoint.sh /usr/local/bin/lambda-entrypoint
317
RUN chmod +x /usr/local/bin/lambda-entrypoint
328

33-
COPY --from=builder ${OUTPUT_DIR} /var/task
34-
359
ENTRYPOINT ["/usr/local/bin/lambda-entrypoint"]
3610
CMD ["basic-lambda"]

Makefile

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ INTEG_EXTENSIONS := extension-fn extension-trait logs-trait
66
# Using musl to run extensions on both AL1 and AL2
77
INTEG_ARCH := x86_64-unknown-linux-musl
88
RIE_MAX_CONCURRENCY ?= 4
9-
OUTPUT_DIR ?= /tmp/var-task
9+
OUTPUT_DIR ?= test/dockerized/tasks
1010
HANDLERS_TO_BUILD ?=
1111
HANDLER ?=
1212

@@ -124,19 +124,18 @@ fmt:
124124
cargo +nightly fmt --all
125125

126126
build-examples:
127-
HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD} ./scripts/build-examples.sh
127+
HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD} OUTPUT_DIR=${OUTPUT_DIR} ./scripts/build-examples.sh
128128

129129
nuke:
130130
docker kill $$(docker ps -q)
131131

132-
test-dockerized:
132+
test-dockerized: build-examples
133133
@echo "Running dockerized tests locally..."
134-
@echo "Building Docker image..."
134+
135+
@echo "Building base Docker image with RIE and custom entrypoint..."
135136
docker build \
136-
-t local/test \
137+
-t local/test-base \
137138
-f Dockerfile.rie \
138-
--build-arg HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD}" \
139-
--build-arg OUTPUT_DIR="${OUTPUT_DIR}" \
140139
.
141140

142141
@echo "Setting up containerized test runner..."
@@ -146,17 +145,17 @@ test-dockerized:
146145
fi
147146
@echo "Building test runner Docker image..."
148147
@docker build -t test-runner:local -f .test-runner/Dockerfile .test-runner
148+
149149
@echo "Running tests in Docker..."
150-
@echo "Running actual tests..."
151150
@docker run --rm \
152-
--entrypoint suite \
153-
-e DOCKER_API_VERSION=1.44 \
151+
-e INPUT_SUITE_FILE_ARRAY='["./test/dockerized/suites/*.json"]' \
152+
-e DOCKER_IMAGE_NAME=local/test-base \
153+
-e TASK_FOLDER=./test/dockerized/tasks \
154+
-e GITHUB_WORKSPACE=/workspace \
154155
-v /var/run/docker.sock:/var/run/docker.sock \
155-
-v "$(CURDIR)/test/dockerized:/tests:ro" \
156-
test-runner:local \
157-
--test-image local/test \
158-
--debug \
159-
/tests/*.json
156+
-v "$(CURDIR):/workspace" \
157+
-w /workspace \
158+
test-runner:local
160159

161160
test-rie:
162161
HANDLER="$(HANDLER)" ./scripts/test-rie.sh

0 commit comments

Comments
 (0)