Merge pull request #7650 from hashicorp/deflake-set-server-tests

tests: deflake some SetServer related tests
This commit is contained in:
Mahmood Ali 2020-04-08 14:28:30 -04:00 committed by GitHub
commit c3ac0ecf7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View file

@ -421,15 +421,20 @@ func (a *Agent) finalizeClientConfig(c *clientconfig.Config) error {
// configured explicitly. This handles both running server and client on one
// host and -dev mode.
if a.server != nil {
if a.config.AdvertiseAddrs == nil || a.config.AdvertiseAddrs.RPC == "" {
advertised := a.config.AdvertiseAddrs
normalized := a.config.normalizedAddrs
if advertised == nil || advertised.RPC == "" {
return fmt.Errorf("AdvertiseAddrs is nil or empty")
} else if a.config.normalizedAddrs == nil || a.config.normalizedAddrs.RPC == "" {
} else if normalized == nil || normalized.RPC == "" {
return fmt.Errorf("normalizedAddrs is nil or empty")
}
c.Servers = append(c.Servers,
a.config.normalizedAddrs.RPC,
a.config.AdvertiseAddrs.RPC)
if normalized.RPC == advertised.RPC {
c.Servers = append(c.Servers, normalized.RPC)
} else {
c.Servers = append(c.Servers, normalized.RPC, advertised.RPC)
}
}
// Setup the plugin loaders

View file

@ -711,7 +711,7 @@ func TestHTTP_AgentSetServers(t *testing.T) {
}
defer conn.Close()
// Write the Consul RPC byte to set the mode
// Write the Nomad RPC byte to set the mode
if _, err := conn.Write([]byte{byte(pool.RpcNomad)}); err != nil {
return false, err
}