From 2d76c4517054c51fa3f38026f7a363defa52ecfd Mon Sep 17 00:00:00 2001 From: Yureka Date: Thu, 29 Aug 2024 12:40:57 +0200 Subject: [PATCH 1/2] support specifying custom database url for tests --- oui/db_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/oui/db_test.go b/oui/db_test.go index cdef72a..8741b91 100644 --- a/oui/db_test.go +++ b/oui/db_test.go @@ -1,7 +1,6 @@ package oui_test import ( - "fmt" "os" "path/filepath" "testing" @@ -19,9 +18,8 @@ func Test_New(t *testing.T) { t.Run("postgres", func(t *testing.T) { t.Parallel() - password := os.Getenv("POSTGRES_PASSWORD") - require.NotEqual(t, "", password, "missing POSTGRES_PASSWORD environment variable") - cs := fmt.Sprintf("postgresql://oui:%s@localhost/oui?sslmode=disable", password) + cs := os.Getenv("POSTGRES_URL") + require.NotEqual(t, "", cs, "missing POSTGRES_URL environment variable") psql, err := oui.CreatePostgresOption(cs) require.NoError(t, err) ouidb, err := oui.New(oui.WithVersion("test"), psql) From 0eec614fc8785f0773cfd3660d3e104a051841ec Mon Sep 17 00:00:00 2001 From: Yureka Date: Thu, 29 Aug 2024 12:42:26 +0200 Subject: [PATCH 2/2] use new POSTGRES_URL option in CI --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ca17053..57fed36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,4 +37,4 @@ jobs: - name: Run Tests run: go test -v ./... env: - POSTGRES_PASSWORD: oui + POSTGRES_URL: postgresql://oui:oui@localhost/oui?sslmode=disable