mix test
task starts the application. The repo should be started first, before the sandbox mode can be selected. Calling Repo.start_link
in test_helper.exs
is the correct approach. Ecto uses it frequently in the integration test suite: https://github.com/elixir-ecto/ecto/blob/master/integration_test/pg/test_helper.exs#L74
It might be desired to also call Adapter.ensure_all_started(Repo, :temporary)
to start all dependent applications.