Skip to content

Commit

Permalink
fail in try block
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveCTurner committed Apr 15, 2019
1 parent 667cfd8 commit fb1f7eb
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -836,20 +836,18 @@ protected void shardOperationOnPrimary(Request shardRequest, IndexShard primary,

try {
listener.get();
if (throwExceptionOnRun || respondWithError) {
fail("expected exception, but none was thrown");
}
} catch (ExecutionException e) {
if (throwExceptionOnRun || respondWithError) {
Throwable cause = e.getCause();
assertThat(cause, instanceOf(ElasticsearchException.class));
assertThat(cause.getMessage(), containsString("simulated"));
return;
} else {
throw e;
}
}

if (throwExceptionOnRun || respondWithError) {
fail("expected exception, but none was thrown");
}
}

public void testReplicasCounter() {
Expand Down

0 comments on commit fb1f7eb

Please sign in to comment.