Skip to content

ci: fix go flakes in database/internal

Warren Gifford requested to merge devx/ci-fix-db-conn-issues into main

Created by: jhchabran

Fixes https://github.com/sourcegraph/sourcegraph/issues/37743

Over time, we have increased the maxDbConns ƒor the test database from 3 to 10 and then 10 to 20.

This triggered flakes due to exhausting database connections that were fixed with https://github.com/sourcegraph/infrastructure/pull/3383. But the flakes are still appearing.

After taking a deeper look at the problem, I've found that the amount of parallelism that we're using within the go tests is setting those up for flakes. Go tests run as GOMAXPROCS packages test binary in parallel, which is then running some tests concurrently.

The problem is that GOMAXPROCS * maxDbConns > 200, so once in a while, those tests will fail.

So this PR lowers both GOMAXPROCS from 15~18 to 10 and maxDbConns from 20 to 15. That's not ideal, but this should reduce further the number of flakes (to I hope, zero, but time will tell).

Test plan

Merge request reports

Loading