agent: pass notes field through for checks inside of service definitions. Fixes #449
This commit is contained in:
parent
2bf05057a4
commit
398179dcad
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -30,6 +30,8 @@ type CheckType struct {
|
|||
Interval time.Duration
|
||||
|
||||
TTL time.Duration
|
||||
|
||||
Notes string
|
||||
}
|
||||
|
||||
// Valid checks if the CheckType is valid
|
||||
|
|
Loading…
Reference in New Issue