Test fix - ensure forceMerged to single segment to avoid scoring variations in tests.
Removed test muting. Original commit: elastic/x-pack-elasticsearch@3a584aadda
This commit is contained in:
parent
5e6c56bfc1
commit
ffe6966ccd
|
@ -7,6 +7,9 @@ package org.elasticsearch.xpack.graph.test;
|
|||
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.elasticsearch.action.ActionRequestValidationException;
|
||||
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
|
||||
import org.elasticsearch.action.admin.indices.segments.IndexShardSegments;
|
||||
import org.elasticsearch.action.admin.indices.segments.ShardSegments;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.Settings.Builder;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
@ -36,6 +39,7 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF
|
|||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
|
||||
|
@ -93,6 +97,18 @@ public class GraphTests extends XPackSingleNodeTestCase {
|
|||
}
|
||||
}
|
||||
client().admin().indices().prepareRefresh("test").get();
|
||||
// Ensure single segment with no deletes. Hopefully solves test instability in
|
||||
// issue https://github.com/elastic/x-pack-elasticsearch/issues/918
|
||||
ForceMergeResponse actionGet = client().admin().indices().prepareForceMerge("test").setFlush(true).setMaxNumSegments(1)
|
||||
.execute().actionGet();
|
||||
assertAllSuccessful(actionGet);
|
||||
for (IndexShardSegments seg : client().admin().indices().prepareSegments().get().getIndices().get("test")) {
|
||||
ShardSegments[] shards = seg.getShards();
|
||||
for (ShardSegments shardSegments : shards) {
|
||||
assertEquals(1, shardSegments.getSegments().size());
|
||||
}
|
||||
}
|
||||
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), numDocs);
|
||||
}
|
||||
|
||||
|
@ -101,7 +117,6 @@ public class GraphTests extends XPackSingleNodeTestCase {
|
|||
return pluginList(ScriptedTimeoutPlugin.class, XPackPlugin.class);
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/x-pack-elasticsearch/issues/918")
|
||||
public void testSignificanceQueryCrawl() {
|
||||
GraphExploreRequestBuilder grb = new GraphExploreRequestBuilder(client(), GraphExploreAction.INSTANCE).setIndices("test");
|
||||
Hop hop1 = grb.createNextHop(QueryBuilders.termQuery("description", "beatles"));
|
||||
|
|
Loading…
Reference in New Issue