Skip to content

Commit

Permalink
Prevent race condition in stager telemetry test
Browse files Browse the repository at this point in the history
  • Loading branch information
sorentwo committed Oct 2, 2023
1 parent 32e1839 commit de73c80
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/oban/stager_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ defmodule Oban.StagerTest do

start_supervised_oban!(stage_interval: 5, testing: :disabled)

with_backoff(fn ->
assert %{state: "available"} = Repo.reload(job_1)
assert %{state: "scheduled"} = Repo.reload(job_2)
assert %{state: "available"} = Repo.reload(job_3)
end)

assert_receive {:event, :start, %{system_time: _}, %{conf: _, plugin: Stager}}
assert_receive {:event, :stop, %{duration: _}, %{plugin: Stager} = meta}

Expand All @@ -29,6 +23,10 @@ defmodule Oban.StagerTest do
jobs
|> Enum.map(& &1.state)
|> Enum.sort()

assert %{state: "available"} = Repo.reload(job_1)
assert %{state: "scheduled"} = Repo.reload(job_2)
assert %{state: "available"} = Repo.reload(job_3)
end

test "switching to local mode without functional pubsub" do
Expand Down

0 comments on commit de73c80

Please sign in to comment.