mirror of https://github.com/status-im/consul.git
Use freeport
To prevent other tests which already use freeport from flaking when port 0 steals their reserved port.
This commit is contained in:
parent
c6381b7e2b
commit
b2c5e2d059
|
@ -4714,6 +4714,10 @@ func TestSharedRPCRouter(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAgent_ListenHTTP_MultipleAddresses(t *testing.T) {
|
func TestAgent_ListenHTTP_MultipleAddresses(t *testing.T) {
|
||||||
|
ports, err := freeport.Take(2)
|
||||||
|
require.NoError(t, err)
|
||||||
|
t.Cleanup(func() { freeport.Return(ports) })
|
||||||
|
|
||||||
caConfig := tlsutil.Config{}
|
caConfig := tlsutil.Config{}
|
||||||
tlsConf, err := tlsutil.NewConfigurator(caConfig, hclog.New(nil))
|
tlsConf, err := tlsutil.NewConfigurator(caConfig, hclog.New(nil))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -4725,8 +4729,8 @@ func TestAgent_ListenHTTP_MultipleAddresses(t *testing.T) {
|
||||||
},
|
},
|
||||||
RuntimeConfig: &config.RuntimeConfig{
|
RuntimeConfig: &config.RuntimeConfig{
|
||||||
HTTPAddrs: []net.Addr{
|
HTTPAddrs: []net.Addr{
|
||||||
&net.TCPAddr{IP: net.ParseIP("127.0.0.1")},
|
&net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: ports[0]},
|
||||||
&net.TCPAddr{IP: net.ParseIP("127.0.0.1")},
|
&net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: ports[1]},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Cache: cache.New(cache.Options{}),
|
Cache: cache.New(cache.Options{}),
|
||||||
|
|
Loading…
Reference in New Issue