Skip to content

Commit

Permalink
handle OTP 26 GenServer.init errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmries committed Apr 17, 2024
1 parent 617a775 commit 2ac3f5b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/gnat/consumer_supervisor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,14 @@ defmodule Gnat.ConsumerSupervisorTest do
assert message =~ "At least one key or value found in metadata that was not a string"
end

# In OTP 26 the GenServer.init behavior changed to do a process EXIT when returning a
# {:stop, error} in GenServer.init
# We inherit this behavior, so for the purpose of testing, we trap those process exits
# to make sure we can process the `{:error, error}` tuple before the process exit kills
# our ExUnit test
defp start_service_supervisor(service_config) do
Process.flag(:trap_exit, true)

config = %{
connection_name: :something,
module: ExampleService,
Expand Down

0 comments on commit 2ac3f5b

Please sign in to comment.