Isolation runtime for OTP-heavy tests.
This module configures and maintains isolation contexts that can be plugged into any
test harness. Use Supertester.ExUnitFoundation for the ready-made ExUnit adapter, or
call the functions in this module directly from custom harnesses.
Isolation Modes
:basic- Basic isolation with unique naming:registry- Registry-based process isolation:full_isolation- Complete process and ETS isolation:contamination_detection- Isolation with contamination detection
Usage with ExUnit
defmodule MyApp.MyModuleTest do
use Supertester.ExUnitFoundation, isolation: :full_isolation
test "my test", context do
# Test runs with full isolation
end
endUsage with custom harnesses
:ok = Supertester.UnifiedTestFoundation.setup_isolation(:full_isolation, context)
Summary
Functions
Deprecated macro maintained for backwards compatibility.
Adds a cleanup callback to the isolation context.
Adds a tracked ETS table to the isolation context.
Adds a tracked process to the isolation context.
Fetches the isolation context stored in the current process.
Returns whether the isolation type allows async testing.
Returns the timeout for the isolation type.
Stores the isolation context in the current process.
Sets up test isolation based on the specified isolation type.
Verifies test isolation has been maintained.
Waits for a supervision tree to be ready.
Functions
Deprecated macro maintained for backwards compatibility.
@spec add_cleanup_callback(Supertester.IsolationContext.t(), (-> any())) :: Supertester.IsolationContext.t()
Adds a cleanup callback to the isolation context.
@spec add_tracked_ets_table(Supertester.IsolationContext.t(), term()) :: Supertester.IsolationContext.t()
Adds a tracked ETS table to the isolation context.
@spec add_tracked_process( Supertester.IsolationContext.t(), Supertester.IsolationContext.process_info() ) :: Supertester.IsolationContext.t()
Adds a tracked process to the isolation context.
@spec fetch_isolation_context() :: Supertester.IsolationContext.t() | nil
Fetches the isolation context stored in the current process.
Returns whether the isolation type allows async testing.
@spec isolation_timeout(atom()) :: non_neg_integer()
Returns the timeout for the isolation type.
@spec put_isolation_context(Supertester.IsolationContext.t() | nil) :: Supertester.IsolationContext.t() | nil
Stores the isolation context in the current process.
Sets up test isolation based on the specified isolation type.
Verifies test isolation has been maintained.
@spec wait_for_supervision_tree_ready(pid(), non_neg_integer()) :: {:ok, pid()} | {:error, :timeout}
Waits for a supervision tree to be ready.