Not sure if I got it correctly though I thought that specifying async: false
would stop tests from running concurrently? Still I get the same bug as described here (the test cases all still pass, it’s just that the error messages appear in the console. When I try to run only one single test, everything’s fine).
I’ve tried different proposed solutions such as
- Setting
Ecto.Adapters.SQL.Sandbox.mode(App.Repo, {:shared, self()})
intest_helper.exs
- Writing
parent = self() Task.start(fn -> Ecto.Adapters.SQL.Sandbox.allow(Repo, parent, self()) apply(mod, func, args) end)
- Use Elixir 1.8.0 and DBConnection 2.0.5 (it did fix another bug with tests though)
But none of them worked.
I wonder if it has something to do with the usage of Task.start
.
I was trying to adapt the code posted by Chris McCord at https://stackoverflow.com/questions/33934029/how-to-detect-if-a-user-left-a-phoenix-channel-due-to-a-network-disconnect. I wonder if that code itself is a bit outdated.