Skip to content

Commit 4bfc442

Browse files
committed
Minor refacotr on the e2e test framework
Signed-off-by: Benjamin Wang <[email protected]>
1 parent f197f44 commit 4bfc442

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

tests/framework/e2e/cluster.go

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -633,26 +633,13 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
633633
args = append(args, "--discovery="+cfg.Discovery)
634634
}
635635

636-
var execPath string
637-
switch cfg.Version {
638-
case CurrentVersion:
639-
execPath = BinPath.Etcd
640-
case MinorityLastVersion:
641-
if i <= cfg.ClusterSize/2 {
642-
execPath = BinPath.Etcd
643-
} else {
644-
execPath = BinPath.EtcdLastRelease
645-
}
646-
case QuorumLastVersion:
647-
if i <= cfg.ClusterSize/2 {
648-
execPath = BinPath.EtcdLastRelease
649-
} else {
650-
execPath = BinPath.Etcd
651-
}
652-
case LastVersion:
653-
execPath = BinPath.EtcdLastRelease
654-
default:
655-
panic(fmt.Sprintf("Unknown cluster version %v", cfg.Version))
636+
execPath := cfg.binaryPath(i)
637+
638+
if cfg.ServerConfig.SnapshotCatchUpEntries != etcdserver.DefaultSnapshotCatchUpEntries {
639+
/*if !IsSnapshotCatchupEntriesFlagAvailable(execPath) {
640+
cfg.ServerConfig.ExperimentalSnapshotCatchUpEntries = cfg.ServerConfig.SnapshotCatchUpEntries
641+
cfg.ServerConfig.SnapshotCatchUpEntries = etcdserver.DefaultSnapshotCatchUpEntries
642+
} */
656643
}
657644

658645
defaultValues := values(*embed.NewConfig())
@@ -696,6 +683,32 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
696683
}
697684
}
698685

686+
func (cfg *EtcdProcessClusterConfig) binaryPath(i int) string {
687+
var execPath string
688+
switch cfg.Version {
689+
case CurrentVersion:
690+
execPath = BinPath.Etcd
691+
case MinorityLastVersion:
692+
if i <= cfg.ClusterSize/2 {
693+
execPath = BinPath.Etcd
694+
} else {
695+
execPath = BinPath.EtcdLastRelease
696+
}
697+
case QuorumLastVersion:
698+
if i <= cfg.ClusterSize/2 {
699+
execPath = BinPath.EtcdLastRelease
700+
} else {
701+
execPath = BinPath.Etcd
702+
}
703+
case LastVersion:
704+
execPath = BinPath.EtcdLastRelease
705+
default:
706+
panic(fmt.Sprintf("Unknown cluster version %v", cfg.Version))
707+
}
708+
709+
return execPath
710+
}
711+
699712
func values(cfg embed.Config) map[string]string {
700713
fs := flag.NewFlagSet("etcd", flag.ContinueOnError)
701714
cfg.AddFlags(fs)

0 commit comments

Comments
 (0)