TESTS: Fix IndexStatsIT#testFilterCacheStats (#36143)

* Test randomly failed because of background merges
   * Fixed by force merging down to a single segment
* Closes #32506
This commit is contained in:
Armin Braun 2018-12-03 06:16:12 +01:00 committed by GitHub
parent d20bb3789d
commit 9c0a429709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
import org.elasticsearch.action.DocWriteResponse;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
import org.elasticsearch.action.admin.indices.stats.CommonStats;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag;
@ -1006,7 +1007,6 @@ public class IndexStatsIT extends ESIntegTestCase {
assertEquals(total, shardTotal);
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32506")
public void testFilterCacheStats() throws Exception {
Settings settings = Settings.builder().put(indexSettings()).put("number_of_replicas", 0).build();
assertAcked(prepareCreate("index").setSettings(settings).get());
@ -1056,7 +1056,11 @@ public class IndexStatsIT extends ESIntegTestCase {
persistGlobalCheckpoint("index");
flush("index");
}
ForceMergeResponse forceMergeResponse =
client().admin().indices().prepareForceMerge("index").setFlush(true).setMaxNumSegments(1).get();
assertAllSuccessful(forceMergeResponse);
refresh();
response = client().admin().indices().prepareStats("index").setQueryCache(true).get();
assertCumulativeQueryCacheStats(response);
assertThat(response.getTotal().queryCache.getHitCount(), greaterThan(0L));