Skip to content

Commit

Permalink
TESTS: Fix IndexStatsIT#testFilterCacheStats (#36143)
Browse files Browse the repository at this point in the history
* Test randomly failed because of background merges
   * Fixed by force merging down to a single segment
* Closes #32506
  • Loading branch information
original-brownbear authored Dec 3, 2018
1 parent d20bb37 commit 9c0a429
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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;
Expand Down Expand Up @@ -1006,7 +1007,6 @@ private void assertCumulativeQueryCacheStats(IndicesStatsResponse response) {
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());
Expand Down Expand Up @@ -1056,7 +1056,11 @@ public void testFilterCacheStats() throws Exception {
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));
Expand Down

0 comments on commit 9c0a429

Please sign in to comment.