ci: fix db test init to respect POSTGRES_HOST from env
Backend Tests / test (push) Failing after 50s

This commit is contained in:
2026-06-25 00:59:22 +01:00
parent 3cb6a7f6ad
commit a11d2538e9
+9 -3
View File
@@ -11,15 +11,21 @@ import (
func init() { func init() {
// Set defaults for test environment if not already set // Set defaults for test environment if not already set
host := os.Getenv("POSTGRES_HOST")
if host == "" {
if h := os.Getenv("TEST_DB_HOST"); h != "" {
host = h
} else {
host = "localhost"
}
os.Setenv("POSTGRES_HOST", host)
}
if os.Getenv("POSTGRES_USER") == "" { if os.Getenv("POSTGRES_USER") == "" {
os.Setenv("POSTGRES_USER", "myuser") os.Setenv("POSTGRES_USER", "myuser")
} }
if os.Getenv("POSTGRES_PASSWORD") == "" { if os.Getenv("POSTGRES_PASSWORD") == "" {
os.Setenv("POSTGRES_PASSWORD", "mypassword") os.Setenv("POSTGRES_PASSWORD", "mypassword")
} }
if os.Getenv("POSTGRES_HOST") == "" {
os.Setenv("POSTGRES_HOST", "localhost")
}
if os.Getenv("POSTGRES_DB") == "" { if os.Getenv("POSTGRES_DB") == "" {
os.Setenv("POSTGRES_DB", "crussell_test") os.Setenv("POSTGRES_DB", "crussell_test")
} }