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