Skip to content

Commit

Permalink
Prevent sonar from starting in test modes
Browse files Browse the repository at this point in the history
Sonar has no purpose during tests, and it can cause sandbox issues when
tests run with the Postgres notifier.
  • Loading branch information
sorentwo committed Mar 14, 2024
1 parent a79f900 commit 156c5c8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/oban/sonar.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ defmodule Oban.Sonar do
def start_link(opts) do
{name, opts} = Keyword.pop(opts, :name)

GenServer.start_link(__MODULE__, struct!(State, opts), name: name)
conf = Keyword.fetch!(opts, :conf)

if conf.testing != :disabled do
:ignore
else
GenServer.start_link(__MODULE__, struct!(State, opts), name: name)
end
end

@impl GenServer
Expand Down

0 comments on commit 156c5c8

Please sign in to comment.