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 <wachao@vmware.com>
dependabot/go_modules/go.uber.org/atomic-1.10.0
Benjamin Wang 2022-11-07 10:25:04 +08:00
parent 86e71f026e
commit 757cf33c00
4 changed files with 13 additions and 16 deletions

View File

@ -27,7 +27,6 @@ import (
"go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/pkg/v3/transport"
"go.etcd.io/etcd/client/v2" "go.etcd.io/etcd/client/v2"
"go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" "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/e2e"
"go.etcd.io/etcd/tests/v3/framework/integration" "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{ dc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{
BasePort: 2000, BasePort: 2000,
Version: config.LastVersion, Version: e2e.LastVersion,
ClusterSize: 1, ClusterSize: 1,
EnableV2: true, EnableV2: true,
}) })

View File

@ -23,7 +23,6 @@ import (
"go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/api/v3/version"
"go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/client/pkg/v3/fileutil"
"go.etcd.io/etcd/tests/v3/framework/config"
"go.etcd.io/etcd/tests/v3/framework/e2e" "go.etcd.io/etcd/tests/v3/framework/e2e"
) )
@ -37,7 +36,7 @@ func TestReleaseUpgrade(t *testing.T) {
e2e.BeforeTest(t) e2e.BeforeTest(t)
copiedCfg := e2e.NewConfigNoTLS() copiedCfg := e2e.NewConfigNoTLS()
copiedCfg.Version = config.LastVersion copiedCfg.Version = e2e.LastVersion
copiedCfg.SnapshotCount = 3 copiedCfg.SnapshotCount = 3
copiedCfg.BaseScheme = "unix" // to avoid port conflict copiedCfg.BaseScheme = "unix" // to avoid port conflict
@ -120,7 +119,7 @@ func TestReleaseUpgradeWithRestart(t *testing.T) {
e2e.BeforeTest(t) e2e.BeforeTest(t)
copiedCfg := e2e.NewConfigNoTLS() copiedCfg := e2e.NewConfigNoTLS()
copiedCfg.Version = config.LastVersion copiedCfg.Version = e2e.LastVersion
copiedCfg.SnapshotCount = 10 copiedCfg.SnapshotCount = 10
copiedCfg.BaseScheme = "unix" copiedCfg.BaseScheme = "unix"

View File

@ -27,7 +27,6 @@ import (
"go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/client/pkg/v3/fileutil"
"go.etcd.io/etcd/server/v3/storage/backend" "go.etcd.io/etcd/server/v3/storage/backend"
"go.etcd.io/etcd/server/v3/storage/schema" "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.etcd.io/etcd/tests/v3/framework/e2e"
"go.uber.org/zap/zaptest" "go.uber.org/zap/zaptest"
) )
@ -38,7 +37,7 @@ func TestEtctlutlMigrate(t *testing.T) {
tcs := []struct { tcs := []struct {
name string name string
targetVersion string targetVersion string
clusterVersion config.ClusterVersion clusterVersion e2e.ClusterVersion
force bool force bool
expectLogsSubString string expectLogsSubString string
@ -70,13 +69,13 @@ func TestEtctlutlMigrate(t *testing.T) {
}, },
{ {
name: "Migrate v3.5 to v3.5 is no-op", name: "Migrate v3.5 to v3.5 is no-op",
clusterVersion: config.LastVersion, clusterVersion: e2e.LastVersion,
targetVersion: "3.5", targetVersion: "3.5",
expectLogsSubString: "storage version up-to-date\t" + `{"storage-version": "3.5"}`, expectLogsSubString: "storage version up-to-date\t" + `{"storage-version": "3.5"}`,
}, },
{ {
name: "Upgrade v3.5 to v3.6 should work", name: "Upgrade v3.5 to v3.6 should work",
clusterVersion: config.LastVersion, clusterVersion: e2e.LastVersion,
targetVersion: "3.6", targetVersion: "3.6",
expectStorageVersion: &version.V3_6, expectStorageVersion: &version.V3_6,
}, },
@ -110,7 +109,7 @@ func TestEtctlutlMigrate(t *testing.T) {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
e2e.BeforeTest(t) e2e.BeforeTest(t)
lg := zaptest.NewLogger(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) t.Skipf("%q does not exist", lastReleaseBinary)
} }
dataDirPath := t.TempDir() dataDirPath := t.TempDir()

View File

@ -35,7 +35,7 @@ import (
func createV2store(t testing.TB, dataDirPath string) { func createV2store(t testing.TB, dataDirPath string) {
t.Log("Creating not-yet v2-deprecated etcd") 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) epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, cfg)
assert.NoError(t, err) assert.NoError(t, err)
@ -104,12 +104,12 @@ func TestV2DeprecationSnapshotMatches(t *testing.T) {
t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease) t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease)
} }
snapshotCount := 10 snapshotCount := 10
epc := runEtcdAndCreateSnapshot(t, config.LastVersion, lastReleaseData, snapshotCount) epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, lastReleaseData, snapshotCount)
cc1, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3()) cc1, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
assert.NoError(t, err) assert.NoError(t, err)
members1 := addAndRemoveKeysAndMembers(ctx, t, cc1, snapshotCount) members1 := addAndRemoveKeysAndMembers(ctx, t, cc1, snapshotCount)
assert.NoError(t, epc.Close()) 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()) cc2, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
assert.NoError(t, err) assert.NoError(t, err)
members2 := addAndRemoveKeysAndMembers(ctx, t, cc2, snapshotCount) members2 := addAndRemoveKeysAndMembers(ctx, t, cc2, snapshotCount)
@ -139,7 +139,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) { if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) {
t.Skipf("%q does not 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()) cc, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
assert.NoError(t, err) assert.NoError(t, err)
@ -151,7 +151,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
assert.NoError(t, epc.Close()) 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) epc, err = e2e.NewEtcdProcessCluster(context.TODO(), t, cfg)
assert.NoError(t, err) assert.NoError(t, err)
@ -168,7 +168,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
assert.NoError(t, epc.Close()) 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}) cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{Version: serverVersion, DataDirPath: dataDir, SnapshotCount: snapshotCount, KeepDataDir: true})
epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, cfg) epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, cfg)
assert.NoError(t, err) assert.NoError(t, err)