fix(tests): update database connection strings for CI
Integration Tests / integration-test (push) Failing after 57s

* Use dynamic host and port for Postgres in tests
* Add helper functions for test database host and port
This commit is contained in:
2026-09-18 21:07:28 +02:00
parent 21ce966d82
commit 63a7494982
7 changed files with 71 additions and 21 deletions
+26
View File
@@ -0,0 +1,26 @@
package integration
import (
"os"
"strconv"
)
// testDBHost and testDBPort let CI point the integration suite at a
// dynamically-assigned Postgres (TEST_DB_HOST/TEST_DB_PORT), avoiding a fixed
// host port that can collide with other jobs on a shared runner. Local dev
// keeps working unset, defaulting to the docker-compose test stack.
func testDBHost() string {
if h := os.Getenv("TEST_DB_HOST"); h != "" {
return h
}
return "127.0.0.1"
}
func testDBPort() int {
if p := os.Getenv("TEST_DB_PORT"); p != "" {
if n, err := strconv.Atoi(p); err == nil {
return n
}
}
return 5433
}