@@ -263,12 +263,11 @@ public void testReceiveRetryableError() {
263
263
int max = randomIntBetween (1 , 30 );
264
264
final Exception [] exceptions = new Exception [max ];
265
265
for (int i = 0 ; i < max ; i ++) {
266
- final Exception exception ;
267
- if (randomBoolean ()) {
268
- exception = new ShardNotFoundException (new ShardId ("leader_index" , "" , 0 ));
269
- } else {
270
- exception = new EsRejectedExecutionException ("leader_index rejected" );
271
- }
266
+ final Exception exception = randomFrom (
267
+ new ShardNotFoundException (new ShardId ("leader_index" , "" , 0 )),
268
+ new EsRejectedExecutionException ("leader_index rejected" ),
269
+ new IllegalStateException ("no seed node left" )
270
+ );
272
271
exceptions [i ] = exception ;
273
272
readFailures .add (exception );
274
273
}
@@ -286,16 +285,21 @@ public void testReceiveRetryableError() {
286
285
final Map .Entry <Long , Tuple <Integer , ElasticsearchException >> entry = status .readExceptions ().entrySet ().iterator ().next ();
287
286
assertThat (entry .getValue ().v1 (), equalTo (Math .toIntExact (retryCounter .get ())));
288
287
assertThat (entry .getKey (), equalTo (0L ));
289
- if (exceptions [Math .toIntExact (retryCounter .get ()) - 1 ] instanceof ShardNotFoundException ) {
288
+ final Exception error = exceptions [Math .toIntExact (retryCounter .get ()) - 1 ];
289
+ if (error instanceof ShardNotFoundException ) {
290
290
assertThat (entry .getValue ().v2 (), instanceOf (ShardNotFoundException .class ));
291
291
final ShardNotFoundException shardNotFoundException = (ShardNotFoundException ) entry .getValue ().v2 ();
292
292
assertThat (shardNotFoundException .getShardId ().getIndexName (), equalTo ("leader_index" ));
293
293
assertThat (shardNotFoundException .getShardId ().getId (), equalTo (0 ));
294
- } else {
294
+ } else if ( error instanceof EsRejectedExecutionException ) {
295
295
assertThat (entry .getValue ().v2 ().getCause (), instanceOf (EsRejectedExecutionException .class ));
296
296
final EsRejectedExecutionException rejectedExecutionException =
297
297
(EsRejectedExecutionException ) entry .getValue ().v2 ().getCause ();
298
298
assertThat (rejectedExecutionException .getMessage (), equalTo ("leader_index rejected" ));
299
+ } else {
300
+ assertThat (entry .getValue ().v2 ().getCause (), instanceOf (IllegalStateException .class ));
301
+ final IllegalStateException noSeedError = (IllegalStateException ) entry .getValue ().v2 ().getCause ();
302
+ assertThat (noSeedError .getMessage (), equalTo ("no seed node left" ));
299
303
}
300
304
}
301
305
retryCounter .incrementAndGet ();
0 commit comments