Skip to content

Commit

Permalink
tests: fix failed integration test cases after enabling `--strict-rec…
Browse files Browse the repository at this point in the history
…onfig-check` by default

Signed-off-by: Clark <[email protected]>
  • Loading branch information
clement2026 committed Aug 31, 2022
1 parent 7e753a0 commit e9a26a9
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 25 deletions.
6 changes: 3 additions & 3 deletions tests/e2e/ctl_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ func dialWithSchemeTest(cx ctlCtx) {
}

type ctlCtx struct {
t *testing.T
apiPrefix string
cfg e2e.EtcdProcessClusterConfig
t *testing.T
apiPrefix string
cfg e2e.EtcdProcessClusterConfig

corruptFunc func(string) error
disableStrictReconfigCheck bool
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/clientv3/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestMemberList(t *testing.T) {
func TestMemberAdd(t *testing.T) {
integration2.BeforeTest(t)

clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3})
clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3, DisableStrictReconfigCheck: true})
defer clus.Terminate(t)

capi := clus.RandClient()
Expand All @@ -67,7 +67,7 @@ func TestMemberAdd(t *testing.T) {
func TestMemberAddWithExistingURLs(t *testing.T) {
integration2.BeforeTest(t)

clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3})
clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3, DisableStrictReconfigCheck: true})
defer clus.Terminate(t)

capi := clus.RandClient()
Expand All @@ -91,7 +91,7 @@ func TestMemberAddWithExistingURLs(t *testing.T) {
func TestMemberRemove(t *testing.T) {
integration2.BeforeTest(t)

clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3})
clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3, DisableStrictReconfigCheck: true})
defer clus.Terminate(t)

capi := clus.Client(1)
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestMemberAddUpdateWrongURLs(t *testing.T) {
func TestMemberAddForLearner(t *testing.T) {
integration2.BeforeTest(t)

clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3})
clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3, DisableStrictReconfigCheck: true})
defer clus.Terminate(t)

capi := clus.RandClient()
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestMemberAddForLearner(t *testing.T) {
func TestMemberPromote(t *testing.T) {
integration2.BeforeTest(t)

clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3})
clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3, DisableStrictReconfigCheck: true})
defer clus.Terminate(t)

// member promote request can be sent to any server in cluster,
Expand Down Expand Up @@ -382,7 +382,7 @@ func TestMaxLearnerInCluster(t *testing.T) {
integration2.BeforeTest(t)

// 1. start with a cluster with 3 voting member and max learner 2
clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3, ExperimentalMaxLearners: 2})
clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3, ExperimentalMaxLearners: 2, DisableStrictReconfigCheck: true})
defer clus.Terminate(t)

// 2. adding 2 learner members should succeed
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/clientv3/examples/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const (
var lazyCluster = integration.NewLazyClusterWithConfig(
integration2.ClusterConfig{
Size: 3,
WatchProgressNotifyInterval: 200 * time.Millisecond})
WatchProgressNotifyInterval: 200 * time.Millisecond,
DisableStrictReconfigCheck: true})

func exampleEndpoints() []string { return lazyCluster.EndpointsV3() }

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/clientv3/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ func TestKVLargeRequests(t *testing.T) {
func TestKVForLearner(t *testing.T) {
integration2.BeforeTest(t)

clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3})
clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3, DisableStrictReconfigCheck: true})
defer clus.Terminate(t)

// we have to add and launch learner member after initial cluster was created, because
Expand Down Expand Up @@ -855,7 +855,7 @@ func TestKVForLearner(t *testing.T) {
func TestBalancerSupportLearner(t *testing.T) {
integration2.BeforeTest(t)

clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3})
clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 3, DisableStrictReconfigCheck: true})
defer clus.Terminate(t)

// we have to add and launch learner member after initial cluster was created, because
Expand Down
21 changes: 13 additions & 8 deletions tests/integration/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestDoubleClusterSizeOf3(t *testing.T) { testDoubleClusterSize(t, 3) }

