@@ -1908,7 +1908,7 @@ void shouldRejectTakeSnapshotRequestWithAnAuthorisationError()
19081908 }
19091909
19101910 long time = System .nanoTime ();
1911- final long deadline = time + SECONDS . toNanos ( 2 );
1911+ final long deadline = time + leader . consensusModule (). context (). leaderHeartbeatTimeoutNs ( );
19121912 do
19131913 {
19141914 assertEquals (0 , cluster .getSnapshotCount (leader ));
@@ -2431,13 +2431,14 @@ public void onSessionMessage(
24312431 }
24322432
24332433 @ Test
2434- @ InterruptAfter (90 )
2434+ @ InterruptAfter (30 )
24352435 void shouldCatchupAndJoinAsFollowerWhileSendingBigMessages ()
24362436 {
24372437 cluster = aCluster ().withStaticNodes (3 ).start ();
24382438 systemTestWatcher .cluster (cluster );
24392439
24402440 TestNode leader = cluster .awaitLeader ();
2441+ final long leaderHeartbeatTimeoutNs = leader .consensusModule ().context ().leaderHeartbeatTimeoutNs ();
24412442 final int leaderId = leader .consensusModule ().context ().clusterMemberId ();
24422443 assertEquals (1 , leader .consensusModule ().context ().electionCounter ().get ());
24432444 final List <TestNode > followers = cluster .followers ();
@@ -2459,15 +2460,15 @@ void shouldCatchupAndJoinAsFollowerWhileSendingBigMessages()
24592460 follower2 = follower1 ;
24602461 follower1 = tmp ;
24612462 }
2462- final int follower1Id = follower1 .consensusModule (). context (). clusterMemberId ();
2463- final int follower2Id = follower2 .consensusModule (). context (). clusterMemberId ();
2463+ final int follower1Id = follower1 .memberId ();
2464+ final int follower2Id = follower2 .memberId ();
24642465 assertNotEquals (leaderId , follower1Id );
24652466 assertNotEquals (leaderId , follower2Id );
24662467 assertNotEquals (follower1Id , follower2Id );
24672468
24682469 cluster .stopNode (follower2 );
24692470 long startNs = System .nanoTime ();
2470- long endNs = startNs + SECONDS . toNanos ( 10 ) ;
2471+ long endNs = startNs + leaderHeartbeatTimeoutNs ;
24712472 final int messageLength = cluster .msgBuffer ().putStringWithoutLengthAscii (0 , LARGE_MSG );
24722473 while (System .nanoTime () < endNs )
24732474 {
@@ -2479,15 +2480,15 @@ void shouldCatchupAndJoinAsFollowerWhileSendingBigMessages()
24792480 follower2 = cluster .startStaticNode (follower2 .index (), false );
24802481 leader = cluster .awaitLeader ();
24812482 follower1 = cluster .followers ().stream ()
2482- .filter (f -> follower1Id == f .consensusModule (). context (). clusterMemberId ())
2483+ .filter (f -> follower1Id == f .memberId ())
24832484 .findFirst ()
24842485 .orElse (null );
2485- assertEquals ( leaderId , leader . consensusModule (). context (). clusterMemberId (), "leader changed" );
2486- assertEquals (follower2Id , follower2 . consensusModule (). context (). clusterMemberId () , "wrong follower restarted " );
2487- assertNotNull ( follower1 , "first follower not found " );
2486+ assertNotNull ( follower1 );
2487+ assertEquals (leaderId , leader . memberId () , "leader changed " );
2488+ assertEquals ( follower2Id , follower2 . memberId (), "wrong follower restarted " );
24882489
24892490 startNs = System .nanoTime ();
2490- endNs = startNs + SECONDS . toNanos ( 30 ) ;
2491+ endNs = startNs + 3 * leaderHeartbeatTimeoutNs ;
24912492 while (System .nanoTime () < endNs )
24922493 {
24932494 cluster .pollUntilMessageSent (messageLength );
0 commit comments