diff --git a/mgmt/authstore/authstore_postgres_test.go b/mgmt/authstore/authstore_postgres_test.go new file mode 100644 index 0000000..b114a26 --- /dev/null +++ b/mgmt/authstore/authstore_postgres_test.go @@ -0,0 +1,14 @@ +package authstore + +import "strings" + +var connStr = "postgres://postgres:postgres@localhost/postgres" + +func init() { + // TODO url.Parse + if strings.Contains(connStr, "@localhost/") || strings.Contains(connStr, "@localhost:") { + connStr += "?sslmode=disable" + } else { + connStr += "?sslmode=required" + } +} diff --git a/mgmt/authstore/authstore_test.go b/mgmt/authstore/authstore_test.go index 292cacc..b9265fe 100644 --- a/mgmt/authstore/authstore_test.go +++ b/mgmt/authstore/authstore_test.go @@ -2,22 +2,12 @@ package authstore import ( "fmt" - "strings" "testing" ) func TestStore(t *testing.T) { // Note: test output is cached (running twice will not result in two records) - connStr := "postgres://postgres:postgres@localhost/postgres" - if strings.Contains(connStr, "@localhost/") || strings.Contains(connStr, "@localhost:") { - connStr += "?sslmode=disable" - } else { - connStr += "?sslmode=required" - } - - // TODO url.Parse - store, err := NewStore(connStr, initSQL) if nil != err { t.Fatal("connection error", err)