Skip to content

Commit

Permalink
move heavy test to IT
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Khludnev <mkhl@apache.org>
  • Loading branch information
mkhludnev committed Nov 27, 2024
1 parent 7aa15da commit f6e8303
Showing 1 changed file with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void testLessThanMaxClauses() throws IOException {
assertTermsHitCount(indexName, "addr.idx", toQuery, expectMatches);
assertTermsHitCount(indexName, "addr.dv", toQuery, expectMatches);
// passing dummy filter crushes on rewriting
try {
SearchPhaseExecutionException ose = assertThrows(SearchPhaseExecutionException.class, () -> {
assertTermsHitCount(
indexName,
"addr.dv",
Expand All @@ -120,10 +120,8 @@ public void testLessThanMaxClauses() throws IOException {
.filter(QueryBuilders.termsQuery("dummy_filter", "1", "2", "3", "4"))
.filter(QueryBuilders.termsQuery("dummy_filter", "1", "2", "3", "4", "5"))
);
fail();
} catch (SearchPhaseExecutionException ose) {
assertTrue("exceeding on query rewrite", ose.shardFailures()[0].getCause() instanceof IndexSearcher.TooManyNestedClauses);
}
});
assertTrue("exceeding on query rewrite", ose.shardFailures()[0].getCause() instanceof IndexSearcher.TooManyNestedClauses);
}

public void testExceedMaxClauses() throws IOException {
Expand All @@ -132,16 +130,12 @@ public void testExceedMaxClauses() throws IOException {
int expectMatches = createIndex(indexName, IndexSearcher.getMaxClauseCount() + (rarely() ? 0 : atLeast(10)), toQuery);
assertTermsHitCount(indexName, "addr", toQuery, expectMatches);
assertTermsHitCount(indexName, "addr.idx", toQuery, expectMatches);
try { // error from mapper/parser
final SearchPhaseExecutionException ose = assertThrows(
SearchPhaseExecutionException.class,
() -> assertTermsHitCount(indexName, "addr.dv", toQuery, expectMatches)
);
assertTrue("exceeding on query building", ose.shardFailures()[0].getCause().getCause() instanceof IndexSearcher.TooManyClauses);
fail();
} catch (SearchPhaseExecutionException ose) {
assertTrue("exceeding on query building", ose.shardFailures()[0].getCause().getCause() instanceof IndexSearcher.TooManyClauses);
}
// error from mapper/parser
final SearchPhaseExecutionException ose = assertThrows(
SearchPhaseExecutionException.class,
() -> assertTermsHitCount(indexName, "addr.dv", toQuery, expectMatches)
);
assertTrue("exceeding on query building", ose.shardFailures()[0].getCause().getCause() instanceof IndexSearcher.TooManyClauses);
}

private static String getFirstThreeOctets(String ipAddress) {
Expand Down

0 comments on commit f6e8303

Please sign in to comment.