@@ -321,15 +321,16 @@ public void testInitializeAsResignedAndUnableToContactQuorum(boolean withKip853R
321
321
assertEquals (0L , context .log .endOffset ().offset ());
322
322
context .assertElectedLeader (epoch , localId );
323
323
324
- // Election timeout
325
- context .time .sleep (context .electionTimeoutMs () );
324
+ // fetch timeout
325
+ context .time .sleep (context .fetchTimeoutMs );
326
326
context .client .poll ();
327
327
328
328
// Become unattached with expired election timeout
329
329
assertTrue (context .client .quorum ().isUnattached ());
330
330
assertEquals (epoch + 1 , context .currentEpoch ());
331
331
332
- // Become prospective immediately
332
+ // Become prospective after the fetch timeout
333
+ context .time .sleep (context .fetchTimeoutMs );
333
334
context .client .poll ();
334
335
assertTrue (context .client .quorum ().isProspective ());
335
336
@@ -763,15 +764,15 @@ public void testElectionTimeoutAfterUserInitiatedResign(boolean withKip853Rpc) t
763
764
OptionalInt .of (localId )
764
765
);
765
766
766
- // After the election timer , local should become unattached.
767
- context .time .sleep (2L * context .electionTimeoutMs () );
767
+ // After the fetch timeout , local should become unattached.
768
+ context .time .sleep (context .fetchTimeoutMs );
768
769
context .pollUntil (context .client .quorum ()::isUnattached );
769
770
assertEquals (resignedEpoch + 1 , context .currentEpoch ());
770
771
assertEquals (new LeaderAndEpoch (OptionalInt .empty (), resignedEpoch + 1 ),
771
772
context .listener .currentLeaderAndEpoch ());
772
773
773
- // Local will become prospective right away
774
774
assertEquals (0 , context .client .quorum ().unattachedStateOrThrow ().electionTimeoutMs ());
775
+ context .time .sleep (context .fetchTimeoutMs );
775
776
context .client .poll ();
776
777
assertTrue (context .client .quorum ().isProspective ());
777
778
}
@@ -886,8 +887,8 @@ public void testInitializeAsUnattachedAndBecomeLeader(boolean withKip853Rpc) thr
886
887
assertTrue (context .client .quorum ().isUnattached ());
887
888
assertTrue (context .client .quorum ().isVoter ());
888
889
889
- // after election timeout should become prospective
890
- context .time .sleep (context .electionTimeoutMs () * 2L );
890
+ // after fetch timeout should become prospective
891
+ context .time .sleep (context .fetchTimeoutMs );
891
892
context .pollUntilRequest ();
892
893
assertTrue (context .client .quorum ().isProspective ());
893
894
@@ -1604,7 +1605,7 @@ public void testHandleVoteRequestAsProspectiveWithVotedCandidate(boolean withKip
1604
1605
.build ();
1605
1606
1606
1607
// Sleep a little to ensure that we become a prospective
1607
- context .time .sleep (context .electionTimeoutMs () * 2L );
1608
+ context .time .sleep (context .fetchTimeoutMs );
1608
1609
context .client .poll ();
1609
1610
assertTrue (context .client .quorum ().isProspectiveAndVoted ());
1610
1611
context .assertVotedCandidate (epoch , votedCandidateKey .id ());
@@ -4113,7 +4114,7 @@ public void testClusterAuthorizationFailedInBeginQuorumEpoch(boolean withKip853R
4113
4114
.withKip853Rpc (withKip853Rpc )
4114
4115
.build ();
4115
4116
4116
- context .time .sleep (context .electionTimeoutMs () );
4117
+ context .time .sleep (context .fetchTimeoutMs );
4117
4118
context .expectAndGrantPreVotes (epoch - 1 );
4118
4119
context .expectAndGrantVotes (epoch );
4119
4120
0 commit comments