feat: implement event-based assertion system for durable function testing#182
feat: implement event-based assertion system for durable function testing#182
Conversation
|
🤖 Emulator PR Created A draft PR has been created with locked dependencies: ➡️ https://github.com/aws/aws-durable-execution-emulator/pull/93 The emulator will build binaries using the exact testing SDK commit locked in uv.lock. |
d184712 to
9b83489
Compare
|
🔄 Emulator PR Updated The emulator PR has been updated with locked dependencies: ➡️ https://github.com/aws/aws-durable-execution-emulator/pull/93 |
9b83489 to
d6bc575
Compare
|
🔄 Emulator PR Updated The emulator PR has been updated with locked dependencies: ➡️ https://github.com/aws/aws-durable-execution-emulator/pull/93 |
d6bc575 to
ecffd1d
Compare
|
🔄 Emulator PR Updated The emulator PR has been updated with locked dependencies: ➡️ https://github.com/aws/aws-durable-execution-emulator/pull/93 |
ecffd1d to
bfdd351
Compare
|
🔄 Emulator PR Updated The emulator PR has been updated with locked dependencies: ➡️ https://github.com/aws/aws-durable-execution-emulator/pull/93 |
bfdd351 to
ea4f66a
Compare
|
🔄 Emulator PR Updated The emulator PR has been updated with locked dependencies: ➡️ https://github.com/aws/aws-durable-execution-emulator/pull/93 |
…ting - Add comprehensive event assertion framework with three categories (STRICT_EQUAL, KEY_EQUAL, IGNORE) - Create CLI event generator tool for capturing execution events as JSON - Update CONTRIBUTING.md - Add events for hello_world example
ea4f66a to
6462f8e
Compare
|
🔄 Emulator PR Updated The emulator PR has been updated with locked dependencies: ➡️ https://github.com/aws/aws-durable-execution-emulator/pull/93 |
| --output examples/events/hello_world_events.json | ||
| """ | ||
|
|
||
| import argparse |
There was a problem hiding this comment.
you could build this into [project.scripts] dex-local-runner = "aws_durable_execution_sdk_python_testing.cli:main"?
i.e so you can do something like
localrunner invoke --function-name whatever
localrunner get-durable-execution-history --durable-execution-arn whatever-arn
There was a problem hiding this comment.
possibly
localrunner get-durable-execution-history --durable-execution-arn whatever-arn --output myfile.json
| return FieldCategory.IGNORE | ||
|
|
||
|
|
||
| def assert_field_by_category( |
There was a problem hiding this comment.
rather than have this "helper", wouldn't these belong more naturally on the DurableFunctionTestResult?
so you can do something like:
with durable_runner:
result = durable_runner.run(input="test", timeout=30)
assert result.status is InvocationStatus.SUCCEEDED
result.assert_events(expected_events)
| @@ -0,0 +1,236 @@ | |||
| #!/usr/bin/env python3 | |||
| """CLI tool for generating event assertion files from durable function executions. | |||
There was a problem hiding this comment.
might be nice loading events either via code or via file like so:
Events.load("<<string>>")
Events.load_from_file(path="")
events = new Events()
event = Event.create_execution_started()
events.add(event_one)
Issue #, if available:
Description of changes:
Dependencies
If this PR requires testing against a specific branch of the Python Language SDK (e.g., for unreleased changes), uncomment and specify the branch below. Otherwise, leave commented to use the main branch.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.