From 71b40b3abf53125f2d0431162b36d7087c825cac Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Sun, 23 Oct 2022 09:08:30 +0200 Subject: [PATCH 1/4] tests: Extend common test to run previous release Signed-off-by: Marek Siarkowicz --- tests/common/e2e_test.go | 47 ++++++++++++++++++++++ tests/common/integration_test.go | 26 ++++++++++++ tests/common/kv_test.go | 6 +-- tests/common/lease_test.go | 10 ++--- tests/common/main_test.go | 28 ++----------- tests/common/member_test.go | 6 +-- tests/common/role_test.go | 2 +- tests/common/status_test.go | 2 +- tests/common/txn_test.go | 4 +- tests/common/user_test.go | 10 ++--- tests/common/wait_leader_test.go | 2 +- tests/common/watch_test.go | 2 +- tests/e2e/cluster_downgrade_test.go | 5 +-- tests/e2e/ctl_v3_test.go | 6 --- tests/e2e/discovery_test.go | 8 ++-- tests/e2e/etcd_release_upgrade_test.go | 15 ++++--- tests/e2e/utl_migrate_test.go | 17 ++++---- tests/e2e/v2store_deprecation_test.go | 37 +++++++---------- tests/framework/config/cluster.go | 16 +++++++- tests/framework/e2e/cluster.go | 29 ++++++++++--- tests/framework/e2e/e2e.go | 3 ++ tests/framework/integration/integration.go | 3 ++ 22 files changed, 180 insertions(+), 104 deletions(-) diff --git a/tests/common/e2e_test.go b/tests/common/e2e_test.go index 1284714b1..2f68c66af 100644 --- a/tests/common/e2e_test.go +++ b/tests/common/e2e_test.go @@ -18,6 +18,7 @@ package common import ( + "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/tests/v3/framework" "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" @@ -25,6 +26,52 @@ import ( func init() { testRunner = framework.E2eTestRunner + clusterTestCases = e2eClusterTestCases +} + +func e2eClusterTestCases() []testCase { + tcs := []testCase{ + { + name: "NoTLS", + config: config.ClusterConfig{ClusterSize: 1}, + }, + { + name: "PeerTLS", + config: config.ClusterConfig{ClusterSize: 3, PeerTLS: config.ManualTLS}, + }, + { + name: "PeerAutoTLS", + config: config.ClusterConfig{ClusterSize: 3, PeerTLS: config.AutoTLS}, + }, + { + name: "ClientTLS", + config: config.ClusterConfig{ClusterSize: 1, ClientTLS: config.ManualTLS}, + }, + { + name: "ClientAutoTLS", + config: config.ClusterConfig{ClusterSize: 1, ClientTLS: config.AutoTLS}, + }, + } + if fileutil.Exist(e2e.BinPath.EtcdLastRelease) { + tcs = append(tcs, testCase{ + name: "MinorityLastVersion", + config: config.ClusterConfig{ + ClusterSize: 3, + E2eConfig: &config.E2eClusterConfig{ + Version: config.MinorityLastVersion, + }, + }, + }, testCase{ + name: "QuorumLastVersion", + config: config.ClusterConfig{ + ClusterSize: 3, + E2eConfig: &config.E2eClusterConfig{ + Version: config.QuorumLastVersion, + }, + }, + }) + } + return tcs } func WithAuth(userName, password string) config.ClientOption { diff --git a/tests/common/integration_test.go b/tests/common/integration_test.go index d875dbc82..c69ade5f6 100644 --- a/tests/common/integration_test.go +++ b/tests/common/integration_test.go @@ -25,6 +25,32 @@ import ( func init() { testRunner = framework.IntegrationTestRunner + clusterTestCases = integrationClusterTestCases +} + +func integrationClusterTestCases() []testCase { + return []testCase{ + { + name: "NoTLS", + config: config.ClusterConfig{ClusterSize: 1}, + }, + { + name: "PeerTLS", + config: config.ClusterConfig{ClusterSize: 3, PeerTLS: config.ManualTLS}, + }, + { + name: "PeerAutoTLS", + config: config.ClusterConfig{ClusterSize: 3, PeerTLS: config.AutoTLS}, + }, + { + name: "ClientTLS", + config: config.ClusterConfig{ClusterSize: 1, ClientTLS: config.ManualTLS}, + }, + { + name: "ClientAutoTLS", + config: config.ClusterConfig{ClusterSize: 1, ClientTLS: config.AutoTLS}, + }, + } } func WithAuth(userName, password string) config.ClientOption { diff --git a/tests/common/kv_test.go b/tests/common/kv_test.go index 2acf29291..f894131ce 100644 --- a/tests/common/kv_test.go +++ b/tests/common/kv_test.go @@ -27,7 +27,7 @@ import ( func TestKVPut(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -61,7 +61,7 @@ func TestKVPut(t *testing.T) { func TestKVGet(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -121,7 +121,7 @@ func TestKVGet(t *testing.T) { func TestKVDelete(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) defer cancel() diff --git a/tests/common/lease_test.go b/tests/common/lease_test.go index 972f52c9b..61157f0d7 100644 --- a/tests/common/lease_test.go +++ b/tests/common/lease_test.go @@ -28,7 +28,7 @@ import ( func TestLeaseGrantTimeToLive(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -52,7 +52,7 @@ func TestLeaseGrantTimeToLive(t *testing.T) { func TestLeaseGrantAndList(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { nestedCases := []struct { name string leaseCount int @@ -119,7 +119,7 @@ func TestLeaseGrantAndList(t *testing.T) { func TestLeaseGrantTimeToLiveExpired(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -156,7 +156,7 @@ func TestLeaseGrantTimeToLiveExpired(t *testing.T) { func TestLeaseGrantKeepAliveOnce(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -185,7 +185,7 @@ func TestLeaseGrantKeepAliveOnce(t *testing.T) { func TestLeaseGrantRevoke(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() diff --git a/tests/common/main_test.go b/tests/common/main_test.go index 14f5641fe..1bce798a4 100644 --- a/tests/common/main_test.go +++ b/tests/common/main_test.go @@ -15,36 +15,14 @@ package common import ( + "go.etcd.io/etcd/tests/v3/framework" "testing" "go.etcd.io/etcd/tests/v3/framework/config" - intf "go.etcd.io/etcd/tests/v3/framework/interfaces" ) -var testRunner intf.TestRunner - -var clusterTestCases = []testCase{ - { - name: "NoTLS", - config: config.NewClusterConfig(config.WithClusterSize(1)), - }, - { - name: "PeerTLS", - config: config.NewClusterConfig(config.WithPeerTLS(config.ManualTLS)), - }, - { - name: "PeerAutoTLS", - config: config.NewClusterConfig(config.WithPeerTLS(config.AutoTLS)), - }, - { - name: "ClientTLS", - config: config.NewClusterConfig(config.WithClusterSize(1), config.WithClientTLS(config.ManualTLS)), - }, - { - name: "ClientAutoTLS", - config: config.NewClusterConfig(config.WithClusterSize(1), config.WithClientTLS(config.AutoTLS)), - }, -} +var testRunner = framework.UnitTestRunner +var clusterTestCases = func() []testCase { return nil } func TestMain(m *testing.M) { testRunner.TestMain(m) diff --git a/tests/common/member_test.go b/tests/common/member_test.go index 281e846ed..b7953226a 100644 --- a/tests/common/member_test.go +++ b/tests/common/member_test.go @@ -30,7 +30,7 @@ import ( func TestMemberList(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -102,7 +102,7 @@ func TestMemberAdd(t *testing.T) { for _, learnerTc := range learnerTcs { for _, quorumTc := range quorumTcs { - for _, clusterTc := range clusterTestCases { + for _, clusterTc := range clusterTestCases() { t.Run(learnerTc.name+"/"+quorumTc.name+"/"+clusterTc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -178,7 +178,7 @@ func TestMemberRemove(t *testing.T) { } for _, quorumTc := range tcs { - for _, clusterTc := range clusterTestCases { + for _, clusterTc := range clusterTestCases() { if !quorumTc.strictReconfigCheck && clusterTc.config.ClusterSize == 1 { // skip these test cases // when strictReconfigCheck is disabled, calling MemberRemove will cause the single node to panic diff --git a/tests/common/role_test.go b/tests/common/role_test.go index 62177e7cf..84e35d183 100644 --- a/tests/common/role_test.go +++ b/tests/common/role_test.go @@ -28,7 +28,7 @@ import ( func TestRoleAdd_Simple(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() diff --git a/tests/common/status_test.go b/tests/common/status_test.go index 5ce0751fb..a6a984439 100644 --- a/tests/common/status_test.go +++ b/tests/common/status_test.go @@ -27,7 +27,7 @@ func TestStatus(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() diff --git a/tests/common/txn_test.go b/tests/common/txn_test.go index 413e6086b..8e3942925 100644 --- a/tests/common/txn_test.go +++ b/tests/common/txn_test.go @@ -54,7 +54,7 @@ func TestTxnSucc(t *testing.T) { results: []string{"SUCCESS", `key "with" space`, "value \x23"}, }, } - for _, cfg := range clusterTestCases { + for _, cfg := range clusterTestCases() { t.Run(cfg.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -98,7 +98,7 @@ func TestTxnFail(t *testing.T) { results: []string{"FAILURE", "OK"}, }, } - for _, cfg := range clusterTestCases { + for _, cfg := range clusterTestCases() { t.Run(cfg.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() diff --git a/tests/common/user_test.go b/tests/common/user_test.go index bcc0d1e56..d921f8dd6 100644 --- a/tests/common/user_test.go +++ b/tests/common/user_test.go @@ -61,7 +61,7 @@ func TestUserAdd_Simple(t *testing.T) { password: "bar", }, } - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { for _, nc := range tcs { t.Run(tc.name+"/"+nc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) @@ -96,7 +96,7 @@ func TestUserAdd_Simple(t *testing.T) { func TestUserAdd_DuplicateUserNotAllowed(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -125,7 +125,7 @@ func TestUserAdd_DuplicateUserNotAllowed(t *testing.T) { func TestUserList(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -166,7 +166,7 @@ func TestUserList(t *testing.T) { func TestUserDelete(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -218,7 +218,7 @@ func TestUserDelete(t *testing.T) { func TestUserChangePassword(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() diff --git a/tests/common/wait_leader_test.go b/tests/common/wait_leader_test.go index aa3958df4..faa1f716c 100644 --- a/tests/common/wait_leader_test.go +++ b/tests/common/wait_leader_test.go @@ -25,7 +25,7 @@ import ( func TestWaitLeader(t *testing.T) { testRunner.BeforeTest(t) - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() diff --git a/tests/common/watch_test.go b/tests/common/watch_test.go index 0893f4561..43b6dbcc3 100644 --- a/tests/common/watch_test.go +++ b/tests/common/watch_test.go @@ -13,7 +13,7 @@ import ( func TestWatch(t *testing.T) { testRunner.BeforeTest(t) watchTimeout := 1 * time.Second - for _, tc := range clusterTestCases { + for _, tc := range clusterTestCases() { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) defer cancel() diff --git a/tests/e2e/cluster_downgrade_test.go b/tests/e2e/cluster_downgrade_test.go index 579c73cc9..3b84fb825 100644 --- a/tests/e2e/cluster_downgrade_test.go +++ b/tests/e2e/cluster_downgrade_test.go @@ -57,7 +57,7 @@ func testDowngradeUpgrade(t *testing.T, clusterSize int) { e2e.BeforeTest(t) t.Logf("Create cluster with version %s", currentVersionStr) - epc := newCluster(t, currentEtcdBinary, clusterSize) + epc := newCluster(t, clusterSize) for i := 0; i < len(epc.Procs); i++ { validateVersion(t, epc.Cfg, epc.Procs[i], version.Versions{ Cluster: currentVersionStr, @@ -119,9 +119,8 @@ func testDowngradeUpgrade(t *testing.T, clusterSize int) { t.Log("Upgrade complete") } -func newCluster(t *testing.T, execPath string, clusterSize int) *e2e.EtcdProcessCluster { +func newCluster(t *testing.T, clusterSize int) *e2e.EtcdProcessCluster { epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{ - ExecPath: execPath, ClusterSize: clusterSize, InitialToken: "new", KeepDataDir: true, diff --git a/tests/e2e/ctl_v3_test.go b/tests/e2e/ctl_v3_test.go index 9f898245a..978ea741c 100644 --- a/tests/e2e/ctl_v3_test.go +++ b/tests/e2e/ctl_v3_test.go @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/assert" "go.etcd.io/etcd/api/v3/version" - "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/client/pkg/v3/testutil" "go.etcd.io/etcd/pkg/v3/flags" "go.etcd.io/etcd/tests/v3/framework/e2e" @@ -51,13 +50,8 @@ func TestClusterVersion(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - binary := e2e.BinPath.Etcd - if !fileutil.Exist(binary) { - t.Skipf("%q does not exist", binary) - } e2e.BeforeTest(t) cfg := e2e.NewConfigNoTLS() - cfg.ExecPath = binary cfg.SnapshotCount = 3 cfg.BaseScheme = "unix" // to avoid port conflict cfg.RollingStart = tt.rollingStart diff --git a/tests/e2e/discovery_test.go b/tests/e2e/discovery_test.go index 8bfa199e6..3fc2d2d97 100644 --- a/tests/e2e/discovery_test.go +++ b/tests/e2e/discovery_test.go @@ -27,6 +27,7 @@ import ( "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/v2" "go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" + "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" "go.etcd.io/etcd/tests/v3/framework/integration" ) @@ -38,14 +39,13 @@ func TestTLSClusterOf3UsingDiscovery(t *testing.T) { testClusterUsingDiscovery(t func testClusterUsingDiscovery(t *testing.T, size int, peerTLS bool) { e2e.BeforeTest(t) - lastReleaseBinary := e2e.BinPath.EtcdLastRelease - if !fileutil.Exist(lastReleaseBinary) { - t.Skipf("%q does not exist", lastReleaseBinary) + if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { + t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease) } dc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{ BasePort: 2000, - ExecPath: lastReleaseBinary, + Version: config.LastVersion, ClusterSize: 1, EnableV2: true, }) diff --git a/tests/e2e/etcd_release_upgrade_test.go b/tests/e2e/etcd_release_upgrade_test.go index 1f65afd56..34a911704 100644 --- a/tests/e2e/etcd_release_upgrade_test.go +++ b/tests/e2e/etcd_release_upgrade_test.go @@ -23,21 +23,21 @@ import ( "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/fileutil" + "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" ) // TestReleaseUpgrade ensures that changes to master branch does not affect // upgrade from latest etcd releases. func TestReleaseUpgrade(t *testing.T) { - lastReleaseBinary := e2e.BinPath.EtcdLastRelease - if !fileutil.Exist(lastReleaseBinary) { - t.Skipf("%q does not exist", lastReleaseBinary) + if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { + t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease) } e2e.BeforeTest(t) copiedCfg := e2e.NewConfigNoTLS() - copiedCfg.ExecPath = lastReleaseBinary + copiedCfg.Version = config.LastVersion copiedCfg.SnapshotCount = 3 copiedCfg.BaseScheme = "unix" // to avoid port conflict @@ -113,15 +113,14 @@ func TestReleaseUpgrade(t *testing.T) { } func TestReleaseUpgradeWithRestart(t *testing.T) { - lastReleaseBinary := e2e.BinPath.EtcdLastRelease - if !fileutil.Exist(lastReleaseBinary) { - t.Skipf("%q does not exist", lastReleaseBinary) + if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { + t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease) } e2e.BeforeTest(t) copiedCfg := e2e.NewConfigNoTLS() - copiedCfg.ExecPath = lastReleaseBinary + copiedCfg.Version = config.LastVersion copiedCfg.SnapshotCount = 10 copiedCfg.BaseScheme = "unix" diff --git a/tests/e2e/utl_migrate_test.go b/tests/e2e/utl_migrate_test.go index a6236991c..b2903bfcf 100644 --- a/tests/e2e/utl_migrate_test.go +++ b/tests/e2e/utl_migrate_test.go @@ -27,6 +27,7 @@ import ( "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/server/v3/storage/backend" "go.etcd.io/etcd/server/v3/storage/schema" + "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" "go.uber.org/zap/zaptest" ) @@ -35,10 +36,10 @@ func TestEtctlutlMigrate(t *testing.T) { lastReleaseBinary := e2e.BinPath.EtcdLastRelease tcs := []struct { - name string - targetVersion string - binary string - force bool + name string + targetVersion string + clusterVersion config.ClusterVersion + force bool expectLogsSubString string expectStorageVersion *semver.Version @@ -69,13 +70,13 @@ func TestEtctlutlMigrate(t *testing.T) { }, { name: "Migrate v3.5 to v3.5 is no-op", - binary: lastReleaseBinary, + clusterVersion: config.LastVersion, targetVersion: "3.5", expectLogsSubString: "storage version up-to-date\t" + `{"storage-version": "3.5"}`, }, { name: "Upgrade v3.5 to v3.6 should work", - binary: lastReleaseBinary, + clusterVersion: config.LastVersion, targetVersion: "3.6", expectStorageVersion: &version.V3_6, }, @@ -109,13 +110,13 @@ func TestEtctlutlMigrate(t *testing.T) { t.Run(tc.name, func(t *testing.T) { e2e.BeforeTest(t) lg := zaptest.NewLogger(t) - if tc.binary != "" && !fileutil.Exist(tc.binary) { + if tc.clusterVersion != config.CurrentVersion && !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { t.Skipf("%q does not exist", lastReleaseBinary) } dataDirPath := t.TempDir() epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{ - ExecPath: tc.binary, + Version: tc.clusterVersion, DataDirPath: dataDirPath, ClusterSize: 1, InitialToken: "new", diff --git a/tests/e2e/v2store_deprecation_test.go b/tests/e2e/v2store_deprecation_test.go index 13d329937..3a45a96f8 100644 --- a/tests/e2e/v2store_deprecation_test.go +++ b/tests/e2e/v2store_deprecation_test.go @@ -32,10 +32,10 @@ import ( "go.uber.org/zap/zaptest" ) -func createV2store(t testing.TB, lastReleaseBinary string, dataDirPath string) { +func createV2store(t testing.TB, dataDirPath string) { t.Log("Creating not-yet v2-deprecated etcd") - cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{ExecPath: lastReleaseBinary, EnableV2: true, DataDirPath: dataDirPath, SnapshotCount: 5}) + cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{Version: config.LastVersion, EnableV2: true, DataDirPath: dataDirPath, SnapshotCount: 5}) epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, cfg) assert.NoError(t, err) @@ -75,13 +75,12 @@ func TestV2DeprecationFlags(t *testing.T) { e2e.BeforeTest(t) dataDirPath := t.TempDir() - lastReleaseBinary := e2e.BinPath.EtcdLastRelease - if !fileutil.Exist(lastReleaseBinary) { - t.Skipf("%q does not exist", lastReleaseBinary) + if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { + t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease) } t.Run("create-storev2-data", func(t *testing.T) { - createV2store(t, lastReleaseBinary, dataDirPath) + createV2store(t, dataDirPath) }) t.Run("--v2-deprecation=not-yet fails", func(t *testing.T) { @@ -101,19 +100,16 @@ func TestV2DeprecationSnapshotMatches(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - lastReleaseBinary := e2e.BinPath.EtcdLastRelease - currentReleaseBinary := e2e.BinPath.Etcd - - if !fileutil.Exist(lastReleaseBinary) { - t.Skipf("%q does not exist", lastReleaseBinary) + if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { + t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease) } snapshotCount := 10 - epc := runEtcdAndCreateSnapshot(t, lastReleaseBinary, lastReleaseData, snapshotCount) + epc := runEtcdAndCreateSnapshot(t, config.LastVersion, lastReleaseData, snapshotCount) cc1, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3()) assert.NoError(t, err) members1 := addAndRemoveKeysAndMembers(ctx, t, cc1, snapshotCount) assert.NoError(t, epc.Close()) - epc = runEtcdAndCreateSnapshot(t, currentReleaseBinary, currentReleaseData, snapshotCount) + epc = runEtcdAndCreateSnapshot(t, config.CurrentVersion, currentReleaseData, snapshotCount) cc2, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3()) assert.NoError(t, err) members2 := addAndRemoveKeysAndMembers(ctx, t, cc2, snapshotCount) @@ -140,13 +136,10 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - lastReleaseBinary := e2e.BinPath.EtcdLastRelease - currentReleaseBinary := e2e.BinPath.Etcd - - if !fileutil.Exist(lastReleaseBinary) { - t.Skipf("%q does not exist", lastReleaseBinary) + if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { + t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease) } - epc := runEtcdAndCreateSnapshot(t, lastReleaseBinary, dataDir, 10) + epc := runEtcdAndCreateSnapshot(t, config.LastVersion, dataDir, 10) cc, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3()) assert.NoError(t, err) @@ -158,7 +151,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) { assert.NoError(t, err) assert.NoError(t, epc.Close()) - cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{ExecPath: currentReleaseBinary, DataDirPath: dataDir}) + cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{Version: config.CurrentVersion, DataDirPath: dataDir}) epc, err = e2e.NewEtcdProcessCluster(context.TODO(), t, cfg) assert.NoError(t, err) @@ -175,8 +168,8 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) { assert.NoError(t, epc.Close()) } -func runEtcdAndCreateSnapshot(t testing.TB, binary, dataDir string, snapshotCount int) *e2e.EtcdProcessCluster { - cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{ExecPath: binary, DataDirPath: dataDir, SnapshotCount: snapshotCount, KeepDataDir: true}) +func runEtcdAndCreateSnapshot(t testing.TB, serverVersion config.ClusterVersion, dataDir string, snapshotCount int) *e2e.EtcdProcessCluster { + cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{Version: serverVersion, DataDirPath: dataDir, SnapshotCount: snapshotCount, KeepDataDir: true}) epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, cfg) assert.NoError(t, err) return epc diff --git a/tests/framework/config/cluster.go b/tests/framework/config/cluster.go index 013eac6cd..a494c3842 100644 --- a/tests/framework/config/cluster.go +++ b/tests/framework/config/cluster.go @@ -14,15 +14,23 @@ package config -import "time" +import ( + "time" +) type TLSConfig string +type ClusterVersion string const ( NoTLS TLSConfig = "" AutoTLS TLSConfig = "auto-tls" ManualTLS TLSConfig = "manual-tls" + CurrentVersion ClusterVersion = "" + MinorityLastVersion ClusterVersion = "minority-last-version" + QuorumLastVersion ClusterVersion = "quorum-last-version" + LastVersion ClusterVersion = "last-version" + TickDuration = 10 * time.Millisecond ) @@ -34,6 +42,12 @@ type ClusterConfig struct { StrictReconfigCheck bool AuthToken string SnapshotCount int + + E2eConfig *E2eClusterConfig +} + +type E2eClusterConfig struct { + Version ClusterVersion } func DefaultClusterConfig() ClusterConfig { diff --git a/tests/framework/e2e/cluster.go b/tests/framework/e2e/cluster.go index d7d30c286..e49d7f560 100644 --- a/tests/framework/e2e/cluster.go +++ b/tests/framework/e2e/cluster.go @@ -138,7 +138,7 @@ type EtcdProcessCluster struct { type EtcdProcessClusterConfig struct { Logger *zap.Logger - ExecPath string + Version config.ClusterVersion DataDirPath string KeepDataDir bool EnvVars map[string]string @@ -208,9 +208,6 @@ func InitEtcdProcessCluster(t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdP if cfg.BasePort == 0 { cfg.BasePort = EtcdProcessBasePort } - if cfg.ExecPath == "" { - cfg.ExecPath = BinPath.Etcd - } if cfg.SnapshotCount == 0 { cfg.SnapshotCount = etcdserver.DefaultSnapshotCount } @@ -400,9 +397,31 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in envVars["GOFAIL_HTTP"] = fmt.Sprintf("127.0.0.1:%d", gofailPort) } + var execPath string + switch cfg.Version { + case config.CurrentVersion: + execPath = BinPath.Etcd + case config.MinorityLastVersion: + if i <= cfg.ClusterSize/2 { + execPath = BinPath.Etcd + } else { + execPath = BinPath.EtcdLastRelease + } + case config.QuorumLastVersion: + if i <= cfg.ClusterSize/2 { + execPath = BinPath.EtcdLastRelease + } else { + execPath = BinPath.Etcd + } + case config.LastVersion: + execPath = BinPath.EtcdLastRelease + default: + panic(fmt.Sprintf("Unknown cluster version %v", cfg.Version)) + } + return &EtcdServerProcessConfig{ lg: cfg.Logger, - ExecPath: cfg.ExecPath, + ExecPath: execPath, Args: args, EnvVars: envVars, TlsArgs: cfg.TlsArgs(), diff --git a/tests/framework/e2e/e2e.go b/tests/framework/e2e/e2e.go index 5704b74d1..87e5f5235 100644 --- a/tests/framework/e2e/e2e.go +++ b/tests/framework/e2e/e2e.go @@ -56,6 +56,9 @@ func (e e2eRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config. AuthTokenOpts: cfg.AuthToken, SnapshotCount: cfg.SnapshotCount, } + if cfg.E2eConfig != nil { + e2eConfig.Version = cfg.E2eConfig.Version + } switch cfg.ClientTLS { case config.NoTLS: e2eConfig.ClientTLS = ClientNonTLS diff --git a/tests/framework/integration/integration.go b/tests/framework/integration/integration.go index df9db28b8..ff546939d 100644 --- a/tests/framework/integration/integration.go +++ b/tests/framework/integration/integration.go @@ -50,6 +50,9 @@ func (e integrationRunner) BeforeTest(t testing.TB) { func (e integrationRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config.ClusterOption) intf.Cluster { var err error cfg := config.NewClusterConfig(opts...) + if cfg.E2eConfig != nil { + t.Fatalf("E2e configuration not expected during integration tests, config: %+v", cfg) + } integrationCfg := ClusterConfig{ Size: cfg.ClusterSize, QuotaBackendBytes: cfg.QuotaBackendBytes, From fc23d0e83aca9891712829e5484bd780dc020737 Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Mon, 7 Nov 2022 10:05:45 +0800 Subject: [PATCH 2/4] test: add ClusterContext into the common ClusterConfig ClusterContext is used by "e2e" or "integration" to extend the ClusterConfig. The common test cases shouldn't care about what data is encoded or included; instead "e2e" or "integration" framework should decode or parse it separately. Signed-off-by: Benjamin Wang --- tests/common/e2e_test.go | 9 +++---- tests/framework/config/cluster.go | 16 ++++--------- tests/framework/e2e/cluster.go | 10 ++++---- tests/framework/e2e/config.go | 28 ++++++++++++++++++++++ tests/framework/e2e/e2e.go | 7 ++++-- tests/framework/integration/integration.go | 4 +--- 6 files changed, 49 insertions(+), 25 deletions(-) create mode 100644 tests/framework/e2e/config.go diff --git a/tests/common/e2e_test.go b/tests/common/e2e_test.go index 2f68c66af..217c5c4fa 100644 --- a/tests/common/e2e_test.go +++ b/tests/common/e2e_test.go @@ -52,21 +52,22 @@ func e2eClusterTestCases() []testCase { config: config.ClusterConfig{ClusterSize: 1, ClientTLS: config.AutoTLS}, }, } + if fileutil.Exist(e2e.BinPath.EtcdLastRelease) { tcs = append(tcs, testCase{ name: "MinorityLastVersion", config: config.ClusterConfig{ ClusterSize: 3, - E2eConfig: &config.E2eClusterConfig{ - Version: config.MinorityLastVersion, + ClusterContext: &e2e.ClusterContext{ + Version: e2e.MinorityLastVersion, }, }, }, testCase{ name: "QuorumLastVersion", config: config.ClusterConfig{ ClusterSize: 3, - E2eConfig: &config.E2eClusterConfig{ - Version: config.QuorumLastVersion, + ClusterContext: &e2e.ClusterContext{ + Version: e2e.QuorumLastVersion, }, }, }) diff --git a/tests/framework/config/cluster.go b/tests/framework/config/cluster.go index a494c3842..a8c23d708 100644 --- a/tests/framework/config/cluster.go +++ b/tests/framework/config/cluster.go @@ -19,18 +19,12 @@ import ( ) type TLSConfig string -type ClusterVersion string const ( NoTLS TLSConfig = "" AutoTLS TLSConfig = "auto-tls" ManualTLS TLSConfig = "manual-tls" - CurrentVersion ClusterVersion = "" - MinorityLastVersion ClusterVersion = "minority-last-version" - QuorumLastVersion ClusterVersion = "quorum-last-version" - LastVersion ClusterVersion = "last-version" - TickDuration = 10 * time.Millisecond ) @@ -43,11 +37,11 @@ type ClusterConfig struct { AuthToken string SnapshotCount int - E2eConfig *E2eClusterConfig -} - -type E2eClusterConfig struct { - Version ClusterVersion + // ClusterContext is used by "e2e" or "integration" to extend the + // ClusterConfig. The common test cases shouldn't care about what + // data is encoded or included; instead "e2e" or "integration" + // framework should decode or parse it separately. + ClusterContext any } func DefaultClusterConfig() ClusterConfig { diff --git a/tests/framework/e2e/cluster.go b/tests/framework/e2e/cluster.go index e49d7f560..c27085aaf 100644 --- a/tests/framework/e2e/cluster.go +++ b/tests/framework/e2e/cluster.go @@ -138,7 +138,7 @@ type EtcdProcessCluster struct { type EtcdProcessClusterConfig struct { Logger *zap.Logger - Version config.ClusterVersion + Version ClusterVersion DataDirPath string KeepDataDir bool EnvVars map[string]string @@ -399,21 +399,21 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in var execPath string switch cfg.Version { - case config.CurrentVersion: + case CurrentVersion: execPath = BinPath.Etcd - case config.MinorityLastVersion: + case MinorityLastVersion: if i <= cfg.ClusterSize/2 { execPath = BinPath.Etcd } else { execPath = BinPath.EtcdLastRelease } - case config.QuorumLastVersion: + case QuorumLastVersion: if i <= cfg.ClusterSize/2 { execPath = BinPath.EtcdLastRelease } else { execPath = BinPath.Etcd } - case config.LastVersion: + case LastVersion: execPath = BinPath.EtcdLastRelease default: panic(fmt.Sprintf("Unknown cluster version %v", cfg.Version)) diff --git a/tests/framework/e2e/config.go b/tests/framework/e2e/config.go new file mode 100644 index 000000000..acc1d82e0 --- /dev/null +++ b/tests/framework/e2e/config.go @@ -0,0 +1,28 @@ +// Copyright 2022 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package e2e + +type ClusterVersion string + +const ( + CurrentVersion ClusterVersion = "" + MinorityLastVersion ClusterVersion = "minority-last-version" + QuorumLastVersion ClusterVersion = "quorum-last-version" + LastVersion ClusterVersion = "last-version" +) + +type ClusterContext struct { + Version ClusterVersion +} diff --git a/tests/framework/e2e/e2e.go b/tests/framework/e2e/e2e.go index 87e5f5235..59fbb2454 100644 --- a/tests/framework/e2e/e2e.go +++ b/tests/framework/e2e/e2e.go @@ -56,9 +56,12 @@ func (e e2eRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config. AuthTokenOpts: cfg.AuthToken, SnapshotCount: cfg.SnapshotCount, } - if cfg.E2eConfig != nil { - e2eConfig.Version = cfg.E2eConfig.Version + + if cfg.ClusterContext != nil { + e2eClusterCtx := cfg.ClusterContext.(*ClusterContext) + e2eConfig.Version = e2eClusterCtx.Version } + switch cfg.ClientTLS { case config.NoTLS: e2eConfig.ClientTLS = ClientNonTLS diff --git a/tests/framework/integration/integration.go b/tests/framework/integration/integration.go index ff546939d..1f07ff2b4 100644 --- a/tests/framework/integration/integration.go +++ b/tests/framework/integration/integration.go @@ -50,9 +50,7 @@ func (e integrationRunner) BeforeTest(t testing.TB) { func (e integrationRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config.ClusterOption) intf.Cluster { var err error cfg := config.NewClusterConfig(opts...) - if cfg.E2eConfig != nil { - t.Fatalf("E2e configuration not expected during integration tests, config: %+v", cfg) - } + integrationCfg := ClusterConfig{ Size: cfg.ClusterSize, QuotaBackendBytes: cfg.QuotaBackendBytes, From 86e71f026eaadcae58d37354f42dea6b19ed4957 Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Mon, 7 Nov 2022 10:15:21 +0800 Subject: [PATCH 3/4] test: update the definition of testRunner and clusterTestCases Signed-off-by: Benjamin Wang --- tests/common/main_test.go | 8 +++++--- tests/common/unit_test.go | 5 +++++ tests/framework/integration/integration.go | 1 - 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/common/main_test.go b/tests/common/main_test.go index 1bce798a4..be5e5a17d 100644 --- a/tests/common/main_test.go +++ b/tests/common/main_test.go @@ -15,14 +15,16 @@ package common import ( - "go.etcd.io/etcd/tests/v3/framework" "testing" "go.etcd.io/etcd/tests/v3/framework/config" + intf "go.etcd.io/etcd/tests/v3/framework/interfaces" ) -var testRunner = framework.UnitTestRunner -var clusterTestCases = func() []testCase { return nil } +var ( + testRunner intf.TestRunner + clusterTestCases func() []testCase +) func TestMain(m *testing.M) { testRunner.TestMain(m) diff --git a/tests/common/unit_test.go b/tests/common/unit_test.go index d88b15594..bb9e66446 100644 --- a/tests/common/unit_test.go +++ b/tests/common/unit_test.go @@ -23,6 +23,11 @@ import ( func init() { testRunner = framework.UnitTestRunner + clusterTestCases = unitClusterTestCases +} + +func unitClusterTestCases() []testCase { + return nil } // When a build tag (e.g. e2e or integration) isn't configured in IDE, diff --git a/tests/framework/integration/integration.go b/tests/framework/integration/integration.go index 1f07ff2b4..df9db28b8 100644 --- a/tests/framework/integration/integration.go +++ b/tests/framework/integration/integration.go @@ -50,7 +50,6 @@ func (e integrationRunner) BeforeTest(t testing.TB) { func (e integrationRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config.ClusterOption) intf.Cluster { var err error cfg := config.NewClusterConfig(opts...) - integrationCfg := ClusterConfig{ Size: cfg.ClusterSize, QuotaBackendBytes: cfg.QuotaBackendBytes, From 757cf33c009abc6671bf53b9981f345a31a362e8 Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Mon, 7 Nov 2022 10:25:04 +0800 Subject: [PATCH 4/4] test: update e2e test cases to use e2e specfic configuration from e2e package Afer moving `ClusterVersion` and related constants into e2e packages, some e2e test cases are broken, so we need to update them to use the correct definitions. Signed-off-by: Benjamin Wang --- tests/e2e/discovery_test.go | 3 +-- tests/e2e/etcd_release_upgrade_test.go | 5 ++--- tests/e2e/utl_migrate_test.go | 9 ++++----- tests/e2e/v2store_deprecation_test.go | 12 ++++++------ 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/tests/e2e/discovery_test.go b/tests/e2e/discovery_test.go index 3fc2d2d97..e15c10cb1 100644 --- a/tests/e2e/discovery_test.go +++ b/tests/e2e/discovery_test.go @@ -27,7 +27,6 @@ import ( "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/v2" "go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" - "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" "go.etcd.io/etcd/tests/v3/framework/integration" ) @@ -45,7 +44,7 @@ func testClusterUsingDiscovery(t *testing.T, size int, peerTLS bool) { dc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{ BasePort: 2000, - Version: config.LastVersion, + Version: e2e.LastVersion, ClusterSize: 1, EnableV2: true, }) diff --git a/tests/e2e/etcd_release_upgrade_test.go b/tests/e2e/etcd_release_upgrade_test.go index 34a911704..0d109bfe0 100644 --- a/tests/e2e/etcd_release_upgrade_test.go +++ b/tests/e2e/etcd_release_upgrade_test.go @@ -23,7 +23,6 @@ import ( "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/fileutil" - "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" ) @@ -37,7 +36,7 @@ func TestReleaseUpgrade(t *testing.T) { e2e.BeforeTest(t) copiedCfg := e2e.NewConfigNoTLS() - copiedCfg.Version = config.LastVersion + copiedCfg.Version = e2e.LastVersion copiedCfg.SnapshotCount = 3 copiedCfg.BaseScheme = "unix" // to avoid port conflict @@ -120,7 +119,7 @@ func TestReleaseUpgradeWithRestart(t *testing.T) { e2e.BeforeTest(t) copiedCfg := e2e.NewConfigNoTLS() - copiedCfg.Version = config.LastVersion + copiedCfg.Version = e2e.LastVersion copiedCfg.SnapshotCount = 10 copiedCfg.BaseScheme = "unix" diff --git a/tests/e2e/utl_migrate_test.go b/tests/e2e/utl_migrate_test.go index b2903bfcf..8325e4144 100644 --- a/tests/e2e/utl_migrate_test.go +++ b/tests/e2e/utl_migrate_test.go @@ -27,7 +27,6 @@ import ( "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/server/v3/storage/backend" "go.etcd.io/etcd/server/v3/storage/schema" - "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" "go.uber.org/zap/zaptest" ) @@ -38,7 +37,7 @@ func TestEtctlutlMigrate(t *testing.T) { tcs := []struct { name string targetVersion string - clusterVersion config.ClusterVersion + clusterVersion e2e.ClusterVersion force bool expectLogsSubString string @@ -70,13 +69,13 @@ func TestEtctlutlMigrate(t *testing.T) { }, { name: "Migrate v3.5 to v3.5 is no-op", - clusterVersion: config.LastVersion, + clusterVersion: e2e.LastVersion, targetVersion: "3.5", expectLogsSubString: "storage version up-to-date\t" + `{"storage-version": "3.5"}`, }, { name: "Upgrade v3.5 to v3.6 should work", - clusterVersion: config.LastVersion, + clusterVersion: e2e.LastVersion, targetVersion: "3.6", expectStorageVersion: &version.V3_6, }, @@ -110,7 +109,7 @@ func TestEtctlutlMigrate(t *testing.T) { t.Run(tc.name, func(t *testing.T) { e2e.BeforeTest(t) lg := zaptest.NewLogger(t) - if tc.clusterVersion != config.CurrentVersion && !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { + if tc.clusterVersion != e2e.CurrentVersion && !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { t.Skipf("%q does not exist", lastReleaseBinary) } dataDirPath := t.TempDir() diff --git a/tests/e2e/v2store_deprecation_test.go b/tests/e2e/v2store_deprecation_test.go index 3a45a96f8..ee415cc14 100644 --- a/tests/e2e/v2store_deprecation_test.go +++ b/tests/e2e/v2store_deprecation_test.go @@ -35,7 +35,7 @@ import ( func createV2store(t testing.TB, dataDirPath string) { t.Log("Creating not-yet v2-deprecated etcd") - cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{Version: config.LastVersion, EnableV2: true, DataDirPath: dataDirPath, SnapshotCount: 5}) + cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{Version: e2e.LastVersion, EnableV2: true, DataDirPath: dataDirPath, SnapshotCount: 5}) epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, cfg) assert.NoError(t, err) @@ -104,12 +104,12 @@ func TestV2DeprecationSnapshotMatches(t *testing.T) { t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease) } snapshotCount := 10 - epc := runEtcdAndCreateSnapshot(t, config.LastVersion, lastReleaseData, snapshotCount) + epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, lastReleaseData, snapshotCount) cc1, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3()) assert.NoError(t, err) members1 := addAndRemoveKeysAndMembers(ctx, t, cc1, snapshotCount) assert.NoError(t, epc.Close()) - epc = runEtcdAndCreateSnapshot(t, config.CurrentVersion, currentReleaseData, snapshotCount) + epc = runEtcdAndCreateSnapshot(t, e2e.CurrentVersion, currentReleaseData, snapshotCount) cc2, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3()) assert.NoError(t, err) members2 := addAndRemoveKeysAndMembers(ctx, t, cc2, snapshotCount) @@ -139,7 +139,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) { if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease) } - epc := runEtcdAndCreateSnapshot(t, config.LastVersion, dataDir, 10) + epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, dataDir, 10) cc, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3()) assert.NoError(t, err) @@ -151,7 +151,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) { assert.NoError(t, err) assert.NoError(t, epc.Close()) - cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{Version: config.CurrentVersion, DataDirPath: dataDir}) + cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{Version: e2e.CurrentVersion, DataDirPath: dataDir}) epc, err = e2e.NewEtcdProcessCluster(context.TODO(), t, cfg) assert.NoError(t, err) @@ -168,7 +168,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) { assert.NoError(t, epc.Close()) } -func runEtcdAndCreateSnapshot(t testing.TB, serverVersion config.ClusterVersion, dataDir string, snapshotCount int) *e2e.EtcdProcessCluster { +func runEtcdAndCreateSnapshot(t testing.TB, serverVersion e2e.ClusterVersion, dataDir string, snapshotCount int) *e2e.EtcdProcessCluster { cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{Version: serverVersion, DataDirPath: dataDir, SnapshotCount: snapshotCount, KeepDataDir: true}) epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, cfg) assert.NoError(t, err)