diff --git a/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java b/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java index 26e71e8cd55..12fdcce518f 100644 --- a/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java +++ b/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java @@ -207,6 +207,7 @@ public class MinimumMasterNodesTests extends AbstractIntegrationTest { state = client().admin().cluster().prepareState().execute().actionGet().getState(); assertThat(state.nodes().size(), equalTo(4)); + createIndex("test"); logger.info("--> indexing some data"); for (int i = 0; i < 100; i++) { client().prepareIndex("test", "type1", Integer.toString(i)).setSource("field", "value").execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/search/facet/SimpleFacetsMultiShardMultiNodeTests.java b/src/test/java/org/elasticsearch/search/facet/SimpleFacetsMultiShardMultiNodeTests.java deleted file mode 100644 index 36053aef8a1..00000000000 --- a/src/test/java/org/elasticsearch/search/facet/SimpleFacetsMultiShardMultiNodeTests.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to ElasticSearch and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. ElasticSearch licenses this - * file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.search.facet; - - -/** - * Tests for several shards case since some facets do optimizations in this case. Make sure - * behavior remains the same. - */ -public class SimpleFacetsMultiShardMultiNodeTests extends SimpleFacetsTests { - - @Override - protected int numberOfShards() { - return 3; - } - -} \ No newline at end of file diff --git a/src/test/java/org/elasticsearch/search/facet/SimpleFacetsMultiShardTests.java b/src/test/java/org/elasticsearch/search/facet/SimpleFacetsMultiShardTests.java deleted file mode 100644 index 306317fd269..00000000000 --- a/src/test/java/org/elasticsearch/search/facet/SimpleFacetsMultiShardTests.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to ElasticSearch and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. ElasticSearch licenses this - * file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.search.facet; - - -/** - * Tests for several shards case since some facets do optimizations in this case. Make sure - * behavior remains the same. - */ -public class SimpleFacetsMultiShardTests extends SimpleFacetsTests { - - @Override - protected int numberOfShards() { - return 3; - } -} \ No newline at end of file diff --git a/src/test/java/org/elasticsearch/search/facet/SimpleFacetsTests.java b/src/test/java/org/elasticsearch/search/facet/SimpleFacetsTests.java index 11bf3f0909d..f812fc2d5b6 100644 --- a/src/test/java/org/elasticsearch/search/facet/SimpleFacetsTests.java +++ b/src/test/java/org/elasticsearch/search/facet/SimpleFacetsTests.java @@ -67,21 +67,20 @@ import static org.hamcrest.Matchers.*; */ public class SimpleFacetsTests extends AbstractIntegrationTest { - + private int numRuns = -1; @Override public Settings getSettings() { return randomSettingsBuilder() - .put("index.number_of_shards", numberOfShards()) + .put("index.number_of_shards", between(1, 5)) .put("index.number_of_replicas", 0) .build(); } - protected int numberOfShards() { - return 1; - } - protected int numberOfRuns() { - return 5; + if (numRuns == -1) { + numRuns = atLeast(3); + } + return numRuns; } @Test @@ -790,7 +789,7 @@ public class SimpleFacetsTests extends AbstractIntegrationTest { @Test public void testFilterFacets() throws Exception { - createIndex("test1"); + createIndex("test"); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().prepareIndex("test", "type1").setSource(jsonBuilder().startObject() @@ -2346,6 +2345,7 @@ public class SimpleFacetsTests extends AbstractIntegrationTest { @Test // #3479: Null pointer exception for POST mode facets if facet_filter accepts no documents public void testFilterFacetWithFacetFilterPostMode() throws IOException { + createIndex("test"); client().prepareIndex("test", "type1").setSource(jsonBuilder().startObject() .field("field", "xxx") .endObject()).execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterSearchTests.java b/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterSearchTests.java index 9fbd4e0139f..a16cf448272 100644 --- a/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterSearchTests.java +++ b/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterSearchTests.java @@ -49,6 +49,7 @@ public class CustomSuggesterSearchTests extends AbstractIntegrationTest { @Test public void testThatCustomSuggestersCanBeRegisteredAndWork() throws Exception { + createIndex("test"); client().prepareIndex("test", "test", "1").setSource(jsonBuilder() .startObject() .field("name", "arbitrary content")