Skip to content

Commit

Permalink
Fix testInvalidScrollKeepAlive
Browse files Browse the repository at this point in the history
  • Loading branch information
dnhatn committed Sep 9, 2020
1 parent 607b7c3 commit 7af2fec
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -610,16 +610,19 @@ public void testInvalidScrollKeepAlive() throws IOException {
.setScroll(TimeValue.timeValueMinutes(5))
.get();
assertNotNull(searchResponse.getScrollId());
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L));
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
try {
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L));
assertThat(searchResponse.getHits().getHits().length, equalTo(1));

exc = expectThrows(Exception.class,
() -> client().prepareSearchScroll(searchResponse.getScrollId())
.setScroll(TimeValue.timeValueHours(3)).get());
illegalArgumentException =
(IllegalArgumentException) ExceptionsHelper.unwrap(exc, IllegalArgumentException.class);
assertNotNull(illegalArgumentException);
assertThat(illegalArgumentException.getMessage(), containsString("Keep alive for request (3h) is too large"));
exc = expectThrows(Exception.class,
() -> client().prepareSearchScroll(searchResponse.getScrollId()).setScroll(TimeValue.timeValueHours(3)).get());
illegalArgumentException =
(IllegalArgumentException) ExceptionsHelper.unwrap(exc, IllegalArgumentException.class);
assertNotNull(illegalArgumentException);
assertThat(illegalArgumentException.getMessage(), containsString("Keep alive for request (3h) is too large"));
} finally {
client().prepareClearScroll().addScrollId(searchResponse.getScrollId()).get();
}
}

/**
Expand Down

0 comments on commit 7af2fec

Please sign in to comment.