Belay.Testing (Belay v1.0.0)

Copy Markdown View Source

Synchronous, deterministic execution for tests: drain/3 claims and runs ready jobs in the calling process until the queue is empty, following workflow releases as they happen.

Summary

Functions

Drain a queue synchronously. Returns counts by terminal outcome, e.g. %{succeeded: 3, failed: 1}. Only claims jobs that are due at the current clock time — advance a Belay.Clock.Sim to reach scheduled work.

Functions

drain(name, queue, opts \\ [])

@spec drain(Belay.instance(), atom() | String.t(), keyword()) :: %{
  optional(atom()) => non_neg_integer()
}

Drain a queue synchronously. Returns counts by terminal outcome, e.g. %{succeeded: 3, failed: 1}. Only claims jobs that are due at the current clock time — advance a Belay.Clock.Sim to reach scheduled work.