Skip to main content

Crate durable_execution_sdk_testing

Crate durable_execution_sdk_testing 

Source
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§

ChainedInvokeDetails
Details specific to CHAINED_INVOKE type operations
CheckpointResponse
Response from a checkpoint operation.
DurableContext
The main context for durable execution operations.
Duration
Duration type representing a time interval in seconds.
ErrorObject
Error object for serialization in Lambda responses.
GetOperationsResponse
Response from a get_operations call.
NewExecutionState
New execution state returned from checkpoint operations.
Operation
Represents a checkpointed operation in a durable execution.
OperationUpdate
Represents an update to be checkpointed for an operation.
SdkCallbackDetails
Details specific to CALLBACK type operations
SdkContextDetails
Details specific to CONTEXT type operations
SdkStepDetails
Details specific to STEP type operations
SdkWaitDetails
Details specific to WAIT type operations

Enums§

DurableError
The main error type for the AWS Durable Execution SDK.
OperationStatus
The status of an operation in a durable execution.
OperationType
The type of operation in a durable execution.

Traits§

DurableServiceClient
Trait for communicating with the durable execution service.

Type Aliases§

DurableResult
Result type for durable operations.
SharedDurableServiceClient
Type alias for a shared DurableServiceClient.