ci: fix db test init to respect POSTGRES_HOST from env
Backend Tests / test (push) Failing after 50s
Backend Tests / test (push) Failing after 50s
This commit is contained in:
@@ -11,15 +11,21 @@ import (
|
||||
|
||||
func init() {
|
||||
// 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") == "" {
|
||||
os.Setenv("POSTGRES_USER", "myuser")
|
||||
}
|
||||
if os.Getenv("POSTGRES_PASSWORD") == "" {
|
||||
os.Setenv("POSTGRES_PASSWORD", "mypassword")
|
||||
}
|
||||
if os.Getenv("POSTGRES_HOST") == "" {
|
||||
os.Setenv("POSTGRES_HOST", "localhost")
|
||||
}
|
||||
if os.Getenv("POSTGRES_DB") == "" {
|
||||
os.Setenv("POSTGRES_DB", "crussell_test")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user