Skip to content

Three worktrees testing at once exhaust Postgres, and it looks like a flaky test #2184

Description

@wintermeyer

Every worktree gets its own test database, but they all share one Postgres, and each suite claims thirty connections from a server that allows 150. Add the ten each running dev server holds and three worktrees testing at once sit at 120, so the fourth run dies. It does not look like a capacity problem: it surfaces as exactly one red test with a checkout timeout, which reads as a flake and gets re-run rather than understood. Measured here just now: 47 of 150 in use, 31 of them one suite.

The pool size should come from the environment the way the hostname and the partition beside it already do, so a machine running several worktrees can set it once and stop colliding with itself. Note the name POOL_SIZE is already taken by config/runtime.exs for production, so this one needs its own, and 30 stays the default so CI and a single checkout are unaffected.

Where: config/test.exs:272, beside the DATABASE_HOST read at line 263.

An AI agent wrote this text in my name. I know that is problematic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Tech DebtDoes what it promises; the way it does it is the problem

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions