Browse Source

Fix comments, and remove redundant TestConfig init from a couple of unit tests

pull/3332/head
Preetha Appan 7 years ago
parent
commit
840749db7e
  1. 2
      agent/config.go
  2. 6
      agent/local_test.go
  3. 3
      command/agent.go

2
agent/config.go

@ -2164,7 +2164,7 @@ func (c *Config) ResolveTmplAddrs() (err error) {
return
}
// Additional post processing of the configs to set tagged and advertise addresses
// SetupTaggedAndAdvertiseAddrs configures advertise addresses and sets up a map of tagged addresses
func (cfg *Config) SetupTaggedAndAdvertiseAddrs() error {
if cfg.AdvertiseAddr == "" {
switch {

6
agent/local_test.go

@ -14,8 +14,7 @@ import (
func TestAgentAntiEntropy_Services(t *testing.T) {
t.Parallel()
cfg := TestConfig()
a := &TestAgent{Name: t.Name(), NoInitialSync: true, Config: cfg}
a := &TestAgent{Name: t.Name(), NoInitialSync: true}
a.Start()
defer a.Shutdown()
@ -672,8 +671,7 @@ func TestAgentAntiEntropy_Services_ACLDeny(t *testing.T) {
func TestAgentAntiEntropy_Checks(t *testing.T) {
t.Parallel()
cfg := TestConfig()
a := &TestAgent{Name: t.Name(), NoInitialSync: true, Config: cfg}
a := &TestAgent{Name: t.Name(), NoInitialSync: true}
a.Start()
defer a.Shutdown()

3
command/agent.go

@ -466,12 +466,11 @@ func (cmd *AgentCommand) readConfig() *agent.Config {
cmd.UI.Error(fmt.Sprintf("Failed to parse config: %v", err))
return nil
}
// More post processing of the config
if err := cfg.SetupTaggedAndAdvertiseAddrs(); err != nil {
cmd.UI.Error(fmt.Sprintf("Failed to set up tagged and advertise addresses: %v", err))
return nil
}
// Try to get an advertise address if not set
return cfg
}

Loading…
Cancel
Save