Merge pull request #12624 from rmuir/faster_unit_tests
cleanup more abstract test class -> TestCase and integ -> IT
This commit is contained in:
commit
9091f46602
|
@ -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;
|
|
@ -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 {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
@ -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();
|
|
@ -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";
|
|
@ -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";
|
|
@ -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);
|
||||
|
|
@ -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 {
|
|
@ -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";
|
|
@ -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;
|
||||
|
|
@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class AvgTests extends AbstractNumericTests {
|
||||
public class AvgIT extends AbstractNumericTestCase {
|
||||
|
||||
@Override
|
||||
@Test
|
|
@ -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));
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class MaxTests extends AbstractNumericTests {
|
||||
public class MaxIT extends AbstractNumericTestCase {
|
||||
|
||||
@Override
|
||||
@Test
|
|
@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class MinTests extends AbstractNumericTests {
|
||||
public class MinIT extends AbstractNumericTestCase {
|
||||
|
||||
@Override
|
||||
@Test
|
|
@ -42,7 +42,7 @@ import static org.hamcrest.Matchers.sameInstance;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class StatsTests extends AbstractNumericTests {
|
||||
public class StatsIT extends AbstractNumericTestCase {
|
||||
|
||||
@Override
|
||||
@Test
|
|
@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class SumTests extends AbstractNumericTests {
|
||||
public class SumIT extends AbstractNumericTestCase {
|
||||
|
||||
@Override
|
||||
@Test
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue