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

This commit is contained in:
Preetha Appan 2017-07-28 10:40:43 -05:00
parent b19b062194
commit 840749db7e
3 changed files with 4 additions and 7 deletions

View File

@ -2164,7 +2164,7 @@ func (c *Config) ResolveTmplAddrs() (err error) {
return 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 { func (cfg *Config) SetupTaggedAndAdvertiseAddrs() error {
if cfg.AdvertiseAddr == "" { if cfg.AdvertiseAddr == "" {
switch { switch {

View File

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

View File

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