Periodic.Test (parent v0.12.1) View Source
Helpers for testing a periodic job.
See the "Testing" section in Periodic
documentation for details.
Link to this section Summary
Functions
Waits for the given telemetry event.
Subscribes to telemetry events of the given scheduler.
Asserts that the given telemetry event won't be emitted.
Sends a tick signal to the given scheduler and waits for the job to finish.
Sends a tick signal to the given scheduler.
Link to this section Functions
assert_periodic_event(telemetry_id, event, metadata \\ quote do _ end, measurements \\ quote do _ end)
View Source (macro)Waits for the given telemetry event.
Specs
observe(any()) :: :ok
Subscribes to telemetry events of the given scheduler.
refute_periodic_event(telemetry_id, event, metadata \\ quote do _ end, measurements \\ quote do _ end)
View Source (macro)Asserts that the given telemetry event won't be emitted.
Specs
sync_tick(GenServer.server(), non_neg_integer() | :infinity) :: {:ok, job_exit_reason :: any()} | {:error, :job_not_started}
Sends a tick signal to the given scheduler and waits for the job to finish.
The function returns the job exit reason, or error if the job hasn't been started.
Specs
tick(GenServer.server()) :: :ok
Sends a tick signal to the given scheduler.
This function returns after the tick signal has been sent, and the job has been started.
However, the function doesn't wait for the job to finish. If you want complete synchronism, use
sync_tick/2