Skip to content

Commit 259c53a

Browse files
test ping
1 parent 85a1d13 commit 259c53a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

dao/pgimpl/postgres_impl_priv_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pgimpl
2+
3+
import (
4+
"testing"
5+
6+
_ "github.com/golang-migrate/migrate/v4/source/file"
7+
_ "github.com/lib/pq" // we import the driver used by sqlx
8+
"github.com/stretchr/testify/assert"
9+
)
10+
11+
func TestPingNoDb(t *testing.T) {
12+
impl := pgFlagImpl{}
13+
assert.Error(t, impl.Ping())
14+
}

dao/pgimpl/postgres_impl_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,5 +943,11 @@ func TestUpdateFlag(t *testing.T) {
943943
}
944944
})
945945
}
946+
}
946947

948+
func TestPingSuccess(t *testing.T) {
949+
pgContainer, conn := setupTest(t, []string{})
950+
defer tearDownTest(t, pgContainer, conn)
951+
pgDao := getPostgresDao(t, pgContainer)
952+
assert.NoError(t, pgDao.Ping())
947953
}

0 commit comments

Comments
 (0)