Trouble starting Ecto with Mix test

Hi guys,

I’m trying to write tests for the database app in my umbrella application, but I can’t get Ecto to boot up correctly. I’m going cross-eyed trying to figure this out lol. Everything runs fine in the shell in the :dev environment. Unfortunately, this thread didn’t help me solve my problem.

** (RuntimeError) cannot configure sandbox with pool DBConnection.Poolboy.
To use the SQL Sandbox, configure your repository pool as:

      pool: Ecto.Adapters.SQL.Sandbox

    (ecto) lib/ecto/adapters/sql/sandbox.ex:410: Ecto.Adapters.SQL.Sandbox.mode/2
    (elixir) lib/code.ex:363: Code.require_file/2
    (elixir) lib/enum.ex:651: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:651: Enum.each/2
    (mix) lib/mix/tasks/test.ex:228: Mix.Tasks.Test.run/1

This is my configuration:

apps/mydb/config/config.exs

use Mix.Config
import_config "#{Mix.env}.exs"

apps/mydb/config/test.exs

config :datastore, Mydb.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: "postgres",
  password: "postgres",
  database: "mydb_test",
  hostname: "localhost",
  pool: Ecto.Adapters.SQL.Sandbox

I don’t have any other db configs in the other umbrella apps that could be overwriting the :pool configuration, so I can’t figure out why I’m getting the configure error message.

Has anyone seen this type of error before?

Thanks!

1 Like

Have you tried deleting _build?

5 Likes

That did it! Thank you!!

2 Likes