mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #14697 from ahrtr/hybrid_20221107
test: support mix versions testing
This commit is contained in:
commit
13dd8ef607
@ -18,6 +18,7 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go.etcd.io/etcd/client/pkg/v3/fileutil"
|
||||||
"go.etcd.io/etcd/tests/v3/framework"
|
"go.etcd.io/etcd/tests/v3/framework"
|
||||||
"go.etcd.io/etcd/tests/v3/framework/config"
|
"go.etcd.io/etcd/tests/v3/framework/config"
|
||||||
"go.etcd.io/etcd/tests/v3/framework/e2e"
|
"go.etcd.io/etcd/tests/v3/framework/e2e"
|
||||||
@ -25,6 +26,53 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
testRunner = framework.E2eTestRunner
|
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,
|
||||||
|
ClusterContext: &e2e.ClusterContext{
|
||||||
|
Version: e2e.MinorityLastVersion,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, testCase{
|
||||||
|
name: "QuorumLastVersion",
|
||||||
|
config: config.ClusterConfig{
|
||||||
|
ClusterSize: 3,
|
||||||
|
ClusterContext: &e2e.ClusterContext{
|
||||||
|
Version: e2e.QuorumLastVersion,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return tcs
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithAuth(userName, password string) config.ClientOption {
|
func WithAuth(userName, password string) config.ClientOption {
|
||||||
|
@ -25,6 +25,32 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
testRunner = framework.IntegrationTestRunner
|
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 {
|
func WithAuth(userName, password string) config.ClientOption {
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
|
|
||||||
func TestKVPut(t *testing.T) {
|
func TestKVPut(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -61,7 +61,7 @@ func TestKVPut(t *testing.T) {
|
|||||||
|
|
||||||
func TestKVGet(t *testing.T) {
|
func TestKVGet(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -121,7 +121,7 @@ func TestKVGet(t *testing.T) {
|
|||||||
|
|
||||||
func TestKVDelete(t *testing.T) {
|
func TestKVDelete(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
func TestLeaseGrantTimeToLive(t *testing.T) {
|
func TestLeaseGrantTimeToLive(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
|
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -52,7 +52,7 @@ func TestLeaseGrantTimeToLive(t *testing.T) {
|
|||||||
func TestLeaseGrantAndList(t *testing.T) {
|
func TestLeaseGrantAndList(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
|
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
nestedCases := []struct {
|
nestedCases := []struct {
|
||||||
name string
|
name string
|
||||||
leaseCount int
|
leaseCount int
|
||||||
@ -119,7 +119,7 @@ func TestLeaseGrantAndList(t *testing.T) {
|
|||||||
func TestLeaseGrantTimeToLiveExpired(t *testing.T) {
|
func TestLeaseGrantTimeToLiveExpired(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
|
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -156,7 +156,7 @@ func TestLeaseGrantTimeToLiveExpired(t *testing.T) {
|
|||||||
func TestLeaseGrantKeepAliveOnce(t *testing.T) {
|
func TestLeaseGrantKeepAliveOnce(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
|
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -185,7 +185,7 @@ func TestLeaseGrantKeepAliveOnce(t *testing.T) {
|
|||||||
func TestLeaseGrantRevoke(t *testing.T) {
|
func TestLeaseGrantRevoke(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
|
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -21,30 +21,10 @@ import (
|
|||||||
intf "go.etcd.io/etcd/tests/v3/framework/interfaces"
|
intf "go.etcd.io/etcd/tests/v3/framework/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
var testRunner intf.TestRunner
|
var (
|
||||||
|
testRunner intf.TestRunner
|
||||||
var clusterTestCases = []testCase{
|
clusterTestCases func() []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)),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
testRunner.TestMain(m)
|
testRunner.TestMain(m)
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
func TestMemberList(t *testing.T) {
|
func TestMemberList(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
|
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -102,7 +102,7 @@ func TestMemberAdd(t *testing.T) {
|
|||||||
|
|
||||||
for _, learnerTc := range learnerTcs {
|
for _, learnerTc := range learnerTcs {
|
||||||
for _, quorumTc := range quorumTcs {
|
for _, quorumTc := range quorumTcs {
|
||||||
for _, clusterTc := range clusterTestCases {
|
for _, clusterTc := range clusterTestCases() {
|
||||||
t.Run(learnerTc.name+"/"+quorumTc.name+"/"+clusterTc.name, func(t *testing.T) {
|
t.Run(learnerTc.name+"/"+quorumTc.name+"/"+clusterTc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -178,7 +178,7 @@ func TestMemberRemove(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, quorumTc := range tcs {
|
for _, quorumTc := range tcs {
|
||||||
for _, clusterTc := range clusterTestCases {
|
for _, clusterTc := range clusterTestCases() {
|
||||||
if !quorumTc.strictReconfigCheck && clusterTc.config.ClusterSize == 1 {
|
if !quorumTc.strictReconfigCheck && clusterTc.config.ClusterSize == 1 {
|
||||||
// skip these test cases
|
// skip these test cases
|
||||||
// when strictReconfigCheck is disabled, calling MemberRemove will cause the single node to panic
|
// when strictReconfigCheck is disabled, calling MemberRemove will cause the single node to panic
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
|
|
||||||
func TestRoleAdd_Simple(t *testing.T) {
|
func TestRoleAdd_Simple(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -27,7 +27,7 @@ func TestStatus(t *testing.T) {
|
|||||||
|
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
|
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -54,7 +54,7 @@ func TestTxnSucc(t *testing.T) {
|
|||||||
results: []string{"SUCCESS", `key "with" space`, "value \x23"},
|
results: []string{"SUCCESS", `key "with" space`, "value \x23"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, cfg := range clusterTestCases {
|
for _, cfg := range clusterTestCases() {
|
||||||
t.Run(cfg.name, func(t *testing.T) {
|
t.Run(cfg.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -98,7 +98,7 @@ func TestTxnFail(t *testing.T) {
|
|||||||
results: []string{"FAILURE", "OK"},
|
results: []string{"FAILURE", "OK"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, cfg := range clusterTestCases {
|
for _, cfg := range clusterTestCases() {
|
||||||
t.Run(cfg.name, func(t *testing.T) {
|
t.Run(cfg.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -23,6 +23,11 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
testRunner = framework.UnitTestRunner
|
testRunner = framework.UnitTestRunner
|
||||||
|
clusterTestCases = unitClusterTestCases
|
||||||
|
}
|
||||||
|
|
||||||
|
func unitClusterTestCases() []testCase {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// When a build tag (e.g. e2e or integration) isn't configured in IDE,
|
// When a build tag (e.g. e2e or integration) isn't configured in IDE,
|
||||||
|
@ -61,7 +61,7 @@ func TestUserAdd_Simple(t *testing.T) {
|
|||||||
password: "bar",
|
password: "bar",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
for _, nc := range tcs {
|
for _, nc := range tcs {
|
||||||
t.Run(tc.name+"/"+nc.name, func(t *testing.T) {
|
t.Run(tc.name+"/"+nc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
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) {
|
func TestUserAdd_DuplicateUserNotAllowed(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -125,7 +125,7 @@ func TestUserAdd_DuplicateUserNotAllowed(t *testing.T) {
|
|||||||
|
|
||||||
func TestUserList(t *testing.T) {
|
func TestUserList(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -166,7 +166,7 @@ func TestUserList(t *testing.T) {
|
|||||||
|
|
||||||
func TestUserDelete(t *testing.T) {
|
func TestUserDelete(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -218,7 +218,7 @@ func TestUserDelete(t *testing.T) {
|
|||||||
|
|
||||||
func TestUserChangePassword(t *testing.T) {
|
func TestUserChangePassword(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
func TestWaitLeader(t *testing.T) {
|
func TestWaitLeader(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
|
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
func TestWatch(t *testing.T) {
|
func TestWatch(t *testing.T) {
|
||||||
testRunner.BeforeTest(t)
|
testRunner.BeforeTest(t)
|
||||||
watchTimeout := 1 * time.Second
|
watchTimeout := 1 * time.Second
|
||||||
for _, tc := range clusterTestCases {
|
for _, tc := range clusterTestCases() {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -57,7 +57,7 @@ func testDowngradeUpgrade(t *testing.T, clusterSize int) {
|
|||||||
e2e.BeforeTest(t)
|
e2e.BeforeTest(t)
|
||||||
|
|
||||||
t.Logf("Create cluster with version %s", currentVersionStr)
|
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++ {
|
for i := 0; i < len(epc.Procs); i++ {
|
||||||
validateVersion(t, epc.Cfg, epc.Procs[i], version.Versions{
|
validateVersion(t, epc.Cfg, epc.Procs[i], version.Versions{
|
||||||
Cluster: currentVersionStr,
|
Cluster: currentVersionStr,
|
||||||
@ -119,9 +119,8 @@ func testDowngradeUpgrade(t *testing.T, clusterSize int) {
|
|||||||
t.Log("Upgrade complete")
|
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{
|
epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{
|
||||||
ExecPath: execPath,
|
|
||||||
ClusterSize: clusterSize,
|
ClusterSize: clusterSize,
|
||||||
InitialToken: "new",
|
InitialToken: "new",
|
||||||
KeepDataDir: true,
|
KeepDataDir: true,
|
||||||
|
@ -24,7 +24,6 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"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/testutil"
|
"go.etcd.io/etcd/client/pkg/v3/testutil"
|
||||||
"go.etcd.io/etcd/pkg/v3/flags"
|
"go.etcd.io/etcd/pkg/v3/flags"
|
||||||
"go.etcd.io/etcd/tests/v3/framework/e2e"
|
"go.etcd.io/etcd/tests/v3/framework/e2e"
|
||||||
@ -51,13 +50,8 @@ func TestClusterVersion(t *testing.T) {
|
|||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
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)
|
e2e.BeforeTest(t)
|
||||||
cfg := e2e.NewConfigNoTLS()
|
cfg := e2e.NewConfigNoTLS()
|
||||||
cfg.ExecPath = binary
|
|
||||||
cfg.SnapshotCount = 3
|
cfg.SnapshotCount = 3
|
||||||
cfg.BaseScheme = "unix" // to avoid port conflict
|
cfg.BaseScheme = "unix" // to avoid port conflict
|
||||||
cfg.RollingStart = tt.rollingStart
|
cfg.RollingStart = tt.rollingStart
|
||||||
|
@ -38,14 +38,13 @@ func TestTLSClusterOf3UsingDiscovery(t *testing.T) { testClusterUsingDiscovery(t
|
|||||||
func testClusterUsingDiscovery(t *testing.T, size int, peerTLS bool) {
|
func testClusterUsingDiscovery(t *testing.T, size int, peerTLS bool) {
|
||||||
e2e.BeforeTest(t)
|
e2e.BeforeTest(t)
|
||||||
|
|
||||||
lastReleaseBinary := e2e.BinPath.EtcdLastRelease
|
if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) {
|
||||||
if !fileutil.Exist(lastReleaseBinary) {
|
t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease)
|
||||||
t.Skipf("%q does not exist", lastReleaseBinary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{
|
dc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{
|
||||||
BasePort: 2000,
|
BasePort: 2000,
|
||||||
ExecPath: lastReleaseBinary,
|
Version: e2e.LastVersion,
|
||||||
ClusterSize: 1,
|
ClusterSize: 1,
|
||||||
EnableV2: true,
|
EnableV2: true,
|
||||||
})
|
})
|
||||||
|
@ -29,15 +29,14 @@ import (
|
|||||||
// TestReleaseUpgrade ensures that changes to master branch does not affect
|
// TestReleaseUpgrade ensures that changes to master branch does not affect
|
||||||
// upgrade from latest etcd releases.
|
// upgrade from latest etcd releases.
|
||||||
func TestReleaseUpgrade(t *testing.T) {
|
func TestReleaseUpgrade(t *testing.T) {
|
||||||
lastReleaseBinary := e2e.BinPath.EtcdLastRelease
|
if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) {
|
||||||
if !fileutil.Exist(lastReleaseBinary) {
|
t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease)
|
||||||
t.Skipf("%q does not exist", lastReleaseBinary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e2e.BeforeTest(t)
|
e2e.BeforeTest(t)
|
||||||
|
|
||||||
copiedCfg := e2e.NewConfigNoTLS()
|
copiedCfg := e2e.NewConfigNoTLS()
|
||||||
copiedCfg.ExecPath = lastReleaseBinary
|
copiedCfg.Version = e2e.LastVersion
|
||||||
copiedCfg.SnapshotCount = 3
|
copiedCfg.SnapshotCount = 3
|
||||||
copiedCfg.BaseScheme = "unix" // to avoid port conflict
|
copiedCfg.BaseScheme = "unix" // to avoid port conflict
|
||||||
|
|
||||||
@ -113,15 +112,14 @@ func TestReleaseUpgrade(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReleaseUpgradeWithRestart(t *testing.T) {
|
func TestReleaseUpgradeWithRestart(t *testing.T) {
|
||||||
lastReleaseBinary := e2e.BinPath.EtcdLastRelease
|
if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) {
|
||||||
if !fileutil.Exist(lastReleaseBinary) {
|
t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease)
|
||||||
t.Skipf("%q does not exist", lastReleaseBinary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e2e.BeforeTest(t)
|
e2e.BeforeTest(t)
|
||||||
|
|
||||||
copiedCfg := e2e.NewConfigNoTLS()
|
copiedCfg := e2e.NewConfigNoTLS()
|
||||||
copiedCfg.ExecPath = lastReleaseBinary
|
copiedCfg.Version = e2e.LastVersion
|
||||||
copiedCfg.SnapshotCount = 10
|
copiedCfg.SnapshotCount = 10
|
||||||
copiedCfg.BaseScheme = "unix"
|
copiedCfg.BaseScheme = "unix"
|
||||||
|
|
||||||
|
@ -35,10 +35,10 @@ func TestEtctlutlMigrate(t *testing.T) {
|
|||||||
lastReleaseBinary := e2e.BinPath.EtcdLastRelease
|
lastReleaseBinary := e2e.BinPath.EtcdLastRelease
|
||||||
|
|
||||||
tcs := []struct {
|
tcs := []struct {
|
||||||
name string
|
name string
|
||||||
targetVersion string
|
targetVersion string
|
||||||
binary string
|
clusterVersion e2e.ClusterVersion
|
||||||
force bool
|
force bool
|
||||||
|
|
||||||
expectLogsSubString string
|
expectLogsSubString string
|
||||||
expectStorageVersion *semver.Version
|
expectStorageVersion *semver.Version
|
||||||
@ -69,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",
|
||||||
binary: lastReleaseBinary,
|
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",
|
||||||
binary: lastReleaseBinary,
|
clusterVersion: e2e.LastVersion,
|
||||||
targetVersion: "3.6",
|
targetVersion: "3.6",
|
||||||
expectStorageVersion: &version.V3_6,
|
expectStorageVersion: &version.V3_6,
|
||||||
},
|
},
|
||||||
@ -109,13 +109,13 @@ 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.binary != "" && !fileutil.Exist(tc.binary) {
|
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()
|
||||||
|
|
||||||
epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{
|
epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{
|
||||||
ExecPath: tc.binary,
|
Version: tc.clusterVersion,
|
||||||
DataDirPath: dataDirPath,
|
DataDirPath: dataDirPath,
|
||||||
ClusterSize: 1,
|
ClusterSize: 1,
|
||||||
InitialToken: "new",
|
InitialToken: "new",
|
||||||
|
@ -32,10 +32,10 @@ import (
|
|||||||
"go.uber.org/zap/zaptest"
|
"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")
|
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: 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)
|
||||||
|
|
||||||
@ -75,13 +75,12 @@ func TestV2DeprecationFlags(t *testing.T) {
|
|||||||
e2e.BeforeTest(t)
|
e2e.BeforeTest(t)
|
||||||
dataDirPath := t.TempDir()
|
dataDirPath := t.TempDir()
|
||||||
|
|
||||||
lastReleaseBinary := e2e.BinPath.EtcdLastRelease
|
if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) {
|
||||||
if !fileutil.Exist(lastReleaseBinary) {
|
t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease)
|
||||||
t.Skipf("%q does not exist", lastReleaseBinary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run("create-storev2-data", func(t *testing.T) {
|
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) {
|
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())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
lastReleaseBinary := e2e.BinPath.EtcdLastRelease
|
if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) {
|
||||||
currentReleaseBinary := e2e.BinPath.Etcd
|
t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease)
|
||||||
|
|
||||||
if !fileutil.Exist(lastReleaseBinary) {
|
|
||||||
t.Skipf("%q does not exist", lastReleaseBinary)
|
|
||||||
}
|
}
|
||||||
snapshotCount := 10
|
snapshotCount := 10
|
||||||
epc := runEtcdAndCreateSnapshot(t, lastReleaseBinary, 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, currentReleaseBinary, 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)
|
||||||
@ -140,13 +136,10 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
|
|||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
lastReleaseBinary := e2e.BinPath.EtcdLastRelease
|
if !fileutil.Exist(e2e.BinPath.EtcdLastRelease) {
|
||||||
currentReleaseBinary := e2e.BinPath.Etcd
|
t.Skipf("%q does not exist", e2e.BinPath.EtcdLastRelease)
|
||||||
|
|
||||||
if !fileutil.Exist(lastReleaseBinary) {
|
|
||||||
t.Skipf("%q does not exist", lastReleaseBinary)
|
|
||||||
}
|
}
|
||||||
epc := runEtcdAndCreateSnapshot(t, lastReleaseBinary, 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)
|
||||||
@ -158,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{ExecPath: currentReleaseBinary, 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)
|
||||||
|
|
||||||
@ -175,8 +168,8 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
|
|||||||
assert.NoError(t, epc.Close())
|
assert.NoError(t, epc.Close())
|
||||||
}
|
}
|
||||||
|
|
||||||
func runEtcdAndCreateSnapshot(t testing.TB, binary, 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{ExecPath: binary, 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)
|
||||||
return epc
|
return epc
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
|
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type TLSConfig string
|
type TLSConfig string
|
||||||
|
|
||||||
@ -34,6 +36,12 @@ type ClusterConfig struct {
|
|||||||
StrictReconfigCheck bool
|
StrictReconfigCheck bool
|
||||||
AuthToken string
|
AuthToken string
|
||||||
SnapshotCount int
|
SnapshotCount int
|
||||||
|
|
||||||
|
// 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 {
|
func DefaultClusterConfig() ClusterConfig {
|
||||||
|
@ -138,7 +138,7 @@ type EtcdProcessCluster struct {
|
|||||||
|
|
||||||
type EtcdProcessClusterConfig struct {
|
type EtcdProcessClusterConfig struct {
|
||||||
Logger *zap.Logger
|
Logger *zap.Logger
|
||||||
ExecPath string
|
Version ClusterVersion
|
||||||
DataDirPath string
|
DataDirPath string
|
||||||
KeepDataDir bool
|
KeepDataDir bool
|
||||||
EnvVars map[string]string
|
EnvVars map[string]string
|
||||||
@ -208,9 +208,6 @@ func InitEtcdProcessCluster(t testing.TB, cfg *EtcdProcessClusterConfig) (*EtcdP
|
|||||||
if cfg.BasePort == 0 {
|
if cfg.BasePort == 0 {
|
||||||
cfg.BasePort = EtcdProcessBasePort
|
cfg.BasePort = EtcdProcessBasePort
|
||||||
}
|
}
|
||||||
if cfg.ExecPath == "" {
|
|
||||||
cfg.ExecPath = BinPath.Etcd
|
|
||||||
}
|
|
||||||
if cfg.SnapshotCount == 0 {
|
if cfg.SnapshotCount == 0 {
|
||||||
cfg.SnapshotCount = etcdserver.DefaultSnapshotCount
|
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)
|
envVars["GOFAIL_HTTP"] = fmt.Sprintf("127.0.0.1:%d", gofailPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var execPath string
|
||||||
|
switch cfg.Version {
|
||||||
|
case CurrentVersion:
|
||||||
|
execPath = BinPath.Etcd
|
||||||
|
case MinorityLastVersion:
|
||||||
|
if i <= cfg.ClusterSize/2 {
|
||||||
|
execPath = BinPath.Etcd
|
||||||
|
} else {
|
||||||
|
execPath = BinPath.EtcdLastRelease
|
||||||
|
}
|
||||||
|
case QuorumLastVersion:
|
||||||
|
if i <= cfg.ClusterSize/2 {
|
||||||
|
execPath = BinPath.EtcdLastRelease
|
||||||
|
} else {
|
||||||
|
execPath = BinPath.Etcd
|
||||||
|
}
|
||||||
|
case LastVersion:
|
||||||
|
execPath = BinPath.EtcdLastRelease
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("Unknown cluster version %v", cfg.Version))
|
||||||
|
}
|
||||||
|
|
||||||
return &EtcdServerProcessConfig{
|
return &EtcdServerProcessConfig{
|
||||||
lg: cfg.Logger,
|
lg: cfg.Logger,
|
||||||
ExecPath: cfg.ExecPath,
|
ExecPath: execPath,
|
||||||
Args: args,
|
Args: args,
|
||||||
EnvVars: envVars,
|
EnvVars: envVars,
|
||||||
TlsArgs: cfg.TlsArgs(),
|
TlsArgs: cfg.TlsArgs(),
|
||||||
|
28
tests/framework/e2e/config.go
Normal file
28
tests/framework/e2e/config.go
Normal file
@ -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
|
||||||
|
}
|
@ -56,6 +56,12 @@ func (e e2eRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config.
|
|||||||
AuthTokenOpts: cfg.AuthToken,
|
AuthTokenOpts: cfg.AuthToken,
|
||||||
SnapshotCount: cfg.SnapshotCount,
|
SnapshotCount: cfg.SnapshotCount,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.ClusterContext != nil {
|
||||||
|
e2eClusterCtx := cfg.ClusterContext.(*ClusterContext)
|
||||||
|
e2eConfig.Version = e2eClusterCtx.Version
|
||||||
|
}
|
||||||
|
|
||||||
switch cfg.ClientTLS {
|
switch cfg.ClientTLS {
|
||||||
case config.NoTLS:
|
case config.NoTLS:
|
||||||
e2eConfig.ClientTLS = ClientNonTLS
|
e2eConfig.ClientTLS = ClientNonTLS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user