@@ -32,24 +32,34 @@ import (
32
32
// by old leader.
33
33
// See the case 1 in https://github.com/etcd-io/etcd/issues/15247#issuecomment-1777862093.
34
34
func TestLeaseRevoke_IgnoreOldLeader (t * testing.T ) {
35
- testLeaseRevokeIssue (t , true )
35
+ t .Run ("3 members" , func (t * testing.T ) {
36
+ testLeaseRevokeIssue (t , 3 , true )
37
+ })
38
+ t .Run ("5 members" , func (t * testing.T ) {
39
+ testLeaseRevokeIssue (t , 5 , true )
40
+ })
36
41
}
37
42
38
43
// TestLeaseRevoke_ClientSwitchToOtherMember verifies that leases shouldn't
39
44
// be revoked by new leader.
40
45
// See the case 2 in https://github.com/etcd-io/etcd/issues/15247#issuecomment-1777862093.
41
46
func TestLeaseRevoke_ClientSwitchToOtherMember (t * testing.T ) {
42
- testLeaseRevokeIssue (t , false )
47
+ t .Run ("3 members" , func (t * testing.T ) {
48
+ testLeaseRevokeIssue (t , 3 , false )
49
+ })
50
+ t .Run ("5 members" , func (t * testing.T ) {
51
+ testLeaseRevokeIssue (t , 5 , false )
52
+ })
43
53
}
44
54
45
- func testLeaseRevokeIssue (t * testing.T , connectToOneFollower bool ) {
55
+ func testLeaseRevokeIssue (t * testing.T , clusterSize int , connectToOneFollower bool ) {
46
56
e2e .BeforeTest (t )
47
57
48
58
ctx := context .Background ()
49
59
50
60
t .Log ("Starting a new etcd cluster" )
51
61
epc , err := e2e .NewEtcdProcessCluster (ctx , t ,
52
- e2e .WithClusterSize (3 ),
62
+ e2e .WithClusterSize (clusterSize ),
53
63
e2e .WithGoFailEnabled (true ),
54
64
e2e .WithGoFailClientTimeout (40 * time .Second ),
55
65
)
@@ -63,15 +73,15 @@ func testLeaseRevokeIssue(t *testing.T, connectToOneFollower bool) {
63
73
leaderIdx := epc .WaitLeader (t )
64
74
t .Logf ("Leader index: %d" , leaderIdx )
65
75
66
- epsForNormalOperations := epc .Procs [(leaderIdx + 2 )% 3 ].EndpointsGRPC ()
76
+ epsForNormalOperations := epc .Procs [(leaderIdx + 2 )% clusterSize ].EndpointsGRPC ()
67
77
t .Logf ("Creating a client for normal operations: %v" , epsForNormalOperations )
68
78
client , err := clientv3 .New (clientv3.Config {Endpoints : epsForNormalOperations , DialTimeout : 3 * time .Second })
69
79
require .NoError (t , err )
70
80
defer client .Close ()
71
81
72
82
var epsForLeaseKeepAlive []string
73
83
if connectToOneFollower {
74
- epsForLeaseKeepAlive = epc .Procs [(leaderIdx + 1 )% 3 ].EndpointsGRPC ()
84
+ epsForLeaseKeepAlive = epc .Procs [(leaderIdx + 1 )% clusterSize ].EndpointsGRPC ()
75
85
} else {
76
86
epsForLeaseKeepAlive = epc .EndpointsGRPC ()
77
87
}
0 commit comments