fix(testdb): fallback to POSTGRES_HOST in dbHost()
Backend Tests / test (push) Failing after 2m31s

dbHost() only checked TEST_DB_HOST, defaulting to localhost. When the
CI workflow removed PG service port mappings (to avoid host port conflicts),
all tests using testdb.CreateTestDatabase() failed because localhost:5432
was unreachable inside the job container.

The workflow sets POSTGRES_HOST=postgres for the db package's Connect(),
but testdb's dbHost() never checked this env var. Add POSTGRES_HOST as
a second fallback so all packages using testdb automatically work with
the existing CI configuration.
This commit is contained in:
2026-06-25 01:11:00 +01:00
parent 0ac69a92c7
commit 7accd73463
+3
View File
@@ -33,6 +33,9 @@ func dbHost() string {
if h := os.Getenv("TEST_DB_HOST"); h != "" {
return h
}
if h := os.Getenv("POSTGRES_HOST"); h != "" {
return h
}
return "localhost"
}