Skip to content

Commit

Permalink
Use on_exit callback to stop :eventstore app in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slashdotdash committed Jan 15, 2018
1 parent 879db19 commit 89169e1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/support/storage_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ defmodule EventStore.StorageCase do
config = Config.parsed()
registry = Application.get_env(:eventstore, :registry, :local)

before_reset(registry)

{:ok, conn} = Postgrex.start_link(config)

EventStore.Storage.Initializer.reset!(conn)

after_reset(registry)

on_exit(fn ->
after_exit(registry)

ProcessHelper.shutdown(conn)
end)

{:ok, %{conn: conn}}
end

defp before_reset(:local) do
defp after_exit(:local) do
Application.stop(:eventstore)
end

defp before_reset(:distributed) do
defp after_exit(:distributed) do
_ = :rpc.multicall(Application, :stop, [:eventstore])
end

Expand Down

0 comments on commit 89169e1

Please sign in to comment.