H.Provider.Fake (H v0.3.0)

Copy Markdown View Source

Deterministic scripted H.Provider for --no-start unit and recovery tests.

Steps in script: [...] are consumed strictly in FIFO order. Any call to stream_turn/3 when the script queue is exhausted raises H.Provider.Fake.UnscriptedRequestError (or returns an error if on_unscripted: :error is configured) rather than repeating an earlier answer.

Summary

Functions

Returns a specification to start this module under a supervisor.

Appends a step to the script queue.

Returns the remaining scripted steps.

Returns all requests passed to stream_turn/3 in arrival order.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

push_step(server \\ __MODULE__, step)

@spec push_step(GenServer.server(), term()) :: :ok

Appends a step to the script queue.

remaining(server \\ __MODULE__)

@spec remaining(GenServer.server()) :: [term()]

Returns the remaining scripted steps.

requests(server \\ __MODULE__)

@spec requests(GenServer.server()) :: [map()]

Returns all requests passed to stream_turn/3 in arrival order.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()