Merge pull request #12624 from rmuir/faster_unit_tests

cleanup more abstract test class -> TestCase and integ -> IT
This commit is contained in:
Robert Muir 2015-08-03 21:19:51 -04:00
commit 9091f46602
20 changed files with 27 additions and 27 deletions

View File

@ -49,7 +49,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo;
public abstract class AbstractTermVectorsTests extends ESIntegTestCase {
public abstract class AbstractTermVectorsTestCase extends ESIntegTestCase {
protected static class TestFieldSetting {
final public String name;

View File

@ -62,7 +62,7 @@ import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
public class GetTermVectorsIT extends AbstractTermVectorsTests {
public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
@Test
public void testNoSuchDoc() throws Exception {

View File

@ -33,20 +33,20 @@ import java.io.IOException;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.*;
public class MultiTermVectorsTests extends AbstractTermVectorsTests {
public class MultiTermVectorsIT extends AbstractTermVectorsTestCase {
@Test
public void testDuelESLucene() throws Exception {
AbstractTermVectorsTests.TestFieldSetting[] testFieldSettings = getFieldSettings();
AbstractTermVectorsTestCase.TestFieldSetting[] testFieldSettings = getFieldSettings();
createIndexBasedOnFieldSettings("test", "alias", testFieldSettings);
//we generate as many docs as many shards we have
TestDoc[] testDocs = generateTestDocs("test", testFieldSettings);
DirectoryReader directoryReader = indexDocsWithLucene(testDocs);
AbstractTermVectorsTests.TestConfig[] testConfigs = generateTestConfigs(20, testDocs, testFieldSettings);
AbstractTermVectorsTestCase.TestConfig[] testConfigs = generateTestConfigs(20, testDocs, testFieldSettings);
MultiTermVectorsRequestBuilder requestBuilder = client().prepareMultiTermVectors();
for (AbstractTermVectorsTests.TestConfig test : testConfigs) {
for (AbstractTermVectorsTestCase.TestConfig test : testConfigs) {
requestBuilder.add(getRequestForConfig(test).request());
}

View File

@ -28,7 +28,7 @@ import org.elasticsearch.test.ESIntegTestCase;
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
public abstract class AbstractTermsTests extends ESIntegTestCase {
public abstract class AbstractTermsTestCase extends ESIntegTestCase {
public String randomExecutionHint() {
return randomBoolean() ? null : randomFrom(ExecutionMode.values()).toString();

View File

@ -66,7 +66,7 @@ import static org.hamcrest.core.IsNull.notNullValue;
*
*/
@ESIntegTestCase.SuiteScopeTestCase
public class DoubleTermsTests extends AbstractTermsTests {
public class DoubleTermsIT extends AbstractTermsTestCase {
private static final int NUM_DOCS = 5; // TODO: randomize the size?
private static final String SINGLE_VALUED_FIELD_NAME = "d_value";

View File

@ -64,7 +64,7 @@ import static org.hamcrest.core.IsNull.notNullValue;
*
*/
@ESIntegTestCase.SuiteScopeTestCase
public class LongTermsTests extends AbstractTermsTests {
public class LongTermsIT extends AbstractTermsTestCase {
private static final int NUM_DOCS = 5; // TODO randomize the size?
private static final String SINGLE_VALUED_FIELD_NAME = "l_value";

View File

@ -54,7 +54,7 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllS
@ESIntegTestCase.SuiteScopeTestCase
public class MinDocCountTests extends AbstractTermsTests {
public class MinDocCountIT extends AbstractTermsTestCase {
private static final QueryBuilder QUERY = QueryBuilders.termQuery("match", true);

View File

@ -32,7 +32,7 @@ import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
import static org.hamcrest.Matchers.equalTo;
public class ShardSizeTermsTests extends ShardSizeTestCase {
public class ShardSizeTermsIT extends ShardSizeTestCase {
@Test
public void noShardSize_string() throws Exception {

View File

@ -72,7 +72,7 @@ import static org.hamcrest.core.IsNull.nullValue;
*
*/
@ESIntegTestCase.SuiteScopeTestCase
public class StringTermsTests extends AbstractTermsTests {
public class StringTermsIT extends AbstractTermsTestCase {
private static final String SINGLE_VALUED_FIELD_NAME = "s_value";
private static final String MULTI_VALUED_FIELD_NAME = "s_values";

View File

@ -30,7 +30,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
*
*/
@ESIntegTestCase.SuiteScopeTestCase
public abstract class AbstractNumericTests extends ESIntegTestCase {
public abstract class AbstractNumericTestCase extends ESIntegTestCase {
protected static long minValue, maxValue, minValues, maxValues;

View File

@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.notNullValue;
/**
*
*/
public class AvgTests extends AbstractNumericTests {
public class AvgIT extends AbstractNumericTestCase {
@Override
@Test

View File

@ -42,7 +42,7 @@ import static org.hamcrest.Matchers.sameInstance;
/**
*
*/
public class ExtendedStatsTests extends AbstractNumericTests {
public class ExtendedStatsIT extends AbstractNumericTestCase {
private static double stdDev(int... vals) {
return Math.sqrt(variance(vals));

View File

@ -50,7 +50,7 @@ import static org.hamcrest.Matchers.sameInstance;
/**
*
*/
public class HDRPercentileRanksTests extends AbstractNumericTests {
public class HDRPercentileRanksIT extends AbstractNumericTestCase {
private static double[] randomPercents(long minValue, long maxValue) {
@ -70,7 +70,7 @@ public class HDRPercentileRanksTests extends AbstractNumericTests {
}
}
Arrays.sort(percents);
Loggers.getLogger(HDRPercentileRanksTests.class).info("Using percentiles={}", Arrays.toString(percents));
Loggers.getLogger(HDRPercentileRanksIT.class).info("Using percentiles={}", Arrays.toString(percents));
return percents;
}

View File

@ -51,7 +51,7 @@ import static org.hamcrest.Matchers.sameInstance;
/**
*
*/
public class HDRPercentilesTests extends AbstractNumericTests {
public class HDRPercentilesIT extends AbstractNumericTestCase {
private static double[] randomPercentiles() {
final int length = randomIntBetween(1, 20);
@ -70,7 +70,7 @@ public class HDRPercentilesTests extends AbstractNumericTests {
}
}
Arrays.sort(percentiles);
Loggers.getLogger(HDRPercentilesTests.class).info("Using percentiles={}", Arrays.toString(percentiles));
Loggers.getLogger(HDRPercentilesIT.class).info("Using percentiles={}", Arrays.toString(percentiles));
return percentiles;
}

View File

@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.notNullValue;
/**
*
*/
public class MaxTests extends AbstractNumericTests {
public class MaxIT extends AbstractNumericTestCase {
@Override
@Test

View File

@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.notNullValue;
/**
*
*/
public class MinTests extends AbstractNumericTests {
public class MinIT extends AbstractNumericTestCase {
@Override
@Test

View File

@ -42,7 +42,7 @@ import static org.hamcrest.Matchers.sameInstance;
/**
*
*/
public class StatsTests extends AbstractNumericTests {
public class StatsIT extends AbstractNumericTestCase {
@Override
@Test

View File

@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.notNullValue;
/**
*
*/
public class SumTests extends AbstractNumericTests {
public class SumIT extends AbstractNumericTestCase {
@Override
@Test

View File

@ -50,7 +50,7 @@ import static org.hamcrest.Matchers.sameInstance;
/**
*
*/
public class TDigestPercentileRanksTests extends AbstractNumericTests {
public class TDigestPercentileRanksIT extends AbstractNumericTestCase {
private static double[] randomPercents(long minValue, long maxValue) {
@ -70,7 +70,7 @@ public class TDigestPercentileRanksTests extends AbstractNumericTests {
}
}
Arrays.sort(percents);
Loggers.getLogger(TDigestPercentileRanksTests.class).info("Using percentiles={}", Arrays.toString(percents));
Loggers.getLogger(TDigestPercentileRanksIT.class).info("Using percentiles={}", Arrays.toString(percents));
return percents;
}

View File

@ -50,7 +50,7 @@ import static org.hamcrest.Matchers.sameInstance;
/**
*
*/
public class TDigestPercentilesTests extends AbstractNumericTests {
public class TDigestPercentilesIT extends AbstractNumericTestCase {
private static double[] randomPercentiles() {
final int length = randomIntBetween(1, 20);
@ -69,7 +69,7 @@ public class TDigestPercentilesTests extends AbstractNumericTests {
}
}
Arrays.sort(percentiles);
Loggers.getLogger(TDigestPercentilesTests.class).info("Using percentiles={}", Arrays.toString(percentiles));
Loggers.getLogger(TDigestPercentilesIT.class).info("Using percentiles={}", Arrays.toString(percentiles));
return percentiles;
}