From 73647421fbd8e0330cdf03af49c477f250ae7314 Mon Sep 17 00:00:00 2001 From: Adhityaa Date: Fri, 8 Jun 2018 00:39:01 +0530 Subject: [PATCH] testing.go: use COMMENTO_POSTGRES if set --- api/testing.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/testing.go b/api/testing.go index f91777c..d76b018 100644 --- a/api/testing.go +++ b/api/testing.go @@ -61,7 +61,12 @@ func dropTables() 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 { return err