Skip to content

Commit

Permalink
simplify and clarify code for tests, comments, and purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
puellanivis committed Jun 8, 2018
1 parent 90cb3ad commit c893dba
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestDoubleRegister(t *testing.T) {
t.Errorf("checks lenght differes from zero: got %d", len(checkMap))
}

healthcheckName := "succeed"
healthcheckName := "healthcheck"

conf := Config{
Name: healthcheckName,
Expand All @@ -48,22 +48,17 @@ func TestDoubleRegister(t *testing.T) {

err = Register(conf)
if err == nil {
t.Error("the second registration of a health check should return an error, but did not")
t.Error("the second registration of a health check config should return an error, but did not")
}

err = Register(Config{
Name: healthcheckName,
Check: func() error {
// this function is non-trival solely to ensure that the compiler does not get optimized.
if len(checkMap) > 0 {
return nil
}

return errors.New("no health checks registered")
return errors.New("health checks registered")
},
})
if err == nil {
t.Error("health check registration with same name different details should still return an error, but did not")
t.Error("registration with same name, but different details should still return an error, but did not")
}
}

Expand Down

0 comments on commit c893dba

Please sign in to comment.