Adds healthy check to model

This commit is contained in:
2020-12-31 18:05:06 -06:00
parent 2bda056ca7
commit 0e16bb5361
5 changed files with 50 additions and 1 deletions

View File

@@ -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)
}