Skip to content

Commit

Permalink
tests/e2e: enable-v2 for v2 e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
  • Loading branch information
gyuho committed Jul 25, 2019
1 parent 6e524cf commit 970d94e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tests/e2e/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ type etcdProcessClusterConfig struct {
initialToken string
quotaBackendBytes int64
noStrictReconfig bool
enableV2 bool
initialCorruptCheck bool
authTokenOpts string
}
Expand Down Expand Up @@ -241,6 +242,9 @@ func (cfg *etcdProcessClusterConfig) etcdServerProcessConfigs() []*etcdServerPro
if cfg.noStrictReconfig {
args = append(args, "--strict-reconfig-check=false")
}
if cfg.enableV2 {
args = append(args, "--enable-v2")
}
if cfg.initialCorruptCheck {
args = append(args, "--experimental-initial-corrupt-check")
}
Expand Down
17 changes: 15 additions & 2 deletions tests/e2e/ctl_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func testCtlV2Set(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
defer os.Unsetenv("ETCDCTL_API")
defer testutil.AfterTest(t)

cfg.enableV2 = true
epc := setupEtcdctlTest(t, cfg, quorum)
defer func() {
if errC := epc.Close(); errC != nil {
Expand All @@ -61,6 +62,7 @@ func testCtlV2Mk(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
defer os.Unsetenv("ETCDCTL_API")
defer testutil.AfterTest(t)

cfg.enableV2 = true
epc := setupEtcdctlTest(t, cfg, quorum)
defer func() {
if errC := epc.Close(); errC != nil {
Expand Down Expand Up @@ -89,6 +91,7 @@ func testCtlV2Rm(t *testing.T, cfg *etcdProcessClusterConfig) {
defer os.Unsetenv("ETCDCTL_API")
defer testutil.AfterTest(t)

cfg.enableV2 = true
epc := setupEtcdctlTest(t, cfg, true)
defer func() {
if errC := epc.Close(); errC != nil {
Expand Down Expand Up @@ -118,6 +121,7 @@ func testCtlV2Ls(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
defer os.Unsetenv("ETCDCTL_API")
defer testutil.AfterTest(t)

cfg.enableV2 = true
epc := setupEtcdctlTest(t, cfg, quorum)
defer func() {
if errC := epc.Close(); errC != nil {
Expand All @@ -144,6 +148,7 @@ func testCtlV2Watch(t *testing.T, cfg *etcdProcessClusterConfig, noSync bool) {
defer os.Unsetenv("ETCDCTL_API")
defer testutil.AfterTest(t)

cfg.enableV2 = true
epc := setupEtcdctlTest(t, cfg, true)
defer func() {
if errC := epc.Close(); errC != nil {
Expand Down Expand Up @@ -172,6 +177,7 @@ func TestCtlV2GetRoleUser(t *testing.T) {
defer os.Unsetenv("ETCDCTL_API")
defer testutil.AfterTest(t)

cfg.enableV2 = true
epc := setupEtcdctlTest(t, &configNoTLS, false)
defer func() {
if err := epc.Close(); err != nil {
Expand Down Expand Up @@ -207,6 +213,7 @@ func testCtlV2UserList(t *testing.T, username string) {
defer os.Unsetenv("ETCDCTL_API")
defer testutil.AfterTest(t)

cfg.enableV2 = true
epc := setupEtcdctlTest(t, &configNoTLS, false)
defer func() {
if err := epc.Close(); err != nil {
Expand All @@ -227,6 +234,7 @@ func TestCtlV2RoleList(t *testing.T) {
defer os.Unsetenv("ETCDCTL_API")
defer testutil.AfterTest(t)

cfg.enableV2 = true
epc := setupEtcdctlTest(t, &configNoTLS, false)
defer func() {
if err := epc.Close(); err != nil {
Expand Down Expand Up @@ -261,6 +269,7 @@ func testCtlV2Backup(t *testing.T, snapCount int, v3 bool) {

etcdCfg := configNoTLS
etcdCfg.snapshotCount = snapCount
etcdCfg.enableV2 = true
epc1 := setupEtcdctlTest(t, &etcdCfg, false)

// v3 put before v2 set so snapshot happens after v3 operations to confirm
Expand Down Expand Up @@ -293,6 +302,7 @@ func testCtlV2Backup(t *testing.T, snapCount int, v3 bool) {
cfg2.dataDirPath = backupDir
cfg2.keepDataDir = true
cfg2.forceNewCluster = true
cfg2.enableV2 = true
epc2 := setupEtcdctlTest(t, &cfg2, false)

// check if backup went through correctly
Expand Down Expand Up @@ -333,7 +343,7 @@ func TestCtlV2AuthWithCommonName(t *testing.T) {

copiedCfg := configClientTLS
copiedCfg.clientCertAuthEnabled = true

copiedCfg.enableV2 = true
epc := setupEtcdctlTest(t, &copiedCfg, false)
defer func() {
if err := epc.Close(); err != nil {
Expand Down Expand Up @@ -368,7 +378,10 @@ func TestCtlV2ClusterHealth(t *testing.T) {
os.Setenv("ETCDCTL_API", "2")
defer os.Unsetenv("ETCDCTL_API")
defer testutil.AfterTest(t)
epc := setupEtcdctlTest(t, &configNoTLS, true)

copied := configNoTLS
copied.enableV2 = true
epc := setupEtcdctlTest(t, &copied, true)
defer func() {
if err := epc.Close(); err != nil {
t.Fatalf("error closing etcd processes (%v)", err)
Expand Down

0 comments on commit 970d94e

Please sign in to comment.