From 68ac5f24ddbbbd544498c3193a38f5408f05e2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 11 Jan 2024 16:23:26 +0100 Subject: [PATCH] Set pool size to the numbers of schedulers online By default, ExUnit runs schedulers_online() * 2 tests concurrently, therefore we need to have the same amount of DB connections available to avoid checkout errors. --- installer/lib/phx_new/generator.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/lib/phx_new/generator.ex b/installer/lib/phx_new/generator.ex index de8284e2e5..3acef5ad15 100644 --- a/installer/lib/phx_new/generator.ex +++ b/installer/lib/phx_new/generator.ex @@ -358,7 +358,7 @@ defmodule Phx.New.Generator do hostname: "localhost", database: {:literal, ~s|"#{app}_test\#{System.get_env("MIX_TEST_PARTITION")}"|}, pool: Ecto.Adapters.SQL.Sandbox, - pool_size: 10 + pool_size: {:literal, ~s|System.schedulers_online() * 2|} ], test_setup_all: "Ecto.Adapters.SQL.Sandbox.mode(#{inspect(module)}.Repo, :manual)", test_setup: """