Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support specifying custom database url for tests #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions oui/db_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package oui_test

import (
"fmt"
"os"
"path/filepath"
"testing"
Expand All @@ -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)
Expand Down