Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.5] add mix version test of adding last ver to current ver. #17888

Merged
merged 1 commit into from Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions tests/e2e/etcd_mix_versions_test.go
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
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