dstull
September 28, 2017, 1:55pm
1
moved working app into an new umbrella app, now mix test fails with the below, but mix phx.server works
mix test
==> shield
** (ArgumentError) argument error
(stdlib) :ets.lookup_element(Ecto.Registry, nil, 3)
(ecto) lib/ecto/registry.ex:18: Ecto.Registry.lookup/1
(ecto) lib/ecto/adapters/sql/sandbox.ex:426: Ecto.Adapters.SQL.Sandbox.mode/2
(elixir) lib/code.ex:376: Code.require_file/2
(elixir) lib/enum.ex:675: Enum.ā-each/2-lists^foreach/1-0-ā/2
ecto rev 2.2.4, elixir 1.5, phoenix 1.3.0
1 Like
dstull
September 28, 2017, 3:30pm
2
looks to have just been a config issue on my end in the test_helper.exs where I renamed by app, but did not rename on this line:
Ecto.Adapters.SQL.Sandbox.mode
2 Likes
idi527
September 29, 2017, 11:24am
3
Iām having a very similar error
1) test humanize errors (StoreTest)
test/store_test.exs:5
** (ArgumentError) argument error
stacktrace:
(stdlib) :ets.lookup_element(Ecto.Registry, nil, 3)
(ecto) lib/ecto/registry.ex:18: Ecto.Registry.lookup/1
(ecto) lib/ecto/adapters/sql/sandbox.ex:529: Ecto.Adapters.SQL.Sandbox.proxy_pool/1
(ecto) lib/ecto/adapters/sql/sandbox.ex:469: Ecto.Adapters.SQL.Sandbox.checkout/2
(store) test/support/data_case.ex:28: Store.DataCase.__ex_unit_setup_0/1
(store) test/support/data_case.ex:1: Store.DataCase.__ex_unit__/2
test/store_test.exs:1: StoreTest.__ex_unit__/2
But in my case all the names seem to be correct ā¦
test_helper.ex
ExUnit.start()
Ecto.Adapters.SQL.Sandbox.mode(Store.Repo, :manual)
support/data_case.ex
defmodule Store.DataCase do
use ExUnit.CaseTemplate
using do
quote do
alias Store.Repo
end
end
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Store.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Store.Repo, {:shared, self()})
end
:ok
end
end
config/test.exs
use Mix.Config
config :store, ecto_repos: [Store.Repo]
config :store, Store.Repo,
adapter: Ecto.Adapters.Postgres,
pool: Ecto.Adapters.SQL.Sandbox,
database: "db_test"
lib/store/repo.ex
defmodule Store.Repo do
use Ecto.Repo, otp_app: :store
end
It seems that for some reason the process is not started ⦠https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/registry.ex#L17
So in my case the process was failing because I forgot to run a migration. But this error was hidden behind several ** (DBConnection.OwnershipError) cannot find ownership process for
errors ā¦
mmmrrr
February 4, 2018, 10:44pm
4
Same for me, different solution.
In my case the process was not started because I simply forgot to register the supervisor for APP.Repo
in lib/APP/application.ex
.
Thanks to the both of you for writing this down and pointing in the right direction!