@@ -57,7 +57,7 @@ const (
5757 redisPort = 63790
5858
5959 // followers wait longer before starting elections to give the leader time to bootstrap and share config.
60- followerElectionTimeout = 30 * time .Second
60+ followerElectionTimeout = 10 * time .Second
6161)
6262
6363var mu sync.Mutex
@@ -125,32 +125,13 @@ func createNode(t *testing.T, n int) ([]Node, []string, []string) {
125125 cfg := buildRaftConfig (n , ports )
126126 nodes , grpcAdders , redisAdders := setupNodes (t , ctx , n , ports , cfg )
127127
128- bootstrapFollowers (t , cfg , nodes )
129128 waitForNodeListeners (t , ctx , nodes , waitTimeout , waitInterval )
130129 waitForConfigReplication (t , cfg , nodes , waitTimeout , waitInterval )
131130 waitForRaftReadiness (t , nodes , waitTimeout , waitInterval )
132131
133132 return nodes , grpcAdders , redisAdders
134133}
135134
136- func bootstrapFollowers (t * testing.T , cfg raft.Configuration , nodes []Node ) {
137- t .Helper ()
138- for i , n := range nodes {
139- if i == 0 {
140- continue
141- }
142-
143- future := n .raft .GetConfiguration ()
144- assert .NoError (t , future .Error ())
145- if len (future .Configuration ().Servers ) != 0 {
146- continue
147- }
148-
149- boot := n .raft .BootstrapCluster (cfg )
150- assert .NoError (t , boot .Error ())
151- }
152- }
153-
154135func waitForNodeListeners (t * testing.T , ctx context.Context , nodes []Node , waitTimeout , waitInterval time.Duration ) {
155136 t .Helper ()
156137 d := & net.Dialer {Timeout : time .Second }
@@ -255,7 +236,7 @@ func buildRaftConfig(n int, ports []portsAdress) raft.Configuration {
255236 return cfg
256237}
257238
258- const leaderElectionTimeout = 10 * time .Second
239+ const leaderElectionTimeout = 0 * time .Second
259240
260241func setupNodes (t * testing.T , ctx context.Context , n int , ports []portsAdress , cfg raft.Configuration ) ([]Node , []string , []string ) {
261242 t .Helper ()
0 commit comments