Export the serf check ID

This commit is contained in:
Armon Dadgar 2014-01-15 17:24:16 -10:00
parent 7a74f58141
commit ea41b2bb26
4 changed files with 17 additions and 17 deletions

View File

@ -45,7 +45,7 @@ func TestHealth_ChecksInState(t *testing.T) {
}
// First check is automatically added for the server node
if checks[0].CheckID != serfCheckID {
if checks[0].CheckID != SerfCheckID {
t.Fatalf("Bad: %v", checks[0])
}
if checks[1].Name != "memory utilization" {

View File

@ -9,8 +9,8 @@ import (
)
const (
serfCheckID = "serfHealth"
serfCheckName = "Serf Health Status"
SerfCheckID = "serfHealth"
SerfCheckName = "Serf Health Status"
)
// monitorLeadership is used to monitor if we acquire or lose our role
@ -173,7 +173,7 @@ func (s *Server) handleAliveMember(member serf.Member) error {
// Check if the serfCheck is in the passing state
checks := state.NodeChecks(member.Name)
for _, check := range checks {
if check.CheckID == serfCheckID && check.Status == structs.HealthPassing {
if check.CheckID == SerfCheckID && check.Status == structs.HealthPassing {
return nil
}
}
@ -189,8 +189,8 @@ AFTER_CHECK:
Service: service,
Check: &structs.HealthCheck{
Node: member.Name,
CheckID: serfCheckID,
Name: serfCheckName,
CheckID: SerfCheckID,
Name: SerfCheckName,
Status: structs.HealthPassing,
},
}
@ -209,7 +209,7 @@ func (s *Server) handleFailedMember(member serf.Member) error {
// Check if the serfCheck is in the critical state
checks := state.NodeChecks(member.Name)
for _, check := range checks {
if check.CheckID == serfCheckID && check.Status == structs.HealthCritical {
if check.CheckID == SerfCheckID && check.Status == structs.HealthCritical {
return nil
}
}
@ -223,8 +223,8 @@ func (s *Server) handleFailedMember(member serf.Member) error {
Address: member.Addr.String(),
Check: &structs.HealthCheck{
Node: member.Name,
CheckID: serfCheckID,
Name: serfCheckName,
CheckID: SerfCheckID,
Name: SerfCheckName,
Status: structs.HealthCritical,
},
}

View File

@ -42,10 +42,10 @@ func TestLeader_RegisterMember(t *testing.T) {
if len(checks) != 1 {
t.Fatalf("client missing check")
}
if checks[0].CheckID != serfCheckID {
if checks[0].CheckID != SerfCheckID {
t.Fatalf("bad check: %v", checks[0])
}
if checks[0].Name != serfCheckName {
if checks[0].Name != SerfCheckName {
t.Fatalf("bad check: %v", checks[0])
}
if checks[0].Status != structs.HealthPassing {
@ -102,10 +102,10 @@ func TestLeader_FailedMember(t *testing.T) {
if len(checks) != 1 {
t.Fatalf("client missing check")
}
if checks[0].CheckID != serfCheckID {
if checks[0].CheckID != SerfCheckID {
t.Fatalf("bad check: %v", checks[0])
}
if checks[0].Name != serfCheckName {
if checks[0].Name != SerfCheckName {
t.Fatalf("bad check: %v", checks[0])
}
if checks[0].Status != structs.HealthCritical {

View File

@ -718,8 +718,8 @@ func TestCheckServiceNodes(t *testing.T) {
}
check = &structs.HealthCheck{
Node: "foo",
CheckID: serfCheckID,
Name: serfCheckName,
CheckID: SerfCheckID,
Name: SerfCheckName,
Status: structs.HealthPassing,
}
if err := store.EnsureCheck(check); err != nil {
@ -743,7 +743,7 @@ func TestCheckServiceNodes(t *testing.T) {
if nodes[0].Checks[0].CheckID != "db" {
t.Fatalf("Bad: %v", nodes[0])
}
if nodes[0].Checks[1].CheckID != serfCheckID {
if nodes[0].Checks[1].CheckID != SerfCheckID {
t.Fatalf("Bad: %v", nodes[0])
}
@ -764,7 +764,7 @@ func TestCheckServiceNodes(t *testing.T) {
if nodes[0].Checks[0].CheckID != "db" {
t.Fatalf("Bad: %v", nodes[0])
}
if nodes[0].Checks[1].CheckID != serfCheckID {
if nodes[0].Checks[1].CheckID != SerfCheckID {
t.Fatalf("Bad: %v", nodes[0])
}
}