Skip to content

Commit

Permalink
Merge pull request etcd-io#17888 from siyuanfoundation/3.5-downgrade-…
Browse files Browse the repository at this point in the history
…test

[3.5] add mix version test of adding last ver to current ver.
  • Loading branch information
serathius authored Apr 30, 2024
2 parents a7a8fb8 + daec41c commit 31a87cf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
20 changes: 13 additions & 7 deletions tests/e2e/etcd_mix_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ func TestMixVersionsSnapshotByAddingMember(t *testing.T) {
t.Run(tc.name+"-adding-new-member-of-current-version", func(t *testing.T) {
mixVersionsSnapshotTestByAddingMember(t, tc.config, e2e.CurrentVersion)
})
// TODO: uncomment after v3.4.32 release.
// After v3.4.32, etcd can support adding a new member of 3.4 into
// a cluster with 3.5 if the 3.4 member is started with '--next-cluster-version-compatible'.

// t.Run(tc.name+"-adding-new-member-of-last-version", func(t *testing.T) {
// mixVersionsSnapshotTestByAddingMember(t, tc.config, e2e.LastVersion)
// })
if fileutil.Exist(e2e.BinPathLastRelease) {
t.Run(tc.name+"-adding-new-member-of-last-version", func(t *testing.T) {
mixVersionsSnapshotTestByAddingMember(t, tc.config, e2e.LastVersion)
})
}
}
}

Expand All @@ -84,6 +82,7 @@ func mixVersionsSnapshotTestByAddingMember(t *testing.T, cfg e2e.EtcdProcessClus
cfg.SnapshotCount = 10
cfg.SnapshotCatchUpEntries = 10
cfg.BasePeerScheme = "unix" // to avoid port conflict
cfg.NextClusterVersionCompatible = true

epc, err := e2e.NewEtcdProcessCluster(t, &cfg)

Expand All @@ -107,6 +106,12 @@ func mixVersionsSnapshotTestByAddingMember(t *testing.T, cfg e2e.EtcdProcessClus
defer epc.Close()

assertKVHash(t, epc)

leaderEPC := epc.Procs[epc.WaitLeader(t)]
if leaderEPC.Config().ExecPath == e2e.BinPath {
t.Log("Verify logs to check snapshot be sent from leader to follower")
e2e.AssertProcessLogs(t, leaderEPC, "sent database snapshot")
}
}

func TestMixVersionsSnapshotByMockingPartition(t *testing.T) {
Expand All @@ -129,6 +134,7 @@ func mixVersionsSnapshotTestByMockPartition(t *testing.T, cfg e2e.EtcdProcessClu
cfg.SnapshotCount = 10
cfg.SnapshotCatchUpEntries = 10
cfg.BasePeerScheme = "unix" // to avoid port conflict
cfg.NextClusterVersionCompatible = true

epc, err := e2e.NewEtcdProcessCluster(t, &cfg)
require.NoError(t, err, "failed to start etcd cluster: %v", err)
Expand Down
21 changes: 13 additions & 8 deletions tests/framework/e2e/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,15 @@ type EtcdProcessCluster struct {
}

type EtcdProcessClusterConfig struct {
DataDirPath string
KeepDataDir bool
Logger *zap.Logger
GoFailEnabled bool
GoFailClientTimeout time.Duration
PeerProxy bool
EnvVars map[string]string
Version ClusterVersion
DataDirPath string
KeepDataDir bool
Logger *zap.Logger
GoFailEnabled bool
GoFailClientTimeout time.Duration
PeerProxy bool
EnvVars map[string]string
Version ClusterVersion
NextClusterVersionCompatible bool

ClusterSize int

Expand Down Expand Up @@ -409,6 +410,10 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
args = append(args, "--experimental-snapshot-catchup-entries", fmt.Sprintf("%d", cfg.SnapshotCatchUpEntries))
}

if cfg.NextClusterVersionCompatible && execPath == BinPathLastRelease {
args = append(args, "--next-cluster-version-compatible")
}

return &EtcdServerProcessConfig{
lg: cfg.Logger,
ExecPath: execPath,
Expand Down

0 comments on commit 31a87cf

Please sign in to comment.