Intermittent DBConnection.ConnectionError in tests

Hey all, we’re having the same problem. As suggested in the referenced issue Intermittent DBConnection.ConnectionError in tests · Issue #3545 · phoenixframework/phoenix_live_view · GitHub we were having async tasks fire off in Liveviews that made db accesses but the tests didn’t wait for them. render_async(view) is what fixed it.

Except we’re still seeing those errors for some of the tests. They don’t always appear (yay concurrency!) but when they do we have no inkling which tests logged those errors.

  • We did liberally apply render_async(view) everywhere - but they’re still there, so maybe these aren’t liveview tests triggering this?
  • also tried to run each test file on its own - but the errors don’t pop up then.
  • we also did try to run mix test --trace - but that changes the test behaviour completely (runs everything serially as far as I can tell) so the error output never shows up in there.

So I was wondering.. has anyone ever figured out a good solution for dealing with this? I would even be open to a hack, e.g. patching up ExUnit locally to print test filenames but couldn’t figure how to do that only when there’s some error output in the console.