Merge pull request #458 from hashicorp/h-notes

Pass notes field from service checks through
This commit is contained in:
Ryan Uber 2014-11-06 21:07:45 -08:00
commit 1b63cbf21e
3 changed files with 12 additions and 2 deletions

View File

@ -447,7 +447,7 @@ func (a *Agent) AddService(service *structs.NodeService, chkType *CheckType) err
CheckID: fmt.Sprintf("service:%s", service.ID),
Name: fmt.Sprintf("Service '%s' check", service.Service),
Status: structs.HealthCritical,
Notes: "",
Notes: chkType.Notes,
ServiceID: service.ID,
ServiceName: service.Service,
}

View File

@ -115,7 +115,10 @@ func TestAgent_AddService(t *testing.T) {
Tags: []string{"foo"},
Port: 8000,
}
chk := &CheckType{TTL: time.Minute}
chk := &CheckType{
TTL: time.Minute,
Notes: "redis health check",
}
err := agent.AddService(srv, chk)
if err != nil {
t.Fatalf("err: %v", err)
@ -135,6 +138,11 @@ func TestAgent_AddService(t *testing.T) {
if _, ok := agent.checkTTLs["service:redis"]; !ok {
t.Fatalf("missing redis check ttl")
}
// Ensure the notes are passed through
if agent.state.Checks()["service:redis"].Notes == "" {
t.Fatalf("missing redis check notes")
}
}
func TestAgent_RemoveService(t *testing.T) {

View File

@ -30,6 +30,8 @@ type CheckType struct {
Interval time.Duration
TTL time.Duration
Notes string
}
// Valid checks if the CheckType is valid