|
@@ -31,6 +31,8 @@ func TestCtlV2SetClientTLS(t *testing.T) { testCtlV2Set(t, &configClientTLS, fal
|
|
|
func TestCtlV2SetPeerTLS(t *testing.T) { testCtlV2Set(t, &configPeerTLS, false) }
|
|
func TestCtlV2SetPeerTLS(t *testing.T) { testCtlV2Set(t, &configPeerTLS, false) }
|
|
|
func TestCtlV2SetTLS(t *testing.T) { testCtlV2Set(t, &configTLS, false) }
|
|
func TestCtlV2SetTLS(t *testing.T) { testCtlV2Set(t, &configTLS, false) }
|
|
|
func testCtlV2Set(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
|
func testCtlV2Set(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
epc := setupEtcdctlTest(t, cfg, quorum)
|
|
epc := setupEtcdctlTest(t, cfg, quorum)
|
|
@@ -55,6 +57,8 @@ func TestCtlV2Mk(t *testing.T) { testCtlV2Mk(t, &configNoTLS, false) }
|
|
|
func TestCtlV2MkQuorum(t *testing.T) { testCtlV2Mk(t, &configNoTLS, true) }
|
|
func TestCtlV2MkQuorum(t *testing.T) { testCtlV2Mk(t, &configNoTLS, true) }
|
|
|
func TestCtlV2MkTLS(t *testing.T) { testCtlV2Mk(t, &configTLS, false) }
|
|
func TestCtlV2MkTLS(t *testing.T) { testCtlV2Mk(t, &configTLS, false) }
|
|
|
func testCtlV2Mk(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
|
func testCtlV2Mk(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
epc := setupEtcdctlTest(t, cfg, quorum)
|
|
epc := setupEtcdctlTest(t, cfg, quorum)
|
|
@@ -81,6 +85,8 @@ func testCtlV2Mk(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
|
|
func TestCtlV2Rm(t *testing.T) { testCtlV2Rm(t, &configNoTLS) }
|
|
func TestCtlV2Rm(t *testing.T) { testCtlV2Rm(t, &configNoTLS) }
|
|
|
func TestCtlV2RmTLS(t *testing.T) { testCtlV2Rm(t, &configTLS) }
|
|
func TestCtlV2RmTLS(t *testing.T) { testCtlV2Rm(t, &configTLS) }
|
|
|
func testCtlV2Rm(t *testing.T, cfg *etcdProcessClusterConfig) {
|
|
func testCtlV2Rm(t *testing.T, cfg *etcdProcessClusterConfig) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
epc := setupEtcdctlTest(t, cfg, true)
|
|
epc := setupEtcdctlTest(t, cfg, true)
|
|
@@ -108,6 +114,8 @@ func TestCtlV2Ls(t *testing.T) { testCtlV2Ls(t, &configNoTLS, false) }
|
|
|
func TestCtlV2LsQuorum(t *testing.T) { testCtlV2Ls(t, &configNoTLS, true) }
|
|
func TestCtlV2LsQuorum(t *testing.T) { testCtlV2Ls(t, &configNoTLS, true) }
|
|
|
func TestCtlV2LsTLS(t *testing.T) { testCtlV2Ls(t, &configTLS, false) }
|
|
func TestCtlV2LsTLS(t *testing.T) { testCtlV2Ls(t, &configTLS, false) }
|
|
|
func testCtlV2Ls(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
|
func testCtlV2Ls(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
epc := setupEtcdctlTest(t, cfg, quorum)
|
|
epc := setupEtcdctlTest(t, cfg, quorum)
|
|
@@ -132,6 +140,8 @@ func TestCtlV2Watch(t *testing.T) { testCtlV2Watch(t, &configNoTLS, false) }
|
|
|
func TestCtlV2WatchTLS(t *testing.T) { testCtlV2Watch(t, &configTLS, false) }
|
|
func TestCtlV2WatchTLS(t *testing.T) { testCtlV2Watch(t, &configTLS, false) }
|
|
|
|
|
|
|
|
func testCtlV2Watch(t *testing.T, cfg *etcdProcessClusterConfig, noSync bool) {
|
|
func testCtlV2Watch(t *testing.T, cfg *etcdProcessClusterConfig, noSync bool) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
epc := setupEtcdctlTest(t, cfg, true)
|
|
epc := setupEtcdctlTest(t, cfg, true)
|
|
@@ -158,6 +168,8 @@ func testCtlV2Watch(t *testing.T, cfg *etcdProcessClusterConfig, noSync bool) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func TestCtlV2GetRoleUser(t *testing.T) {
|
|
func TestCtlV2GetRoleUser(t *testing.T) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
|
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
|
@@ -191,6 +203,8 @@ func TestCtlV2GetRoleUser(t *testing.T) {
|
|
|
func TestCtlV2UserListUsername(t *testing.T) { testCtlV2UserList(t, "username") }
|
|
func TestCtlV2UserListUsername(t *testing.T) { testCtlV2UserList(t, "username") }
|
|
|
func TestCtlV2UserListRoot(t *testing.T) { testCtlV2UserList(t, "root") }
|
|
func TestCtlV2UserListRoot(t *testing.T) { testCtlV2UserList(t, "root") }
|
|
|
func testCtlV2UserList(t *testing.T, username string) {
|
|
func testCtlV2UserList(t *testing.T, username string) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
|
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
|
@@ -209,6 +223,8 @@ func testCtlV2UserList(t *testing.T, username string) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func TestCtlV2RoleList(t *testing.T) {
|
|
func TestCtlV2RoleList(t *testing.T) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
|
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
|
@@ -233,6 +249,8 @@ func TestCtlV2BackupV3(t *testing.T) { testCtlV2Backup(t, 0, true) }
|
|
|
func TestCtlV2BackupV3Snapshot(t *testing.T) { testCtlV2Backup(t, 1, true) }
|
|
func TestCtlV2BackupV3Snapshot(t *testing.T) { testCtlV2Backup(t, 1, true) }
|
|
|
|
|
|
|
|
func testCtlV2Backup(t *testing.T, snapCount int, v3 bool) {
|
|
func testCtlV2Backup(t *testing.T, snapCount int, v3 bool) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
backupDir, err := ioutil.TempDir("", "testbackup0.etcd")
|
|
backupDir, err := ioutil.TempDir("", "testbackup0.etcd")
|
|
@@ -305,6 +323,8 @@ func testCtlV2Backup(t *testing.T, snapCount int, v3 bool) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func TestCtlV2AuthWithCommonName(t *testing.T) {
|
|
func TestCtlV2AuthWithCommonName(t *testing.T) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
|
|
|
|
|
copiedCfg := configClientTLS
|
|
copiedCfg := configClientTLS
|
|
@@ -341,6 +361,8 @@ func TestCtlV2AuthWithCommonName(t *testing.T) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func TestCtlV2ClusterHealth(t *testing.T) {
|
|
func TestCtlV2ClusterHealth(t *testing.T) {
|
|
|
|
|
+ os.Setenv("ETCDCTL_API", "2")
|
|
|
|
|
+ defer os.Unsetenv("ETCDCTL_API")
|
|
|
defer testutil.AfterTest(t)
|
|
defer testutil.AfterTest(t)
|
|
|
epc := setupEtcdctlTest(t, &configNoTLS, true)
|
|
epc := setupEtcdctlTest(t, &configNoTLS, true)
|
|
|
defer func() {
|
|
defer func() {
|