@@ -457,10 +457,6 @@ func InitEtcdProcessCluster(t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdP
457
457
if cfg .Version == LastVersion && ! CouldSetSnapshotCatchupEntries (BinPath .EtcdLastRelease ) {
458
458
return nil , fmt .Errorf ("cannot set SnapshotCatchUpEntries for last etcd version: %s" , BinPath .EtcdLastRelease )
459
459
}
460
- if cfg .Version != CurrentVersion && UsesExperimentalSnapshotCatchupEntriesFlag (BinPath .EtcdLastRelease ) {
461
- cfg .ServerConfig .ExperimentalSnapshotCatchUpEntries = cfg .ServerConfig .SnapshotCatchUpEntries
462
- cfg .ServerConfig .SnapshotCatchUpEntries = etcdserver .DefaultSnapshotCatchUpEntries
463
- }
464
460
}
465
461
466
462
etcdCfgs := cfg .EtcdAllServerProcessConfigs (t )
@@ -639,26 +635,13 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
639
635
args = append (args , "--discovery=" + cfg .Discovery )
640
636
}
641
637
642
- var execPath string
643
- switch cfg .Version {
644
- case CurrentVersion :
645
- execPath = BinPath .Etcd
646
- case MinorityLastVersion :
647
- if i <= cfg .ClusterSize / 2 {
648
- execPath = BinPath .Etcd
649
- } else {
650
- execPath = BinPath .EtcdLastRelease
651
- }
652
- case QuorumLastVersion :
653
- if i <= cfg .ClusterSize / 2 {
654
- execPath = BinPath .EtcdLastRelease
655
- } else {
656
- execPath = BinPath .Etcd
638
+ execPath := cfg .binaryPath (i )
639
+
640
+ if cfg .ServerConfig .SnapshotCatchUpEntries != etcdserver .DefaultSnapshotCatchUpEntries {
641
+ if ! IsSnapshotCatchupEntriesFlagAvailable (execPath ) {
642
+ cfg .ServerConfig .ExperimentalSnapshotCatchUpEntries = cfg .ServerConfig .SnapshotCatchUpEntries
643
+ cfg .ServerConfig .SnapshotCatchUpEntries = etcdserver .DefaultSnapshotCatchUpEntries
657
644
}
658
- case LastVersion :
659
- execPath = BinPath .EtcdLastRelease
660
- default :
661
- panic (fmt .Sprintf ("Unknown cluster version %v" , cfg .Version ))
662
645
}
663
646
664
647
defaultValues := values (* embed .NewConfig ())
@@ -702,6 +685,32 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
702
685
}
703
686
}
704
687
688
+ func (cfg * EtcdProcessClusterConfig ) binaryPath (i int ) string {
689
+ var execPath string
690
+ switch cfg .Version {
691
+ case CurrentVersion :
692
+ execPath = BinPath .Etcd
693
+ case MinorityLastVersion :
694
+ if i <= cfg .ClusterSize / 2 {
695
+ execPath = BinPath .Etcd
696
+ } else {
697
+ execPath = BinPath .EtcdLastRelease
698
+ }
699
+ case QuorumLastVersion :
700
+ if i <= cfg .ClusterSize / 2 {
701
+ execPath = BinPath .EtcdLastRelease
702
+ } else {
703
+ execPath = BinPath .Etcd
704
+ }
705
+ case LastVersion :
706
+ execPath = BinPath .EtcdLastRelease
707
+ default :
708
+ panic (fmt .Sprintf ("Unknown cluster version %v" , cfg .Version ))
709
+ }
710
+
711
+ return execPath
712
+ }
713
+
705
714
func values (cfg embed.Config ) map [string ]string {
706
715
fs := flag .NewFlagSet ("etcd" , flag .ContinueOnError )
707
716
cfg .AddFlags (fs )
0 commit comments