test: Add StrictReconfigCheck to cluster

This commit is contained in:
Marek Siarkowicz
2022-01-18 12:53:28 +01:00
parent 98242da5f1
commit 69fc517e56
2 changed files with 8 additions and 12 deletions

View File

@ -169,6 +169,7 @@ type ClusterConfig struct {
WatchProgressNotifyInterval time.Duration
ExperimentalMaxLearners int
StrictReconfigCheck bool
}
type Cluster struct {
@ -329,6 +330,7 @@ func (c *Cluster) mustNewMember(t testutil.TB) *Member {
LeaseCheckpointPersist: c.Cfg.LeaseCheckpointPersist,
WatchProgressNotifyInterval: c.Cfg.WatchProgressNotifyInterval,
ExperimentalMaxLearners: c.Cfg.ExperimentalMaxLearners,
StrictReconfigCheck: c.Cfg.StrictReconfigCheck,
})
m.DiscoveryURL = c.Cfg.DiscoveryURL
if c.Cfg.UseGRPC {
@ -641,6 +643,7 @@ type MemberConfig struct {
LeaseCheckpointPersist bool
WatchProgressNotifyInterval time.Duration
ExperimentalMaxLearners int
StrictReconfigCheck bool
}
// MustNewMember return an inited member with the given name. If peerTLS is
@ -752,6 +755,7 @@ func MustNewMember(t testutil.TB, mcfg MemberConfig) *Member {
m.V2Deprecation = config.V2_DEPR_DEFAULT
m.GrpcServerRecorder = &grpc_testing.GrpcRecorder{}
m.Logger = memberLogger(t, mcfg.Name)
m.StrictReconfigCheck = mcfg.StrictReconfigCheck
t.Cleanup(func() {
// if we didn't cleanup the logger, the consecutive test
// might reuse this (t).

View File

@ -373,10 +373,7 @@ func TestIssue3699(t *testing.T) {
// TestRejectUnhealthyAdd ensures an unhealthy cluster rejects adding members.
func TestRejectUnhealthyAdd(t *testing.T) {
integration.BeforeTest(t)
c := integration.NewClusterFromConfig(t, &integration.ClusterConfig{Size: 3, UseBridge: true})
for _, m := range c.Members {
m.ServerConfig.StrictReconfigCheck = true
}
c := integration.NewClusterFromConfig(t, &integration.ClusterConfig{Size: 3, UseBridge: true, StrictReconfigCheck: true})
c.Launch(t)
defer c.Terminate(t)
@ -417,10 +414,7 @@ func TestRejectUnhealthyAdd(t *testing.T) {
// if quorum will be lost.
func TestRejectUnhealthyRemove(t *testing.T) {
integration.BeforeTest(t)
c := integration.NewClusterFromConfig(t, &integration.ClusterConfig{Size: 5, UseBridge: true})
for _, m := range c.Members {
m.ServerConfig.StrictReconfigCheck = true
}
c := integration.NewClusterFromConfig(t, &integration.ClusterConfig{Size: 5, UseBridge: true, StrictReconfigCheck: true})
c.Launch(t)
defer c.Terminate(t)
@ -466,14 +460,12 @@ func TestRestartRemoved(t *testing.T) {
integration.BeforeTest(t)
// 1. start single-member Cluster
c := integration.NewClusterFromConfig(t, &integration.ClusterConfig{Size: 1, UseBridge: true})
for _, m := range c.Members {
m.ServerConfig.StrictReconfigCheck = true
}
c := integration.NewClusterFromConfig(t, &integration.ClusterConfig{Size: 1, UseBridge: true, StrictReconfigCheck: true})
c.Launch(t)
defer c.Terminate(t)
// 2. add a new member
c.Cfg.StrictReconfigCheck = false
c.AddMember(t)
c.WaitLeader(t)