Return url of test database (#48)
It is helpful to connect to a database when tests have failed.
This commit is contained in:
1 parent
7d8661be31
commit
8d7f24268c
7 files changed
+25
-25
No files matched your search
@@ -21,7 +21,7 @@ returning id;
|
||||
`
|
||||
)
|
||||
|
||||
cleanup, conn := TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
defer conn.Close()
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
func TestDb_Update(t *testing.T) {
|
||||
// intentionally not run with t.Parallel so we don't need to use DoTx for the Update tests
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
@@ -167,7 +167,7 @@ func TestDb_Update(t *testing.T) {
|
||||
|
||||
func TestDb_Create(t *testing.T) {
|
||||
// intentionally not run with t.Parallel so we don't need to use DoTx for the Create tests
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
@@ -275,7 +275,7 @@ func TestDb_Create(t *testing.T) {
|
||||
|
||||
func TestDb_LookupByName(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
@@ -330,7 +330,7 @@ func TestDb_LookupByName(t *testing.T) {
|
||||
|
||||
func TestDb_LookupByPublicId(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
@@ -385,7 +385,7 @@ func TestDb_LookupByPublicId(t *testing.T) {
|
||||
|
||||
func TestDb_LookupWhere(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
@@ -435,7 +435,7 @@ func TestDb_LookupWhere(t *testing.T) {
|
||||
|
||||
func TestDb_SearchWhere(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
@@ -485,7 +485,7 @@ func TestDb_SearchWhere(t *testing.T) {
|
||||
|
||||
func TestDb_DB(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
@@ -508,7 +508,7 @@ func TestDb_DB(t *testing.T) {
|
||||
|
||||
func TestDb_DoTx(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
@@ -608,7 +608,7 @@ func TestDb_DoTx(t *testing.T) {
|
||||
|
||||
func TestDb_Delete(t *testing.T) {
|
||||
// intentionally not run with t.Parallel so we don't need to use DoTx for the Create tests
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
@@ -789,7 +789,7 @@ func TestDb_Delete(t *testing.T) {
|
||||
|
||||
func TestDb_ScanRows(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, db := TestSetup(t, "postgres")
|
||||
cleanup, db, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer db.Close()
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// setup the tests (initialize the database one-time and intialized testDatabaseURL)
|
||||
func TestSetup(t *testing.T, dialect string) (func() error, *gorm.DB) {
|
||||
func TestSetup(t *testing.T, dialect string) (func() error, *gorm.DB, string) {
|
||||
cleanup := func() error { return nil }
|
||||
var url string
|
||||
var err error
|
||||
@@ -24,7 +24,7 @@ func TestSetup(t *testing.T, dialect string) (func() error, *gorm.DB) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return cleanup, db
|
||||
return cleanup, db, url
|
||||
}
|
||||
|
||||
// TestWrapper initializes an AEAD wrapping.Wrapper for testing the oplog
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
func Test_Utils(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
defer conn.Close()
|
||||
t.Run("nothing", func(t *testing.T) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
func Test_Repository_CreateScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
@@ -52,7 +52,7 @@ func Test_Repository_CreateScope(t *testing.T) {
|
||||
|
||||
func Test_Repository_UpdateScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
@@ -138,7 +138,7 @@ func Test_Repository_UpdateScope(t *testing.T) {
|
||||
|
||||
func Test_Repository_LookupScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
func TestNewRepository(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
@@ -100,7 +100,7 @@ func TestNewRepository(t *testing.T) {
|
||||
}
|
||||
func Test_Repository_create(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
@@ -149,7 +149,7 @@ func Test_Repository_create(t *testing.T) {
|
||||
|
||||
func Test_dbRepository_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
func Test_NewScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
@@ -49,7 +49,7 @@ func Test_NewScope(t *testing.T) {
|
||||
}
|
||||
func Test_ScopeCreate(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
@@ -89,7 +89,7 @@ func Test_ScopeCreate(t *testing.T) {
|
||||
|
||||
func Test_ScopeUpdate(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
@@ -127,7 +127,7 @@ func Test_ScopeUpdate(t *testing.T) {
|
||||
}
|
||||
func Test_ScopeGetScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
@@ -178,7 +178,7 @@ func TestScope_ResourceType(t *testing.T) {
|
||||
|
||||
func TestScope_Clone(t *testing.T) {
|
||||
t.Parallel()
|
||||
cleanup, conn := db.TestSetup(t, "postgres")
|
||||
cleanup, conn, _ := db.TestSetup(t, "postgres")
|
||||
defer cleanup()
|
||||
assert := assert.New(t)
|
||||
defer conn.Close()
|
||||
|
||||
Reference in new issue
Block a user