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 f27202b608
commit 7b99f7ca08
3 changed files with 4 additions and 7 deletions

View File

@ -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 {

View File

@ -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()

View File

@ -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
}