From 7fb9fff11b0fda174608a13c198bf43b6495477f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 16 Sep 2020 05:09:48 -0600 Subject: [PATCH] WIP SQL test --- mgmt/authstore/authstore_postgres_test.go | 14 ++++++++++++++ mgmt/authstore/authstore_test.go | 10 ---------- 2 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 mgmt/authstore/authstore_postgres_test.go 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)