Skip to content

Commit

Permalink
Explicitly set pre-vote flag for release 3.4 in robustness test
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Zhang <joshuazh@microsoft.com>
  • Loading branch information
joshuazh-x committed Feb 21, 2024
1 parent 11ff264 commit 95f3464
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/framework/e2e/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ type EtcdProcessClusterConfig struct {
IsPeerAutoTLS bool
CN bool

// Flags to explicitly set even if their values are same as default ones
ExplicitFlags map[string]struct{}

// Removed in v3.6

Discovery string // v2 discovery
Expand Down Expand Up @@ -371,6 +374,19 @@ func WithPeerProxy(enabled bool) EPClusterOption {
return func(c *EtcdProcessClusterConfig) { c.PeerProxy = enabled }
}

func WithPreVote(enabled bool) EPClusterOption {
return func(c *EtcdProcessClusterConfig) { c.ServerConfig.PreVote = enabled }
}

func WithExplicitFlag(flag string) EPClusterOption {
return func(c *EtcdProcessClusterConfig) {
if c.ExplicitFlags == nil {
c.ExplicitFlags = map[string]struct{}{}
}
c.ExplicitFlags[flag] = struct{}{}
}
}

// NewEtcdProcessCluster launches a new cluster from etcd processes, returning
// a new EtcdProcessCluster once all nodes are ready to accept client requests.
func NewEtcdProcessCluster(ctx context.Context, t testing.TB, opts ...EPClusterOption) (*EtcdProcessCluster, error) {
Expand Down Expand Up @@ -574,7 +590,9 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
overrideValues := values(cfg.ServerConfig)
for flag, value := range overrideValues {
if defaultValue := defaultValues[flag]; value == "" || value == defaultValue {
continue
if _, exist := cfg.ExplicitFlags[flag]; !exist {
continue
}
}
if flag == "experimental-snapshot-catchup-entries" && !(cfg.Version == CurrentVersion || (cfg.Version == MinorityLastVersion && i <= cfg.ClusterSize/2) || (cfg.Version == QuorumLastVersion && i > cfg.ClusterSize/2)) {
continue
Expand Down
5 changes: 5 additions & 0 deletions tests/robustness/scenarios.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func exploratoryScenarios(t *testing.T) []testScenario {
e2e.WithCompactionBatchLimit(100),
e2e.WithWatchProcessNotifyInterval(100 * time.Millisecond),
}
if v.LessThan(version.V3_5) {
// The default pre-vote configuration prior to version 3.5 is set to false.
// We need to explicitly enable prevote to improve availability in robustness test.
baseOptions = append(baseOptions, e2e.WithPreVote(true), e2e.WithExplicitFlag("pre-vote"))
}
scenarios := []testScenario{}
for _, tp := range trafficProfiles {
name := filepath.Join(tp.Traffic.Name(), tp.Profile.Name, "ClusterOfSize1")
Expand Down

0 comments on commit 95f3464

Please sign in to comment.