Skip to content

Commit

Permalink
rename storage indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitarPetrov committed Aug 22, 2019
1 parent 91eb2a9 commit 06295e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/sm/sm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
11 changes: 6 additions & 5 deletions storage/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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"
}
4 changes: 2 additions & 2 deletions storage/healthcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})

Expand All @@ -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() {
Expand Down

0 comments on commit 06295e6

Please sign in to comment.