Disable cache on QueryProfilerIT (#38748)
- Disables the request cache on the test, to prevent cached values from potentially interfering with test results - Changes the test to execute a single query, in hopes of making failures more reproducible Backport of #38583
This commit is contained in:
parent
a3f39741be
commit
57f69082fd
|
@ -105,11 +105,10 @@ public class QueryProfilerIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This test generates 1-10 random queries and executes a profiled and non-profiled
|
* This test generates a random query and executes a profiled and non-profiled
|
||||||
* search for each query. It then does some basic sanity checking of score and hits
|
* search for each query. It then does some basic sanity checking of score and hits
|
||||||
* to make sure the profiling doesn't interfere with the hits being returned
|
* to make sure the profiling doesn't interfere with the hits being returned
|
||||||
*/
|
*/
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32492")
|
|
||||||
public void testProfileMatchesRegular() throws Exception {
|
public void testProfileMatchesRegular() throws Exception {
|
||||||
createIndex("test");
|
createIndex("test");
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -129,22 +128,22 @@ public class QueryProfilerIT extends ESIntegTestCase {
|
||||||
indexRandom(true, docs);
|
indexRandom(true, docs);
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
int iters = between(1, 10);
|
|
||||||
for (int i = 0; i < iters; i++) {
|
|
||||||
QueryBuilder q = randomQueryBuilder(stringFields, numericFields, numDocs, 3);
|
QueryBuilder q = randomQueryBuilder(stringFields, numericFields, numDocs, 3);
|
||||||
logger.info("Query: {}", q);
|
logger.debug("Query: {}", q);
|
||||||
|
|
||||||
SearchRequestBuilder vanilla = client().prepareSearch("test")
|
SearchRequestBuilder vanilla = client().prepareSearch("test")
|
||||||
.setQuery(q)
|
.setQuery(q)
|
||||||
.setProfile(false)
|
.setProfile(false)
|
||||||
.addSort("_id", SortOrder.ASC)
|
.addSort("_id", SortOrder.ASC)
|
||||||
.setSearchType(SearchType.QUERY_THEN_FETCH);
|
.setSearchType(SearchType.QUERY_THEN_FETCH)
|
||||||
|
.setRequestCache(false);
|
||||||
|
|
||||||
SearchRequestBuilder profile = client().prepareSearch("test")
|
SearchRequestBuilder profile = client().prepareSearch("test")
|
||||||
.setQuery(q)
|
.setQuery(q)
|
||||||
.setProfile(true)
|
.setProfile(true)
|
||||||
.addSort("_id", SortOrder.ASC)
|
.addSort("_id", SortOrder.ASC)
|
||||||
.setSearchType(SearchType.QUERY_THEN_FETCH);
|
.setSearchType(SearchType.QUERY_THEN_FETCH)
|
||||||
|
.setRequestCache(false);
|
||||||
|
|
||||||
MultiSearchResponse.Item[] responses = client().prepareMultiSearch()
|
MultiSearchResponse.Item[] responses = client().prepareMultiSearch()
|
||||||
.add(vanilla)
|
.add(vanilla)
|
||||||
|
@ -190,7 +189,7 @@ public class QueryProfilerIT extends ESIntegTestCase {
|
||||||
vanillaHits[j].getId(), equalTo(profileHits[j].getId()));
|
vanillaHits[j].getId(), equalTo(profileHits[j].getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue