Fix cluster testing on OSX; see the inline comment for details
This commit is contained in:
parent
86edada67c
commit
e381c189e4
|
@ -584,6 +584,11 @@ func TestCluster(t *testing.T, handlers []http.Handler, base *CoreConfig, unseal
|
|||
}
|
||||
|
||||
// Create three cores with the same physical and different redirect/cluster addrs
|
||||
// N.B.: On OSX, instead of random ports, it assigns new ports to new
|
||||
// listeners sequentially. Aside from being a bad idea in a security sense,
|
||||
// it also broke tests that assumed it was OK to just use the port above
|
||||
// the redirect addr. This has now been changed to 10 ports above, but if
|
||||
// we ever do more than three nodes in a cluster it may need to be bumped.
|
||||
coreConfig := &CoreConfig{
|
||||
Physical: physical.NewInmem(logger),
|
||||
HAPhysical: physical.NewInmemHA(logger),
|
||||
|
@ -591,7 +596,7 @@ func TestCluster(t *testing.T, handlers []http.Handler, base *CoreConfig, unseal
|
|||
CredentialBackends: make(map[string]logical.Factory),
|
||||
AuditBackends: make(map[string]audit.Factory),
|
||||
RedirectAddr: fmt.Sprintf("https://127.0.0.1:%d", c1lns[0].Address.Port),
|
||||
ClusterAddr: fmt.Sprintf("https://127.0.0.1:%d", c1lns[0].Address.Port+1),
|
||||
ClusterAddr: fmt.Sprintf("https://127.0.0.1:%d", c1lns[0].Address.Port+10),
|
||||
DisableMlock: true,
|
||||
}
|
||||
|
||||
|
@ -629,7 +634,7 @@ func TestCluster(t *testing.T, handlers []http.Handler, base *CoreConfig, unseal
|
|||
|
||||
coreConfig.RedirectAddr = fmt.Sprintf("https://127.0.0.1:%d", c2lns[0].Address.Port)
|
||||
if coreConfig.ClusterAddr != "" {
|
||||
coreConfig.ClusterAddr = fmt.Sprintf("https://127.0.0.1:%d", c2lns[0].Address.Port+1)
|
||||
coreConfig.ClusterAddr = fmt.Sprintf("https://127.0.0.1:%d", c2lns[0].Address.Port+10)
|
||||
}
|
||||
c2, err := NewCore(coreConfig)
|
||||
if err != nil {
|
||||
|
@ -638,7 +643,7 @@ func TestCluster(t *testing.T, handlers []http.Handler, base *CoreConfig, unseal
|
|||
|
||||
coreConfig.RedirectAddr = fmt.Sprintf("https://127.0.0.1:%d", c3lns[0].Address.Port)
|
||||
if coreConfig.ClusterAddr != "" {
|
||||
coreConfig.ClusterAddr = fmt.Sprintf("https://127.0.0.1:%d", c3lns[0].Address.Port+1)
|
||||
coreConfig.ClusterAddr = fmt.Sprintf("https://127.0.0.1:%d", c3lns[0].Address.Port+10)
|
||||
}
|
||||
c3, err := NewCore(coreConfig)
|
||||
if err != nil {
|
||||
|
@ -653,7 +658,7 @@ func TestCluster(t *testing.T, handlers []http.Handler, base *CoreConfig, unseal
|
|||
for i, ln := range lns {
|
||||
ret[i] = &net.TCPAddr{
|
||||
IP: ln.Address.IP,
|
||||
Port: ln.Address.Port + 1,
|
||||
Port: ln.Address.Port + 10,
|
||||
}
|
||||
}
|
||||
return ret
|
||||
|
|
Loading…
Reference in a new issue