testing.go: use COMMENTO_POSTGRES if set

This commit is contained in:
Adhityaa 2018-06-08 00:39:01 +05:30
parent 3252c30dd9
commit 73647421fb

View File

@ -61,7 +61,12 @@ func dropTables() error {
} }
func setupTestDatabase() error { func setupTestDatabase() error {
os.Setenv("POSTGRES", "postgres://postgres:postgres@0.0.0.0/commento_test?sslmode=disable") if os.Getenv("COMMENTO_POSTGRES") != "" {
// set it manually because we need to use commento_test, not commento, by mistake
os.Setenv("POSTGRES", os.Getenv("COMMENTO_POSTGRES"))
} else {
os.Setenv("POSTGRES", "postgres://postgres:postgres@0.0.0.0/commento_test?sslmode=disable")
}
if err := connectDB(); err != nil { if err := connectDB(); err != nil {
return err return err