agent: remove special case of consul service, adjust tests

pull/400/head
Ryan Uber 2014-10-15 14:49:10 -07:00
parent e2246b9f6c
commit aa6ffc90f0
2 changed files with 4 additions and 8 deletions

View File

@ -314,11 +314,6 @@ func (l *localState) setSyncState() error {
// If we don't have the service locally, deregister it // If we don't have the service locally, deregister it
existing, ok := l.services[id] existing, ok := l.services[id]
if !ok { if !ok {
// The Consul service is created automatically, and
// does not need to be registered
if id == consul.ConsulServiceID && l.config.Server {
continue
}
l.serviceStatus[id] = syncStatus{remoteDelete: true} l.serviceStatus[id] = syncStatus{remoteDelete: true}
continue continue
} }
@ -339,6 +334,7 @@ func (l *localState) setSyncState() error {
if id == consul.SerfCheckID { if id == consul.SerfCheckID {
continue continue
} }
l.checkStatus[id] = syncStatus{remoteDelete: true} l.checkStatus[id] = syncStatus{remoteDelete: true}
continue continue
} }

View File

@ -42,7 +42,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
srv2 := &structs.NodeService{ srv2 := &structs.NodeService{
ID: "redis", ID: "redis",
Service: "redis", Service: "redis",
Tags: nil, Tags: []string{},
Port: 8000, Port: 8000,
} }
agent.state.AddService(srv2) agent.state.AddService(srv2)
@ -59,7 +59,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
srv3 := &structs.NodeService{ srv3 := &structs.NodeService{
ID: "web", ID: "web",
Service: "web", Service: "web",
Tags: nil, Tags: []string{},
Port: 80, Port: 80,
} }
agent.state.AddService(srv3) agent.state.AddService(srv3)
@ -68,7 +68,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
srv4 := &structs.NodeService{ srv4 := &structs.NodeService{
ID: "lb", ID: "lb",
Service: "lb", Service: "lb",
Tags: nil, Tags: []string{},
Port: 443, Port: 443,
} }
args.Service = srv4 args.Service = srv4