Adds healthy check to model
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func getDbMock(t *testing.T) (models.Store, sqlmock.Sqlmock) {
|
||||
db, mock, err := sqlmock.New()
|
||||
db, mock, err := sqlmock.New(sqlmock.MonitorPingsOption(true))
|
||||
if err != nil {
|
||||
t.Fatalf("got an error creating a stub db. How?: %s", err)
|
||||
}
|
||||
@@ -385,3 +385,16 @@ func TestErrActionByID(t *testing.T) {
|
||||
t.Errorf("unfulfilled expectations: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConnectionLive(t *testing.T) {
|
||||
// setup
|
||||
assert := assert.New(t)
|
||||
str, mock := getDbMock(t)
|
||||
|
||||
mock.ExpectPing()
|
||||
|
||||
// perform func under tests
|
||||
err := str.ConnectionLive()
|
||||
// results
|
||||
assert.Nil(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user