Skip to content

Commit

Permalink
test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-burghardt committed May 9, 2024
1 parent a46225a commit 169ee3b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ jobs:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
PGHOST: localhost
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: wallet-backend
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -76,11 +74,8 @@ jobs:
ports:
- 5432:5432
env:
PGUSER: postgres
PGPASSWORD: postgres
PGHOST: localhost
PGPORT: 5432
DATABASE_URL: postgres://postgres@localhost:5432/postgres?sslmode=disable
DATABASE_URL: postgres://postgres@localhost:5432/wallet-backend?sslmode=disable
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
29 changes: 18 additions & 11 deletions internal/db/dbtest/dbtest_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package dbtest

// func TestOpen(t *testing.T) {
// db := Open(t)
// defer db.Close()
// conn := db.Open()
// defer conn.Close()

// count := 0
// err := conn.Get(&count, `SELECT COUNT(*) FROM gorp_migrations`)
// require.NoError(t, err)
// assert.Greater(t, count, 0)
// }
import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestOpen(t *testing.T) {
db := Open(t)
defer db.Close()
conn := db.Open()
defer conn.Close()

count := 0
err := conn.Get(&count, `SELECT COUNT(*) FROM gorp_migrations`)
require.NoError(t, err)
assert.Greater(t, count, 0)
}

0 comments on commit 169ee3b

Please sign in to comment.