Closed up2jj closed 1 month ago
I defined batch worker with the handle_cancelled/1 callback:
handle_cancelled/1
@impl Batch def handle_cancelled(%Job{meta: %{"batch_id" => batch_id}}) do Logger.error("Some jobs were cancelled during import, batch_id: #{batch_id}") :ok end
https://oban.dev/docs/pro/1.3.5/Oban.Pro.Workers.Batch.html#c:handle_cancelled/1
I am trying to test callback behaviour with Oban.Testing.Pro.perform_callback/4 but cancelled callback is not supported:
Oban.Testing.Pro.perform_callback/4
cancelled
test "handle_cancelled/1" do assert :ok = perform_callback(MyJob, :cancelled, %{batch_id: "batch_id"}) end
It gives: Expected callback to be included in [:attempted, :completed, :discarded, :exhausted], got: :cancelled.
Expected callback to be included in [:attempted, :completed, :discarded, :exhausted], got: :cancelled
Checks for other callbacks work fine.
Oban.Testing.Pro.perform_callback/4 should support cancelled callback.
Thanks for the report. This is fixed on main and will be in the next patch release.
Environment
Current Behavior
I defined batch worker with the
handle_cancelled/1
callback:https://oban.dev/docs/pro/1.3.5/Oban.Pro.Workers.Batch.html#c:handle_cancelled/1
I am trying to test callback behaviour with
Oban.Testing.Pro.perform_callback/4
butcancelled
callback is not supported:It gives:
Expected callback to be included in [:attempted, :completed, :discarded, :exhausted], got: :cancelled
.Checks for other callbacks work fine.
Expected Behavior
Oban.Testing.Pro.perform_callback/4
should supportcancelled
callback.