func testDoubleClusterSize(t *testing.T, size int) {
integration.BeforeTest(t)
c := integration.NewCluster(t, &integration.ClusterConfig{Size: size})
c := integration.NewCluster(t, &integration.ClusterConfig{Size: size, DisableStrictReconfigCheck: true})
defer c.Terminate(t)

for i := 0; i < size; i++ {
Expand All @@ -83,7 +83,12 @@ func testDoubleClusterSize(t *testing.T, size int) {

func TestDoubleTLSClusterSizeOf3(t *testing.T) {
integration.BeforeTest(t)
c := integration.NewCluster(t, &integration.ClusterConfig{Size: 1, PeerTLS: &integration.TestTLSInfo})
cfg := &integration.ClusterConfig{
Size: 1,
PeerTLS: &integration.TestTLSInfo,
DisableStrictReconfigCheck: true,
}
c := integration.NewCluster(t, cfg)
defer c.Terminate(t)

for i := 0; i < 3; i++ {
Expand All @@ -97,7 +102,7 @@ func TestDecreaseClusterSizeOf5(t *testing.T) { testDecreaseClusterSize(t, 5) }

func testDecreaseClusterSize(t *testing.T, size int) {
integration.BeforeTest(t)
c := integration.NewCluster(t, &integration.ClusterConfig{Size: size})
c := integration.NewCluster(t, &integration.ClusterConfig{Size: size, DisableStrictReconfigCheck: true})
defer c.Terminate(t)

// TODO: remove the last but one member
Expand Down Expand Up @@ -175,7 +180,7 @@ func TestForceNewCluster(t *testing.T) {

func TestAddMemberAfterClusterFullRotation(t *testing.T) {
integration.BeforeTest(t)
c := integration.NewCluster(t, &integration.ClusterConfig{Size: 3})
c := integration.NewCluster(t, &integration.ClusterConfig{Size: 3, DisableStrictReconfigCheck: true})
defer c.Terminate(t)

// remove all the previous three members and add in three new members.
Expand All @@ -198,7 +203,7 @@ func TestAddMemberAfterClusterFullRotation(t *testing.T) {
// Ensure we can remove a member then add a new one back immediately.
func TestIssue2681(t *testing.T) {
integration.BeforeTest(t)
c := integration.NewCluster(t, &integration.ClusterConfig{Size: 5})
c := integration.NewCluster(t, &integration.ClusterConfig{Size: 5, DisableStrictReconfigCheck: true})
defer c.Terminate(t)

if err := c.RemoveMember(t, c.Members[0].Client, uint64(c.Members[4].Server.MemberId())); err != nil {
Expand All @@ -219,7 +224,7 @@ func TestIssue2746WithThree(t *testing.T) { testIssue2746(t, 3) }

func testIssue2746(t *testing.T, members int) {
integration.BeforeTest(t)
c := integration.NewCluster(t, &integration.ClusterConfig{Size: members, SnapshotCount: 10})
c := integration.NewCluster(t, &integration.ClusterConfig{Size: members, SnapshotCount: 10, DisableStrictReconfigCheck: true})
defer c.Terminate(t)

// force a snapshot
Expand All @@ -241,7 +246,7 @@ func testIssue2746(t *testing.T, members int) {
func TestIssue2904(t *testing.T) {
integration.BeforeTest(t)
// start 1-member Cluster to ensure member 0 is the leader of the Cluster.
c := integration.NewCluster(t, &integration.ClusterConfig{Size: 2, UseBridge: true})
c := integration.NewCluster(t, &integration.ClusterConfig{Size: 2, UseBridge: true, DisableStrictReconfigCheck: true})
defer c.Terminate(t)
c.WaitLeader(t)

Expand Down Expand Up @@ -276,7 +281,7 @@ func TestIssue2904(t *testing.T) {
func TestIssue3699(t *testing.T) {
// start a Cluster of 3 nodes a, b, c
integration.BeforeTest(t)
c := integration.NewCluster(t, &integration.ClusterConfig{Size: 3, UseBridge: true})
c := integration.NewCluster(t, &integration.ClusterConfig{Size: 3, UseBridge: true, DisableStrictReconfigCheck: true})
defer c.Terminate(t)

// make node a unavailable
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/v3_alarm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,11 @@ func TestV3CorruptAlarmWithLeaseCorrupted(t *testing.T) {
integration.BeforeTest(t)
lg := zaptest.NewLogger(t)
clus := integration.NewCluster(t, &integration.ClusterConfig{
CorruptCheckTime: time.Second,
Size: 3,
SnapshotCount: 10,
SnapshotCatchUpEntries: 5,
CorruptCheckTime: time.Second,
Size: 3,
SnapshotCount: 10,
SnapshotCatchUpEntries: 5,
DisableStrictReconfigCheck: true,
})
defer clus.Terminate(t)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/v3_leadership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func TestMoveLeaderError(t *testing.T) {
func TestMoveLeaderToLearnerError(t *testing.T) {
integration.BeforeTest(t)

clus := integration.NewCluster(t, &integration.ClusterConfig{Size: 3})
clus := integration.NewCluster(t, &integration.ClusterConfig{Size: 3, DisableStrictReconfigCheck: true})
defer clus.Terminate(t)

// we have to add and launch learner member after initial cluster was created, because
Expand Down

0 comments on commit e9a26a9

Please sign in to comment.