Modifying base can break tests that share the same coreConfig passed to NewTestCluster. (#9451)

This commit is contained in:
ncabatoff 2020-07-10 13:11:18 -04:00 committed by GitHub
parent 8b396133db
commit c822a4bffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -1485,10 +1485,6 @@ func NewTestCluster(t testing.T, base *CoreConfig, opts *TestClusterOptions) *Te
}
}
if base != nil {
base.Physical = coreConfig.Physical
}
// Clustering setup
for i := 0; i < numCores; i++ {
testCluster.setupClusterListener(t, i, cores[i], coreConfigs[i], opts, listeners[i], handlers[i])
@ -1522,7 +1518,7 @@ func NewTestCluster(t testing.T, base *CoreConfig, opts *TestClusterOptions) *Te
(*tcc.ReloadFuncs)["listener|tcp"] = []reloadutil.ReloadFunc{certGetters[i].Reload}
tcc.ReloadFuncsLock.Unlock()
testAdjustUnderlyingStorage(base, tcc)
testAdjustUnderlyingStorage(tcc)
ret = append(ret, tcc)
}
@ -1635,7 +1631,7 @@ func (cluster *TestCluster) StartCore(t testing.T, idx int, opts *TestClusterOpt
tcc.Client = cluster.getAPIClient(t, opts, tcc.Listeners[0].Address.Port, tcc.TLSConfig)
testAdjustUnderlyingStorage(cluster.base, tcc)
testAdjustUnderlyingStorage(tcc)
testExtraTestCoreSetup(t, cluster.priKey, tcc)
// Start listeners

View File

@ -9,6 +9,6 @@ import (
func testGenerateCoreKeys() (interface{}, interface{}, error) { return nil, nil, nil }
func testGetLicensingConfig(interface{}) *LicensingConfig { return &LicensingConfig{} }
func testExtraTestCoreSetup(testing.T, interface{}, *TestClusterCore) {}
func testAdjustUnderlyingStorage(_ *CoreConfig, tcc *TestClusterCore) {
func testAdjustUnderlyingStorage(tcc *TestClusterCore) {
tcc.UnderlyingStorage = tcc.physical
}