What mode do you prefer for Ecto.Adapters.SQL.Sandbox? (Ecto + ExUnit)

The links you shared are a little out of date :slight_smile: The updated documentation is at Ecto.Adapters.SQL.Sandbox β€” Ecto SQL v3.14.0 - Your version is Ecto 2.0 beta. Ecto is now on version 3.9

You probably want to leave it on :auto or set it to :manual - I set it to :manual in test_helpers.exs

If you use :shared, you can no longer run your tests async. This is because :shared mode can introduce non-determinism because the test processes / transactions can see each of the other test transactions data it has inserted into the database. See 8 Common Causes of Flaky Tests in Elixir | AppSignal Blog for more info (#2 in the list)

2 Likes