mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tests: Extend common test to run previous release
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
parent
b08209447a
commit
71b40b3abf
@ -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,52 @@ 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,
|
||||||
|
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 {
|
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()
|
||||||
|
@ -15,36 +15,14 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go.etcd.io/etcd/tests/v3/framework"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"go.etcd.io/etcd/tests/v3/framework/config"
|
"go.etcd.io/etcd/tests/v3/framework/config"
|
||||||
intf "go.etcd.io/etcd/tests/v3/framework/interfaces"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var testRunner intf.TestRunner
|
var testRunner = framework.UnitTestRunner
|
||||||
|
var clusterTestCases = func() []testCase { return nil }
|
||||||
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)),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
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()
|
||||||
|
@ -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
|
||||||
|
@ -27,6 +27,7 @@ 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"
|
||||||
)
|
)
|
||||||
@ -38,14 +39,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: config.LastVersion,
|
||||||
ClusterSize: 1,
|
ClusterSize: 1,
|
||||||
EnableV2: true,
|
EnableV2: true,
|
||||||
})
|
})
|
||||||
|
@ -23,21 +23,21 @@ 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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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 = config.LastVersion
|
||||||
copiedCfg.SnapshotCount = 3
|
copiedCfg.SnapshotCount = 3
|
||||||
copiedCfg.BaseScheme = "unix" // to avoid port conflict
|
copiedCfg.BaseScheme = "unix" // to avoid port conflict
|
||||||
|
|
||||||
@ -113,15 +113,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 = config.LastVersion
|
||||||
copiedCfg.SnapshotCount = 10
|
copiedCfg.SnapshotCount = 10
|
||||||
copiedCfg.BaseScheme = "unix"
|
copiedCfg.BaseScheme = "unix"
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ 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"
|
||||||
)
|
)
|
||||||
@ -35,10 +36,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 config.ClusterVersion
|
||||||
force bool
|
force bool
|
||||||
|
|
||||||
expectLogsSubString string
|
expectLogsSubString string
|
||||||
expectStorageVersion *semver.Version
|
expectStorageVersion *semver.Version
|
||||||
@ -69,13 +70,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: config.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: config.LastVersion,
|
||||||
targetVersion: "3.6",
|
targetVersion: "3.6",
|
||||||
expectStorageVersion: &version.V3_6,
|
expectStorageVersion: &version.V3_6,
|
||||||
},
|
},
|
||||||
@ -109,13 +110,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 != config.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: config.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, config.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, config.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, config.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: config.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 config.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,15 +14,23 @@
|
|||||||
|
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type TLSConfig string
|
type TLSConfig string
|
||||||
|
type ClusterVersion string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NoTLS TLSConfig = ""
|
NoTLS TLSConfig = ""
|
||||||
AutoTLS TLSConfig = "auto-tls"
|
AutoTLS TLSConfig = "auto-tls"
|
||||||
ManualTLS TLSConfig = "manual-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
|
TickDuration = 10 * time.Millisecond
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,6 +42,12 @@ type ClusterConfig struct {
|
|||||||
StrictReconfigCheck bool
|
StrictReconfigCheck bool
|
||||||
AuthToken string
|
AuthToken string
|
||||||
SnapshotCount int
|
SnapshotCount int
|
||||||
|
|
||||||
|
E2eConfig *E2eClusterConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
type E2eClusterConfig struct {
|
||||||
|
Version ClusterVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
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 config.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 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{
|
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(),
|
||||||
|
@ -56,6 +56,9 @@ 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.E2eConfig != nil {
|
||||||
|
e2eConfig.Version = cfg.E2eConfig.Version
|
||||||
|
}
|
||||||
switch cfg.ClientTLS {
|
switch cfg.ClientTLS {
|
||||||
case config.NoTLS:
|
case config.NoTLS:
|
||||||
e2eConfig.ClientTLS = ClientNonTLS
|
e2eConfig.ClientTLS = ClientNonTLS
|
||||||
|
@ -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 {
|
func (e integrationRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config.ClusterOption) intf.Cluster {
|
||||||
var err error
|
var err error
|
||||||
cfg := config.NewClusterConfig(opts...)
|
cfg := config.NewClusterConfig(opts...)
|
||||||
|
if cfg.E2eConfig != nil {
|
||||||
|
t.Fatalf("E2e configuration not expected during integration tests, config: %+v", cfg)
|
||||||
|
}
|
||||||
integrationCfg := ClusterConfig{
|
integrationCfg := ClusterConfig{
|
||||||
Size: cfg.ClusterSize,
|
Size: cfg.ClusterSize,
|
||||||
QuotaBackendBytes: cfg.QuotaBackendBytes,
|
QuotaBackendBytes: cfg.QuotaBackendBytes,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user