-
Notifications
You must be signed in to change notification settings - Fork 386
Introducing Harness Testing #1103
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
Open
darklight3it
wants to merge
30
commits into
main
Choose a base branch
from
dmelfi/add-dockerized-test-infrastructure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+244
−16
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
54a76ca
refactor: :recycle: adding a new script that selectively builds speci…
2cbcb4f
refactor: :recycle: add a custom lambda-entrypoint to select differen…
7aa7c0b
refactor: :recycle: modifying dockerfile to include both the build sc…
9eb1b46
refactor: :recycle add nuke continaers to the makefile
8ce868b
test: :sparkles: add harness testing capability
72f658e
refactor: :recycle: some small fixes
2b40b80
chore: putting permission read
7078074
chore: add readme for test-dockerized
eff6892
chore: removing unused file
5f04820
chore: removed unused file
d021b48
refactor: :recycle: moving the environmental variables in a dedicated…
fbfa5e5
removing docker_buildkit
cf33209
chore: change the workflow version
82b5386
chore: setting up python 3.11
36dea96
chore: fix problem with test
f902d5b
chore: syncing local and remote build
cb343de
chore: trying to source the env variable file
d7ce866
chore: inspecting the image in the docker actions
b79909b
chore: add another test to check potential errors
d5c8bd7
chore: another test
0c7dedb
chore: see what happens to the test action if I'm putting 5 seconds t…
68b38a4
chore: another manual test
5916174
chore: putting the port mapping back and trying with one second timeout
0998923
chore: setting debugger on
f2e2370
chore: modifying the makefile to adapt it to the new test runner
d7595ec
chore: fix error in github actions
838ac57
chore: some more changes
2103e0e
chore: fix backward compatibility with previous tests
fda045c
chore: fix issue in github actions
50666bc
chore: other fixes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # 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=test/dockerized/tasks | ||
|
|
||
| # Max concurrent Lambda invocations for LMI mode | ||
| RIE_MAX_CONCURRENCY=4 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: dockerized-test | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ '*' ] | ||
| workflow_dispatch: | ||
|
|
||
|
|
||
| jobs: | ||
| dockerized-test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - name: Load environment variables | ||
| run: | | ||
| if [ -f .env ]; then | ||
| set -a | ||
| source .env | ||
| set +a | ||
| echo "HANDLERS_TO_BUILD=${HANDLERS_TO_BUILD}" >> $GITHUB_ENV | ||
| echo "OUTPUT_DIR=${OUTPUT_DIR}" >> $GITHUB_ENV | ||
| fi | ||
| - name: Build Lambda artifacts for testing | ||
| run: | | ||
| 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 build . -t local/test-base -f Dockerfile.test | ||
| - name: Run tests | ||
| uses: aws/containerized-test-runner-for-aws-lambda@main | ||
| with: | ||
| suiteFileArray: '["./test/dockerized/suites/*.json"]' | ||
| dockerImageName: 'local/test-base' | ||
| taskFolder: './test/dockerized/tasks' | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"] |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| OUTPUT_DIR="${OUTPUT_DIR:-/tmp/var-task}" | ||
| HANDLERS_TO_BUILD="${HANDLERS_TO_BUILD:-}" | ||
|
|
||
| mkdir -p "$OUTPUT_DIR" | ||
|
|
||
| echo "Building handlers: ${HANDLERS_TO_BUILD}" | ||
|
|
||
|
|
||
| for handler in ${HANDLERS_TO_BUILD}; do | ||
| dir="examples/$handler" | ||
| [ ! -f "$dir/Cargo.toml" ] && echo "✗ $handler not found" && continue | ||
|
|
||
| echo "Building $handler..." | ||
| (cd "$dir" && cargo build --release) || continue | ||
|
|
||
| [ -f "$dir/target/release/$handler" ] && cp "$dir/target/release/$handler" "$OUTPUT_DIR/" && echo "✓ $handler" | ||
| done | ||
|
|
||
| echo "" | ||
| ls -lh "$OUTPUT_DIR/" 2>/dev/null || echo "No binaries built" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,4 +26,4 @@ fi | |
| echo "" | ||
| echo "Press Ctrl+C to stop the container." | ||
|
|
||
| wait $CONTAINER_PID | ||
| wait $CONTAINER_PID | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "tests": [ | ||
| { | ||
| "name": "test_echo", | ||
| "handler": "basic-lambda", | ||
| "request": { | ||
| "command": "test" | ||
| }, | ||
| "assertions": [ | ||
| { | ||
| "response": { | ||
| "msg": "Command test executed." | ||
| }, | ||
| "transform": "{msg: .msg}" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.