Skip to content

Commit 2bc981c

Browse files
fix: handle 'connection reset by peer' in postgres test utility
Add 'connection reset by peer' to the list of errors that should trigger starting a new postgres container in the test utility. This fixes flaky tests that fail when PostgreSQL resets connections. Fixes: coder/internal#695 Co-authored-by: ibetitsmike <203725896+ibetitsmike@users.noreply.github.com>
1 parent 44d4646 commit 2bc981c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

coderd/database/dbtestutil/postgres.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func initDefaultConnection(t TBSubset) error {
7171
errSubstrings := []string{
7272
"connection refused", // this happens on Linux when there's nothing listening on the port
7373
"No connection could be made", // like above but Windows
74+
"connection reset by peer", // this happens when PostgreSQL resets the connection
7475
}
7576
errString := dbErr.Error()
7677
for _, errSubstring := range errSubstrings {

0 commit comments

Comments
 (0)