elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
306 stars 113 forks source link

Discussion: Make `:pool_index` public #302

Closed greg-rychlewski closed 9 months ago

greg-rychlewski commented 9 months ago

I was reading Elixir Forum and saw a reference to this old post: https://elixirforum.com/t/experimenting-with-running-mysql-tests-in-parallel/49108.

It's a pretty clever way to run async tests with MySQL. They create 1 database for each connection in their test pool and then use the configure option to choose which one to connect to.

Also, when I was looking into what pool_index is used for, it seems like it was made for similar purposes in this repo's unit tests: https://github.com/elixir-ecto/db_connection/blob/master/test/test_support.exs#L142

Maybe it would be a good idea to document this option and provide some clues to how it can be used in tests?

josevalim commented 9 months ago

I will be happy with documenting it. PR please? :)