backport of commit d50bd4eb05 (#22486)

Co-authored-by: Josh Black <raskchanky@gmail.com>
This commit is contained in:
hc-github-team-secure-vault-core
2023-08-21 18:24:30 -04:00
committed by GitHub
parent 69d9a5a249
commit e06e301ea0
3 changed files with 37 additions and 18 deletions

View File

@@ -42,5 +42,5 @@ const (
PerformanceReplicationPathTarget = "performance" PerformanceReplicationPathTarget = "performance"
DRReplicationPathParget = "dr" DRReplicationPathTarget = "dr"
) )

View File

@@ -1265,21 +1265,8 @@ func NewTestCluster(t testing.T, base *CoreConfig, opts *TestClusterOptions) *Te
net.IPv6loopback, net.IPv6loopback,
net.ParseIP("127.0.0.1"), net.ParseIP("127.0.0.1"),
} }
var baseAddr *net.TCPAddr
if opts != nil && opts.BaseListenAddress != "" {
baseAddr, err = net.ResolveTCPAddr("tcp", opts.BaseListenAddress)
if err != nil {
t.Fatal("could not parse given base IP")
}
certIPs = append(certIPs, baseAddr.IP)
} else {
baseAddr = &net.TCPAddr{
IP: net.ParseIP("127.0.0.1"),
Port: 0,
}
}
baseAddr, certIPs := GenerateListenerAddr(t, opts, certIPs)
var testCluster TestCluster var testCluster TestCluster
testCluster.base = base testCluster.base = base
@@ -1796,7 +1783,28 @@ func (cluster *TestCluster) StopCore(t testing.T, idx int) {
cluster.cleanupFuncs[idx]() cluster.cleanupFuncs[idx]()
} }
// Restart a TestClusterCore that was stopped, by replacing the func GenerateListenerAddr(t testing.T, opts *TestClusterOptions, certIPs []net.IP) (*net.TCPAddr, []net.IP) {
var baseAddr *net.TCPAddr
var err error
if opts != nil && opts.BaseListenAddress != "" {
baseAddr, err = net.ResolveTCPAddr("tcp", opts.BaseListenAddress)
if err != nil {
t.Fatal("could not parse given base IP")
}
certIPs = append(certIPs, baseAddr.IP)
} else {
baseAddr = &net.TCPAddr{
IP: net.ParseIP("127.0.0.1"),
Port: 0,
}
}
return baseAddr, certIPs
}
// StartCore restarts a TestClusterCore that was stopped, by replacing the
// underlying Core. // underlying Core.
func (cluster *TestCluster) StartCore(t testing.T, idx int, opts *TestClusterOptions) { func (cluster *TestCluster) StartCore(t testing.T, idx int, opts *TestClusterOptions) {
t.Helper() t.Helper()
@@ -2022,6 +2030,10 @@ func (testCluster *TestCluster) setupClusterListener(
core.SetClusterHandler(handler) core.SetClusterHandler(handler)
} }
func (tc *TestCluster) InitCores(t testing.T, opts *TestClusterOptions, addAuditBackend bool) {
tc.initCores(t, opts, addAuditBackend)
}
func (tc *TestCluster) initCores(t testing.T, opts *TestClusterOptions, addAuditBackend bool) { func (tc *TestCluster) initCores(t testing.T, opts *TestClusterOptions, addAuditBackend bool) {
leader := tc.Cores[0] leader := tc.Cores[0]

View File

@@ -471,6 +471,13 @@ docs](#generate-disaster-recovery-operation-token) for more information.
PEM-format files that the secondary can use when unwrapping the token from the PEM-format files that the secondary can use when unwrapping the token from the
primary. If this and ca_file are not given, defaults to system CA roots. primary. If this and ca_file are not given, defaults to system CA roots.
- `update_primary_addrs` `array: []`  List of cluster addresses for potential
primary clusters. These addresses will be pinged in sequence, and if any of them
respond successfully, these will be recorded as the new primary addresses. This is
a lighter weight version of specifying a token and should result in less disruption
of replication. Note that it's invalid to specify this and `token` in the same API call.
They are mutually exclusive.
### Sample payload ### Sample payload
```json ```json
@@ -698,7 +705,7 @@ depending on the number and size of objects in the data store.
asynchronously flushed the reindex may not have applied fully and a new reindex asynchronously flushed the reindex may not have applied fully and a new reindex
may need to be done. Defaults false. may need to be done. Defaults false.
- `dr_operation_token` `(string: <required>)` - DR operation token used to authorize - `dr_operation_token` `(string: <required>)` - DR operation token used to authorize
this request. this request.
### Sample payload ### Sample payload
@@ -724,4 +731,4 @@ $ curl \
{ {
"warnings": ["..."] "warnings": ["..."]
} }
``` ```