You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor: ♻️ adding a new script that selectively builds specific examples
* refactor: ♻️ add a custom lambda-entrypoint to select different binaries when called in the dockerfile.
* refactor: ♻️ modifying dockerfile to include both the build script and the custom entrypoint. Changing test-rie signature.
* refactor: :recycle add nuke continaers to the makefile
* test: ✨ add harness testing capability
* refactor: ♻️ some small fixes
---------
Co-authored-by: Davide Melfi <dmelfi@amazon.com>
Copy file name to clipboardExpand all lines: README.md
+39-13Lines changed: 39 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -392,34 +392,60 @@ You can read more about how [cargo lambda watch](https://www.cargo-lambda.info/c
392
392
393
393
### Local testing with Runtime Interface Emulator (RIE)
394
394
395
-
For testing with the official AWS Lambda Runtime Interface Emulator, use the provided RIE testing infrastructure:
395
+
For testing with the official AWS Lambda Runtime Interface Emulator:
396
396
397
397
```bash
398
398
make test-rie
399
399
```
400
400
401
-
By default, this uses the `basic-lambda` example. To test a different example:
401
+
By default, this builds and tests the `basic-lambda` example. To build and test a custom handler:
402
402
403
403
```bash
404
-
make test-rie EXAMPLE=basic-sqs
405
-
make test-rie EXAMPLE=http-basic-lambda
404
+
HANDLER="basic-tenant-id" make test-rie
406
405
```
407
406
408
-
To test Lambda Managed Instances (concurrent polling), use:
407
+
To test Lambda Managed Instances (concurrent polling):
409
408
410
409
```bash
411
-
make test-rie-lmi EXAMPLE=basic-lambda-concurrent
410
+
RIE_MAX_CONCURRENCY=4 make test-rie
412
411
```
413
412
414
-
This command will:
415
-
1. Build a Docker image with Rust toolchain and RIE
416
-
2. Compile the specified example inside the Linux container
417
-
3. Start the RIE container on port 9000
418
-
4. Display the appropriate curl command for testing
419
-
420
413
Different examples expect different payload formats. Check the example's source code in `examples/EXAMPLE_NAME/src/main.rs`
421
414
422
-
This provides automated testing with Docker and RIE, ensuring your Lambda functions work in a Linux environment identical to AWS Lambda.
415
+
### Dockerized test harness
416
+
417
+
For automated testing with AWS's containerized test runner:
418
+
419
+
```bash
420
+
make test-dockerized
421
+
```
422
+
423
+
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.
424
+
425
+
Example test suite (`test/dockerized/core.json`):
426
+
```json
427
+
{
428
+
"tests": [
429
+
{
430
+
"name": "test_echo",
431
+
"handler": "basic-lambda",
432
+
"request": {
433
+
"command": "test"
434
+
},
435
+
"assertions": [
436
+
{
437
+
"response": {
438
+
"msg": "Command test executed."
439
+
},
440
+
"transform": "{msg: .msg}"
441
+
}
442
+
]
443
+
}
444
+
]
445
+
}
446
+
```
447
+
448
+
The `transform` field uses jq syntax to extract specific fields from responses before comparison, useful when responses include dynamic fields like request IDs.
0 commit comments