cleanup tests

This commit is contained in:
Simon Willnauer 2013-10-11 13:49:32 +02:00
parent 977cb4a729
commit 530340fa76
5 changed files with 10 additions and 75 deletions

View File

@ -207,6 +207,7 @@ public class MinimumMasterNodesTests extends AbstractIntegrationTest {
state = client().admin().cluster().prepareState().execute().actionGet().getState(); state = client().admin().cluster().prepareState().execute().actionGet().getState();
assertThat(state.nodes().size(), equalTo(4)); assertThat(state.nodes().size(), equalTo(4));
createIndex("test");
logger.info("--> indexing some data"); logger.info("--> indexing some data");
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
client().prepareIndex("test", "type1", Integer.toString(i)).setSource("field", "value").execute().actionGet(); client().prepareIndex("test", "type1", Integer.toString(i)).setSource("field", "value").execute().actionGet();

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -67,21 +67,20 @@ import static org.hamcrest.Matchers.*;
*/ */
public class SimpleFacetsTests extends AbstractIntegrationTest { public class SimpleFacetsTests extends AbstractIntegrationTest {
private int numRuns = -1;
@Override @Override
public Settings getSettings() { public Settings getSettings() {
return randomSettingsBuilder() return randomSettingsBuilder()
.put("index.number_of_shards", numberOfShards()) .put("index.number_of_shards", between(1, 5))
.put("index.number_of_replicas", 0) .put("index.number_of_replicas", 0)
.build(); .build();
} }
protected int numberOfShards() {
return 1;
}
protected int numberOfRuns() { protected int numberOfRuns() {
return 5; if (numRuns == -1) {
numRuns = atLeast(3);
}
return numRuns;
} }
@Test @Test
@ -790,7 +789,7 @@ public class SimpleFacetsTests extends AbstractIntegrationTest {
@Test @Test
public void testFilterFacets() throws Exception { public void testFilterFacets() throws Exception {
createIndex("test1"); createIndex("test");
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
client().prepareIndex("test", "type1").setSource(jsonBuilder().startObject() 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 @Test // #3479: Null pointer exception for POST mode facets if facet_filter accepts no documents
public void testFilterFacetWithFacetFilterPostMode() throws IOException { public void testFilterFacetWithFacetFilterPostMode() throws IOException {
createIndex("test");
client().prepareIndex("test", "type1").setSource(jsonBuilder().startObject() client().prepareIndex("test", "type1").setSource(jsonBuilder().startObject()
.field("field", "xxx") .field("field", "xxx")
.endObject()).execute().actionGet(); .endObject()).execute().actionGet();

View File

@ -49,6 +49,7 @@ public class CustomSuggesterSearchTests extends AbstractIntegrationTest {
@Test @Test
public void testThatCustomSuggestersCanBeRegisteredAndWork() throws Exception { public void testThatCustomSuggestersCanBeRegisteredAndWork() throws Exception {
createIndex("test");
client().prepareIndex("test", "test", "1").setSource(jsonBuilder() client().prepareIndex("test", "test", "1").setSource(jsonBuilder()
.startObject() .startObject()
.field("name", "arbitrary content") .field("name", "arbitrary content")