Expand description
Testing utilities for AWS Durable Execution SDK
This crate provides tools for testing durable functions locally and against deployed AWS Lambda functions.
§Features
- LocalDurableTestRunner: Execute and test durable functions in-process
- CloudDurableTestRunner: Test against deployed Lambda functions
- MockDurableServiceClient: Mock checkpoint client for unit testing
- DurableOperation: Inspect and interact with individual operations
- Time Control: Skip wait operations for faster test execution
§Example
ⓘ
use durable_execution_sdk_testing::{
LocalDurableTestRunner, TestEnvironmentConfig, ExecutionStatus,
};
#[tokio::test]
async fn test_workflow() {
LocalDurableTestRunner::setup_test_environment(TestEnvironmentConfig {
skip_time: true,
checkpoint_delay: None,
}).await.unwrap();
let mut runner = LocalDurableTestRunner::new(my_workflow);
let result = runner.run("input".to_string()).await.unwrap();
assert_eq!(result.get_status(), ExecutionStatus::Succeeded);
LocalDurableTestRunner::teardown_test_environment().await.unwrap();
}Re-exports§
pub use checkpoint_server::CheckpointWorkerManager;pub use checkpoint_server::CheckpointWorkerParams;pub use checkpoint_server::NodeJsHistoryEvent;pub use cloud_runner::CloudDurableTestRunner;pub use cloud_runner::CloudTestRunnerConfig;pub use cloud_runner::LambdaHistoryApiClient;pub use error::TestError;pub use history_poller::HistoryApiClient;pub use history_poller::HistoryPage;pub use history_poller::PollResult;pub use history_poller::TerminalState;pub use local_runner::LocalDurableTestRunner;pub use local_runner::TestEnvironmentConfig;pub use mock_client::CheckpointCall;pub use mock_client::GetOperationsCall;pub use mock_client::MockDurableServiceClient;pub use operation::CallbackDetails;pub use operation::CallbackSender;pub use operation::ContextDetails;pub use operation::DurableOperation;pub use operation::InvokeDetails;pub use operation::StepDetails;pub use operation::WaitDetails;pub use operation_handle::OperationHandle;pub use run_future::RunFuture;pub use test_result::HistoryEvent;pub use test_result::PrintConfig;pub use test_result::TestResult;pub use time_control::TimeControl;pub use time_control::TimeControlGuard;pub use types::ExecutionStatus;pub use types::Invocation;pub use types::InvokeRequest;pub use types::TestResultError;pub use types::WaitingOperationStatus;
Modules§
- checkpoint_
server - Checkpoint server module for local testing (Node.js SDK parity).
- cloud_
runner - Cloud test runner for testing deployed Lambda functions.
- error
- Error types for the testing utilities crate.
- history_
poller - History polling types and traits for cloud test execution.
- local_
runner - Local test runner for durable executions.
- mock_
client - Mock implementation of DurableServiceClient for testing.
- operation
- Durable operation types for testing.
- operation_
handle - Lazy operation handle for pre-run operation registration.
- run_
future - Future wrapper for non-blocking test execution.
- test_
result - Test result types for durable execution testing.
- time_
control - Time control utilities for durable execution testing.
- types
- Core types for the testing utilities crate.
Structs§
- Chained
Invoke Details - Details specific to CHAINED_INVOKE type operations
- Checkpoint
Response - Response from a checkpoint operation.
- Durable
Context - The main context for durable execution operations.
- Duration
- Duration type representing a time interval in seconds.
- Error
Object - Error object for serialization in Lambda responses.
- GetOperations
Response - Response from a get_operations call.
- NewExecution
State - New execution state returned from checkpoint operations.
- Operation
- Represents a checkpointed operation in a durable execution.
- Operation
Update - Represents an update to be checkpointed for an operation.
- SdkCallback
Details - Details specific to CALLBACK type operations
- SdkContext
Details - Details specific to CONTEXT type operations
- SdkStep
Details - Details specific to STEP type operations
- SdkWait
Details - Details specific to WAIT type operations
Enums§
- Durable
Error - The main error type for the AWS Durable Execution SDK.
- Operation
Status - The status of an operation in a durable execution.
- Operation
Type - The type of operation in a durable execution.
Traits§
- Durable
Service Client - Trait for communicating with the durable execution service.
Type Aliases§
- Durable
Result - Result type for durable operations.
- Shared
Durable Service Client - Type alias for a shared DurableServiceClient.