4

When running a set of tests by using mix test I get

 ** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.414.0>.

     When using ownership, you must manage connections in one
     of the three ways:

       * By explicitly checking out a connection
       * By explicitly allowing a spawned process
       * By running the pool in shared mode

     The first two options require every new process to explicitly
     check a connection out or be allowed by calling checkout or
     allow respectively.

     The third option requires a {:shared, pid} mode to be set.
     If using shared mode in tests, make sure your tests are not
     async.

     If you are reading this error, it means you have not done one
     of the steps above or that the owner process has crashed.

I have already replaced Ecto.Adapters.SQL.Sandbox.mode(Secure.Repo, :manual) by Ecto.Adapters.SQL.Sandbox.mode(Secure.Repo, {:shared, self()}) in test/test_helper.exs.

Tests failing belong to the same test file, where I am not using ExUnit.Case, async: true.

If I run them isolatedly they run ok. Still not completely sure if it has something to do with tests being run in parallel way using a MySQL server.

4

0 に答える 0