diff --git a/pkg/sm/sm.go b/pkg/sm/sm.go index 5b92b68a6..c9b946af3 100644 --- a/pkg/sm/sm.go +++ b/pkg/sm/sm.go @@ -134,7 +134,7 @@ func New(ctx context.Context, cancel context.CancelFunc, cfg *config.Settings) ( return nil, fmt.Errorf("error creating core api: %s", err) } - storageHealthIndicator, err := storage.NewHealthIndicator(storage.PingFunc(smStorage.PingContext)) + storageHealthIndicator, err := storage.NewSQLHealthIndicator(storage.PingFunc(smStorage.PingContext)) if err != nil { return nil, fmt.Errorf("error creating storage health indicator: %s", err) } diff --git a/storage/healthcheck.go b/storage/healthcheck.go index d44b73a87..d74d07396 100644 --- a/storage/healthcheck.go +++ b/storage/healthcheck.go @@ -21,7 +21,8 @@ import ( "github.com/Peripli/service-manager/pkg/health" ) -func NewHealthIndicator(pingFunc PingFunc) (health.Indicator, error) { +// NewSQLHealthIndicator returns new health indicator for sql storage given a ping function +func NewSQLHealthIndicator(pingFunc PingFunc) (health.Indicator, error) { sqlConfig := &checkers.SQLConfig{ Pinger: pingFunc, } @@ -30,19 +31,19 @@ func NewHealthIndicator(pingFunc PingFunc) (health.Indicator, error) { return nil, err } - indicator := &HealthIndicator{ + indicator := &SQLHealthIndicator{ SQL: sqlChecker, } return indicator, nil } -// HealthIndicator returns a new indicator for the storage -type HealthIndicator struct { +// SQLHealthIndicator returns a new indicator for SQL storage +type SQLHealthIndicator struct { *checkers.SQL } // Name returns the name of the storage component -func (i *HealthIndicator) Name() string { +func (i *SQLHealthIndicator) Name() string { return "storage" } diff --git a/storage/healthcheck_test.go b/storage/healthcheck_test.go index 1ea4d0ac2..fcc4da2ba 100644 --- a/storage/healthcheck_test.go +++ b/storage/healthcheck_test.go @@ -33,7 +33,7 @@ var _ = Describe("Healthcheck", func() { return nil } var err error - healthIndicator, err = storage.NewHealthIndicator(storage.PingFunc(ping)) + healthIndicator, err = storage.NewSQLHealthIndicator(storage.PingFunc(ping)) Expect(err).ShouldNot(HaveOccurred()) }) @@ -56,7 +56,7 @@ var _ = Describe("Healthcheck", func() { return expectedError } var err error - healthIndicator, err = storage.NewHealthIndicator(storage.PingFunc(ping)) + healthIndicator, err = storage.NewSQLHealthIndicator(storage.PingFunc(ping)) Expect(err).ShouldNot(HaveOccurred()) }) It("Contains error", func() {