dream_test/sandbox

Types

Configuration for sandboxed test execution.

pub type SandboxConfig {
  SandboxConfig(timeout_ms: Int)
}

Constructors

  • SandboxConfig(timeout_ms: Int)

Result of running a test in an isolated sandbox.

pub type SandboxResult {
  SandboxCompleted(types.AssertionResult)
  SandboxTimedOut
  SandboxCrashed(reason: String)
}

Constructors

  • SandboxCompleted(types.AssertionResult)

    Test completed successfully and returned an AssertionResult.

  • SandboxTimedOut

    Test did not complete within the timeout period.

  • SandboxCrashed(reason: String)

    Test process crashed with the given reason.

Values

pub fn default_config() -> SandboxConfig

Default configuration with a 5 second timeout.

pub fn run_isolated(
  config: SandboxConfig,
  test_function: fn() -> types.AssertionResult,
) -> SandboxResult

Run a test function in an isolated process with timeout.

The test function runs in a separate BEAM process that is monitored. If the process completes normally, its result is returned. If the process crashes or times out, an appropriate SandboxResult is returned.

Search Document