Rename EnableTagOverride and update formatting

This commit is contained in:
Shawn Cook 2015-09-11 08:35:29 -07:00
parent d7ce0b3c6b
commit 66fd8fb2a0
4 changed files with 47 additions and 47 deletions

View File

@ -379,7 +379,7 @@ func (l *localState) setSyncState() error {
} }
// If our definition is different, we need to update it // If our definition is different, we need to update it
if existing.EnableTagDrift { if existing.EnableTagOverride {
existing.Tags = service.Tags existing.Tags = service.Tags
} }
equal := reflect.DeepEqual(existing, service) equal := reflect.DeepEqual(existing, service)

View File

@ -169,7 +169,7 @@ func TestAgentAntiEntropy_Services(t *testing.T) {
} }
} }
func TestAgentAntiEntropy_EnableTagDrift(t *testing.T) { func TestAgentAntiEntropy_EnableTagOverride(t *testing.T) {
conf := nextConfig() conf := nextConfig()
dir, agent := makeAgent(t, conf) dir, agent := makeAgent(t, conf)
defer os.RemoveAll(dir) defer os.RemoveAll(dir)
@ -184,13 +184,13 @@ func TestAgentAntiEntropy_EnableTagDrift(t *testing.T) {
} }
var out struct{} var out struct{}
// EnableTagDrift = true // EnableTagOverride = true
srv1 := &structs.NodeService{ srv1 := &structs.NodeService{
ID: "svc_id1", ID: "svc_id1",
Service: "svc1", Service: "svc1",
Tags: []string{"tag1"}, Tags: []string{"tag1"},
Port: 6100, Port: 6100,
EnableTagDrift: true, EnableTagOverride: true,
} }
agent.state.AddService(srv1, "") agent.state.AddService(srv1, "")
srv1_mod := new(structs.NodeService) srv1_mod := new(structs.NodeService)
@ -202,13 +202,13 @@ func TestAgentAntiEntropy_EnableTagDrift(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
// EnableTagDrift = false // EnableTagOverride = false
srv2 := &structs.NodeService{ srv2 := &structs.NodeService{
ID: "svc_id2", ID: "svc_id2",
Service: "svc2", Service: "svc2",
Tags: []string{"tag2"}, Tags: []string{"tag2"},
Port: 6200, Port: 6200,
EnableTagDrift: false, EnableTagOverride: false,
} }
agent.state.AddService(srv2, "") agent.state.AddService(srv2, "")
srv2_mod := new(structs.NodeService) srv2_mod := new(structs.NodeService)

View File

@ -14,7 +14,7 @@ type ServiceDefinition struct {
Check CheckType Check CheckType
Checks CheckTypes Checks CheckTypes
Token string Token string
EnableTagDrift bool EnableTagOverride bool
} }
func (s *ServiceDefinition) NodeService() *structs.NodeService { func (s *ServiceDefinition) NodeService() *structs.NodeService {
@ -24,7 +24,7 @@ func (s *ServiceDefinition) NodeService() *structs.NodeService {
Tags: s.Tags, Tags: s.Tags,
Address: s.Address, Address: s.Address,
Port: s.Port, Port: s.Port,
EnableTagDrift: s.EnableTagDrift, EnableTagOverride: s.EnableTagOverride,
} }
if ns.ID == "" && ns.Service != "" { if ns.ID == "" && ns.Service != "" {
ns.ID = ns.Service ns.ID = ns.Service

View File

@ -250,7 +250,7 @@ type NodeService struct {
Tags []string Tags []string
Address string Address string
Port int Port int
EnableTagDrift bool EnableTagOverride bool
} }
type NodeServices struct { type NodeServices struct {
Node Node Node Node