Skip to content

Commit 7078074

Browse files
committed
chore: add readme for test-dockerized
1 parent 2b40b80 commit 7078074

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,41 @@ RIE_MAX_CONCURRENCY=4 make test-rie
412412

413413
Different examples expect different payload formats. Check the example's source code in `examples/EXAMPLE_NAME/src/main.rs`
414414

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.
449+
415450
### Lambda Debug Proxy
416451

417452
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.

0 commit comments

Comments
 (0)