fix: Sandbox owner checks in DB connection before exiting
Some checks failed
CI / Test (OTP 27.2 / Elixir 1.18.2) (push) Failing after 0s
CI / Test (OTP 28.4 / Elixir 1.19.4 + Marmot E2E) (push) Failing after 0s

The shared sandbox owner process exited without releasing its Postgrex
connection, causing intermittent "client exited" error logs on CI. The
owner now calls Sandbox.checkin before exiting, and on_exit waits for
the owner to finish before switching to manual mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 20:11:31 +01:00
parent a19b7d97f0
commit 7b2d92b714

View File

@@ -47,7 +47,8 @@ defmodule Parrhesia.IntegrationCase do
send(test_pid, {:sandbox_ready, self()}) send(test_pid, {:sandbox_ready, self()})
receive do receive do
:stop -> :ok :stop ->
Sandbox.checkin(Repo)
end end
end) end)
@@ -60,8 +61,16 @@ defmodule Parrhesia.IntegrationCase do
Sandbox.mode(Repo, {:shared, owner}) Sandbox.mode(Repo, {:shared, owner})
on_exit(fn -> on_exit(fn ->
Sandbox.mode(Repo, :manual) ref = Process.monitor(owner)
send(owner, :stop) send(owner, :stop)
receive do
{:DOWN, ^ref, :process, ^owner, _reason} -> :ok
after
5_000 -> :ok
end
Sandbox.mode(Repo, :manual)
end) end)
end end