@@ -165,6 +165,7 @@ public void testFailsNodeThatDoesNotRespond() {
165165 final Settings settings = settingsBuilder .build ();
166166
167167 testBehaviourOfFailingNode (settings , () -> null ,
168+ "followers check retry count exceeded" ,
168169 (FOLLOWER_CHECK_RETRY_COUNT_SETTING .get (settings ) - 1 ) * FOLLOWER_CHECK_INTERVAL_SETTING .get (settings ).millis ()
169170 + FOLLOWER_CHECK_RETRY_COUNT_SETTING .get (settings ) * FOLLOWER_CHECK_TIMEOUT_SETTING .get (settings ).millis ());
170171 }
@@ -182,6 +183,7 @@ public void testFailsNodeThatRejectsCheck() {
182183 testBehaviourOfFailingNode (settings , () -> {
183184 throw new ElasticsearchException ("simulated exception" );
184185 },
186+ "followers check retry count exceeded" ,
185187 (FOLLOWER_CHECK_RETRY_COUNT_SETTING .get (settings ) - 1 ) * FOLLOWER_CHECK_INTERVAL_SETTING .get (settings ).millis ());
186188 }
187189
@@ -213,14 +215,15 @@ public Empty get() {
213215 throw new ElasticsearchException ("simulated exception" );
214216 }
215217 },
218+ "followers check retry count exceeded" ,
216219 (FOLLOWER_CHECK_RETRY_COUNT_SETTING .get (settings ) * (maxRecoveries + 1 ) - 1 )
217220 * FOLLOWER_CHECK_INTERVAL_SETTING .get (settings ).millis ());
218221 }
219222
220223 public void testFailsNodeThatIsDisconnected () {
221224 testBehaviourOfFailingNode (Settings .EMPTY , () -> {
222225 throw new ConnectTransportException (null , "simulated exception" );
223- }, 0 );
226+ }, "disconnected" , 0 );
224227 }
225228
226229 public void testFailsNodeThatDisconnects () {
@@ -262,6 +265,7 @@ public String toString() {
262265 assert false : fcr ;
263266 }, (node , reason ) -> {
264267 assertTrue (nodeFailed .compareAndSet (false , true ));
268+ assertThat (reason , equalTo ("disconnected" ));
265269 });
266270
267271 DiscoveryNodes discoveryNodes = DiscoveryNodes .builder ().add (localNode ).add (otherNode ).localNodeId (localNode .getId ()).build ();
@@ -274,7 +278,8 @@ public String toString() {
274278 assertThat (followersChecker .getFaultyNodes (), contains (otherNode ));
275279 }
276280
277- private void testBehaviourOfFailingNode (Settings testSettings , Supplier <TransportResponse .Empty > responder , long expectedFailureTime ) {
281+ private void testBehaviourOfFailingNode (Settings testSettings , Supplier <TransportResponse .Empty > responder , String failureReason ,
282+ long expectedFailureTime ) {
278283 final DiscoveryNode localNode = new DiscoveryNode ("local-node" , buildNewFakeTransportAddress (), Version .CURRENT );
279284 final DiscoveryNode otherNode = new DiscoveryNode ("other-node" , buildNewFakeTransportAddress (), Version .CURRENT );
280285 final Settings settings = Settings .builder ().put (NODE_NAME_SETTING .getKey (), localNode .getName ()).put (testSettings ).build ();
@@ -321,6 +326,7 @@ public String toString() {
321326 assert false : fcr ;
322327 }, (node , reason ) -> {
323328 assertTrue (nodeFailed .compareAndSet (false , true ));
329+ assertThat (reason , equalTo (failureReason ));
324330 });
325331
326332 DiscoveryNodes discoveryNodes = DiscoveryNodes .builder ().add (localNode ).add (otherNode ).localNodeId (localNode .getId ()).build ();
0 commit comments