Testcontainers - A Testcontainers implementation for Elixir

Not really an answer to your exact question, but we had a similar issue of running tests in parallel in my last job, and we solved it by using a different database for each db connection in the pool.

I wrote about it a bit here - Experimenting with running mysql tests in parallel


Initially I was going to suggest configure option to switch server, but realized that configure hook only comes into play after it is connected to DB, so we can’t really use it to switch different db server running at different port

UPDATE: on second look, you should be able to configure to switch to a different DB server running on a different port for every connection (haven’t tested)