consul: Handle API changes in StateStore

This commit is contained in:
Armon Dadgar 2014-03-05 15:03:12 -08:00
parent 04818636e7
commit 98fffdacb5
3 changed files with 8 additions and 7 deletions

View File

@ -290,7 +290,7 @@ func TestFSM_DeregisterNode(t *testing.T) {
// Verify service not registered
_, services := fsm.state.NodeServices("foo")
if len(services.Services) != 0 {
if services != nil {
t.Fatalf("Services: %v", services)
}

View File

@ -174,9 +174,11 @@ func (s *Server) handleAliveMember(member serf.Member) error {
if service != nil {
match := false
_, services := state.NodeServices(member.Name)
for id, _ := range services.Services {
if id == service.ID {
match = true
if services != nil {
for id, _ := range services.Services {
if id == service.ID {
match = true
}
}
}
if !match {

View File

@ -302,9 +302,8 @@ func TestDeleteNode(t *testing.T) {
if idx != 23 {
t.Fatalf("bad: %v", idx)
}
_, ok := services.Services["api"]
if ok {
t.Fatalf("has api: %#v", services)
if services != nil {
t.Fatalf("has services: %#v", services)
}
idx, checks := store.NodeChecks("foo")