diff --git a/pom.xml b/pom.xml index 95066d84d93..fb585c2a96b 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ com.carrotsearch.randomizedtesting randomizedtesting-runner - 2.0.15 + 2.1.1 test @@ -356,7 +356,7 @@ com.carrotsearch.randomizedtesting junit4-maven-plugin - 2.0.15 + 2.1.1 tests diff --git a/src/test/java/org/apache/lucene/queries/BlendedTermQueryTest.java b/src/test/java/org/apache/lucene/queries/BlendedTermQueryTest.java index e6f262d055c..23664c36182 100644 --- a/src/test/java/org/apache/lucene/queries/BlendedTermQueryTest.java +++ b/src/test/java/org/apache/lucene/queries/BlendedTermQueryTest.java @@ -63,7 +63,7 @@ public class BlendedTermQueryTest extends ElasticsearchLuceneTestCase { d.add(new TextField("surname", surNames[i], Field.Store.NO)); w.addDocument(d); } - int iters = atLeast(25); + int iters = scaledRandomIntBetween(25, 100); for (int j = 0; j < iters; j++) { Document d = new Document(); d.add(new TextField("id", Integer.toString(firstNames.length + j), Field.Store.YES)); @@ -123,7 +123,7 @@ public class BlendedTermQueryTest extends ElasticsearchLuceneTestCase { d.add(new Field("song", song[i], ft)); w.addDocument(d); } - int iters = atLeast(25); + int iters = scaledRandomIntBetween(25, 100); for (int j = 0; j < iters; j++) { Document d = new Document(); d.add(new TextField("id", Integer.toString(username.length + j), Field.Store.YES)); @@ -171,7 +171,7 @@ public class BlendedTermQueryTest extends ElasticsearchLuceneTestCase { @Test public void testBasics() { - final int iters = atLeast(5); + final int iters = scaledRandomIntBetween(5, 25); for (int j = 0; j < iters; j++) { String[] fields = new String[1 + random().nextInt(10)]; for (int i = 0; i < fields.length; i++) { @@ -210,7 +210,7 @@ public class BlendedTermQueryTest extends ElasticsearchLuceneTestCase { @Test public void testExtractTerms() { Set terms = new HashSet(); - int num = atLeast(1); + int num = scaledRandomIntBetween(1, 10); for (int i = 0; i < num; i++) { terms.add(new Term(_TestUtil.randomRealisticUnicodeString(random(), 1, 10), _TestUtil.randomRealisticUnicodeString(random(), 1, 10))); } diff --git a/src/test/java/org/apache/lucene/search/postingshighlight/CustomPostingsHighlighterTests.java b/src/test/java/org/apache/lucene/search/postingshighlight/CustomPostingsHighlighterTests.java index d33ece139ff..9bd0eedece4 100644 --- a/src/test/java/org/apache/lucene/search/postingshighlight/CustomPostingsHighlighterTests.java +++ b/src/test/java/org/apache/lucene/search/postingshighlight/CustomPostingsHighlighterTests.java @@ -451,7 +451,7 @@ public class CustomPostingsHighlighterTests extends ElasticsearchLuceneTestCase Snippet[] snippets = highlighter.highlightDoc("body", filteredQueryTerms, searcher, docId, 5); assertThat(snippets.length, equalTo(0)); - highlighter = new CustomPostingsHighlighter(passageFormatter, values, true, Integer.MAX_VALUE - 1, atLeast(1)); + highlighter = new CustomPostingsHighlighter(passageFormatter, values, true, Integer.MAX_VALUE - 1, scaledRandomIntBetween(1, 10)); snippets = highlighter.highlightDoc("body", filteredQueryTerms, searcher, docId, 5); assertThat(snippets.length, equalTo(1)); assertThat(snippets[0].getText(), equalTo("This is a test.")); diff --git a/src/test/java/org/apache/lucene/search/postingshighlight/XPostingsHighlighterTests.java b/src/test/java/org/apache/lucene/search/postingshighlight/XPostingsHighlighterTests.java index 6f63b72aa57..df11d5ed87f 100644 --- a/src/test/java/org/apache/lucene/search/postingshighlight/XPostingsHighlighterTests.java +++ b/src/test/java/org/apache/lucene/search/postingshighlight/XPostingsHighlighterTests.java @@ -1484,7 +1484,7 @@ public class XPostingsHighlighterTests extends ElasticsearchLuceneTestCase { FieldType offsetsType = new FieldType(TextField.TYPE_STORED); offsetsType.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS); - int numDocs = atLeast(100); + int numDocs = scaledRandomIntBetween(100, 1000); for(int i=0;i nodes = new ArrayList(); int nodeIdx = 0; - int iters = atLeast(10); + int iters = scaledRandomIntBetween(10, 100); for (int i = 0; i < iters; i++) { DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder(); int numNodes = between(1, 20); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java index 5cbd22dd9b3..5ffe1e860c9 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java @@ -80,7 +80,7 @@ public class RandomAllocationDeciderTests extends ElasticsearchAllocationTestCas RoutingTable routingTable = routingTableBuilder.build(); ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); - int numIters = atLeast(20); + int numIters = scaledRandomIntBetween(20, 100);; int nodeIdCounter = 0; int atMostNodes = between(Math.max(1, maxNumReplicas), numIters); final boolean frequentNodes = randomBoolean(); @@ -90,7 +90,7 @@ public class RandomAllocationDeciderTests extends ElasticsearchAllocationTestCas if (clusterState.nodes().size() <= atMostNodes && (nodeIdCounter == 0 || (frequentNodes ? frequently() : rarely()))) { - int numNodes = atLeast(1); + int numNodes = scaledRandomIntBetween(1, 15); for (int j = 0; j < numNodes; j++) { logger.info("adding node [{}]", nodeIdCounter); newNodesBuilder.put(newNode("NODE_" + (nodeIdCounter++))); diff --git a/src/test/java/org/elasticsearch/common/hashing/MurmurHash3Tests.java b/src/test/java/org/elasticsearch/common/hashing/MurmurHash3Tests.java index a6e048bcf4a..6d3f5c8d05b 100644 --- a/src/test/java/org/elasticsearch/common/hashing/MurmurHash3Tests.java +++ b/src/test/java/org/elasticsearch/common/hashing/MurmurHash3Tests.java @@ -31,14 +31,14 @@ import java.nio.LongBuffer; public class MurmurHash3Tests extends ElasticsearchTestCase { public void testHash128() { - final int iters = atLeast(100); + final int iters = scaledRandomIntBetween(100, 5000); for (int i = 0; i < iters; ++i) { final int seed = randomInt(); final int offset = randomInt(20); final int len = randomInt(randomBoolean() ? 20 : 200); final byte[] bytes = new byte[len + offset + randomInt(3)]; getRandom().nextBytes(bytes); - HashCode h1 = Hashing.murmur3_128(seed).hashBytes(bytes, offset, len);; + HashCode h1 = Hashing.murmur3_128(seed).hashBytes(bytes, offset, len); MurmurHash3.Hash128 h2 = MurmurHash3.hash128(bytes, offset, len, seed, new MurmurHash3.Hash128()); assertEquals(h1, h2); } diff --git a/src/test/java/org/elasticsearch/common/lucene/search/XBooleanFilterTests.java b/src/test/java/org/elasticsearch/common/lucene/search/XBooleanFilterTests.java index 32c08afbab1..e3f9d16eab3 100644 --- a/src/test/java/org/elasticsearch/common/lucene/search/XBooleanFilterTests.java +++ b/src/test/java/org/elasticsearch/common/lucene/search/XBooleanFilterTests.java @@ -434,7 +434,7 @@ public class XBooleanFilterTests extends ElasticsearchLuceneTestCase { @Test public void testRandom() throws IOException { - int iterations = atLeast(400); // don't worry that is fast! + int iterations = scaledRandomIntBetween(100, 1000); // don't worry that is fast! for (int iter = 0; iter < iterations; iter++) { int numClauses = 1 + random().nextInt(10); FilterClause[] clauses = new FilterClause[numClauses]; diff --git a/src/test/java/org/elasticsearch/common/unit/FuzzinessTests.java b/src/test/java/org/elasticsearch/common/unit/FuzzinessTests.java index 448d0522efb..889b2ddfc09 100644 --- a/src/test/java/org/elasticsearch/common/unit/FuzzinessTests.java +++ b/src/test/java/org/elasticsearch/common/unit/FuzzinessTests.java @@ -45,7 +45,7 @@ public class FuzzinessTests extends ElasticsearchTestCase { @Test public void testParseFromXContent() throws IOException { - final int iters = atLeast(10); + final int iters = randomIntBetween(10, 50); for (int i = 0; i < iters; i++) { { XContent xcontent = XContentType.JSON.xContent(); @@ -165,7 +165,7 @@ public class FuzzinessTests extends ElasticsearchTestCase { @Test public void testAsDistance() { - final int iters = atLeast(10); + final int iters = randomIntBetween(10, 50); for (int i = 0; i < iters; i++) { Integer integer = Integer.valueOf(randomIntBetween(0, 10)); String value = "" + (randomBoolean() ? integer.intValue() : integer.floatValue()); @@ -183,7 +183,7 @@ public class FuzzinessTests extends ElasticsearchTestCase { assertThat((double) Fuzziness.TWO.asSimilarity("abcefg"), closeTo(0.66f, 0.05)); assertThat((double) Fuzziness.ONE.asSimilarity("ab"), closeTo(0.5f, 0.05)); - int iters = atLeast(100); + int iters = randomIntBetween(100, 1000); for (int i = 0; i < iters; i++) { Fuzziness fuzziness = Fuzziness.fromEdits(between(1, 2)); String string = rarely() ? randomRealisticUnicodeOfLengthBetween(2, 4) : diff --git a/src/test/java/org/elasticsearch/common/util/ByteUtilsTests.java b/src/test/java/org/elasticsearch/common/util/ByteUtilsTests.java index 73319623fd4..729033bdd6f 100644 --- a/src/test/java/org/elasticsearch/common/util/ByteUtilsTests.java +++ b/src/test/java/org/elasticsearch/common/util/ByteUtilsTests.java @@ -45,7 +45,7 @@ public class ByteUtilsTests extends ElasticsearchTestCase { } public void testFloat() throws IOException { - final float[] data = new float[atLeast(1000)]; + final float[] data = new float[scaledRandomIntBetween(1000, 10000)]; final byte[] encoded = new byte[data.length * 4]; for (int i = 0; i < data.length; ++i) { data[i] = randomFloat(); @@ -57,7 +57,7 @@ public class ByteUtilsTests extends ElasticsearchTestCase { } public void testDouble() throws IOException { - final double[] data = new double[atLeast(1000)]; + final double[] data = new double[scaledRandomIntBetween(1000, 10000)]; final byte[] encoded = new byte[data.length * 8]; for (int i = 0; i < data.length; ++i) { data[i] = randomDouble(); @@ -69,7 +69,7 @@ public class ByteUtilsTests extends ElasticsearchTestCase { } public void testVLong() throws IOException { - final long[] data = new long[atLeast(1000)]; + final long[] data = new long[scaledRandomIntBetween(1000, 10000)]; for (int i = 0; i < data.length; ++i) { switch (randomInt(4)) { case 0: diff --git a/src/test/java/org/elasticsearch/common/util/BytesRefHashTests.java b/src/test/java/org/elasticsearch/common/util/BytesRefHashTests.java index 91e933fe2cd..8d03dd4c7ae 100644 --- a/src/test/java/org/elasticsearch/common/util/BytesRefHashTests.java +++ b/src/test/java/org/elasticsearch/common/util/BytesRefHashTests.java @@ -94,7 +94,7 @@ public class BytesRefHashTests extends ElasticsearchTestCase { @Test public void testSize() { BytesRef ref = new BytesRef(); - int num = atLeast(2); + int num = scaledRandomIntBetween(2, 20); for (int j = 0; j < num; j++) { final int mod = 1+randomInt(40); for (int i = 0; i < 797; i++) { @@ -126,7 +126,7 @@ public class BytesRefHashTests extends ElasticsearchTestCase { public void testGet() { BytesRef ref = new BytesRef(); BytesRef scratch = new BytesRef(); - int num = atLeast(2); + int num = scaledRandomIntBetween(2, 20); for (int j = 0; j < num; j++) { Map strings = new HashMap(); int uniqueCount = 0; @@ -166,7 +166,7 @@ public class BytesRefHashTests extends ElasticsearchTestCase { public void testAdd() { BytesRef ref = new BytesRef(); BytesRef scratch = new BytesRef(); - int num = atLeast(2); + int num = scaledRandomIntBetween(2, 20); for (int j = 0; j < num; j++) { Set strings = new HashSet(); int uniqueCount = 0; @@ -202,7 +202,7 @@ public class BytesRefHashTests extends ElasticsearchTestCase { public void testFind() throws Exception { BytesRef ref = new BytesRef(); BytesRef scratch = new BytesRef(); - int num = atLeast(2); + int num = scaledRandomIntBetween(2, 20); for (int j = 0; j < num; j++) { Set strings = new HashSet(); int uniqueCount = 0; diff --git a/src/test/java/org/elasticsearch/common/util/DoubleObjectHashMapTests.java b/src/test/java/org/elasticsearch/common/util/DoubleObjectHashMapTests.java index a7a6b7d64d6..fbde00a9bf7 100644 --- a/src/test/java/org/elasticsearch/common/util/DoubleObjectHashMapTests.java +++ b/src/test/java/org/elasticsearch/common/util/DoubleObjectHashMapTests.java @@ -30,7 +30,7 @@ public class DoubleObjectHashMapTests extends ElasticsearchTestCase { final DoubleObjectOpenHashMap map1 = new DoubleObjectOpenHashMap(); final DoubleObjectPagedHashMap map2 = new DoubleObjectPagedHashMap(randomInt(42), 0.6f + randomFloat() * 0.39f, BigArraysTests.randombigArrays()); final int maxKey = randomIntBetween(1, 10000); - final int iters = atLeast(10000); + final int iters = scaledRandomIntBetween(10000, 100000); for (int i = 0; i < iters; ++i) { final boolean put = randomBoolean(); final int iters2 = randomIntBetween(1, 100); diff --git a/src/test/java/org/elasticsearch/common/util/LongObjectHashMapTests.java b/src/test/java/org/elasticsearch/common/util/LongObjectHashMapTests.java index 68a2de534d4..bb3b1a294ac 100644 --- a/src/test/java/org/elasticsearch/common/util/LongObjectHashMapTests.java +++ b/src/test/java/org/elasticsearch/common/util/LongObjectHashMapTests.java @@ -30,7 +30,7 @@ public class LongObjectHashMapTests extends ElasticsearchTestCase { final LongObjectOpenHashMap map1 = new LongObjectOpenHashMap(); final LongObjectPagedHashMap map2 = new LongObjectPagedHashMap(randomInt(42), 0.6f + randomFloat() * 0.39f, BigArraysTests.randombigArrays()); final int maxKey = randomIntBetween(1, 10000); - final int iters = atLeast(10000); + final int iters = scaledRandomIntBetween(10000, 100000); for (int i = 0; i < iters; ++i) { final boolean put = randomBoolean(); final int iters2 = randomIntBetween(1, 100); diff --git a/src/test/java/org/elasticsearch/common/util/concurrent/CountDownTest.java b/src/test/java/org/elasticsearch/common/util/concurrent/CountDownTest.java index 899796955b5..7ac12ccde46 100644 --- a/src/test/java/org/elasticsearch/common/util/concurrent/CountDownTest.java +++ b/src/test/java/org/elasticsearch/common/util/concurrent/CountDownTest.java @@ -19,7 +19,6 @@ package org.elasticsearch.common.util.concurrent; -import com.carrotsearch.randomizedtesting.annotations.Repeat; import org.elasticsearch.test.ElasticsearchTestCase; import org.hamcrest.Matchers; import org.junit.Test; @@ -33,11 +32,11 @@ import static org.hamcrest.Matchers.greaterThan; public class CountDownTest extends ElasticsearchTestCase { - @Test @Repeat(iterations = 1000) + @Test public void testConcurrent() throws InterruptedException { final AtomicInteger count = new AtomicInteger(0); - final CountDown countDown = new CountDown(atLeast(10)); - Thread[] threads = new Thread[atLeast(3)]; + final CountDown countDown = new CountDown(scaledRandomIntBetween(10, 1000)); + Thread[] threads = new Thread[between(3, 10)]; final CountDownLatch latch = new CountDownLatch(1); for (int i = 0; i < threads.length; i++) { threads[i] = new Thread() { @@ -83,7 +82,7 @@ public class CountDownTest extends ElasticsearchTestCase { @Test public void testSingleThreaded() { - int atLeast = atLeast(10); + int atLeast = scaledRandomIntBetween(10, 1000); final CountDown countDown = new CountDown(atLeast); while(!countDown.isCountedDown()) { atLeast--; diff --git a/src/test/java/org/elasticsearch/count/simple/SimpleCountTests.java b/src/test/java/org/elasticsearch/count/simple/SimpleCountTests.java index c5b6961caac..8c066209bb0 100644 --- a/src/test/java/org/elasticsearch/count/simple/SimpleCountTests.java +++ b/src/test/java/org/elasticsearch/count/simple/SimpleCountTests.java @@ -45,7 +45,7 @@ public class SimpleCountTests extends ElasticsearchIntegrationTest { client().prepareIndex("test", "type", "5").setSource("field", "value"), client().prepareIndex("test", "type", "6").setSource("field", "value")); - int iters = atLeast(10); + int iters = scaledRandomIntBetween(10, 100); for (int i = 0; i < iters; i++) { // id is not indexed, but lets see that we automatically convert to CountResponse countResponse = client().prepareCount().setQuery(QueryBuilders.matchAllQuery()).setPreference(randomUnicodeOfLengthBetween(0, 4)).get(); diff --git a/src/test/java/org/elasticsearch/deleteByQuery/DeleteByQueryTests.java b/src/test/java/org/elasticsearch/deleteByQuery/DeleteByQueryTests.java index e9da42341ab..f98a68b43bc 100644 --- a/src/test/java/org/elasticsearch/deleteByQuery/DeleteByQueryTests.java +++ b/src/test/java/org/elasticsearch/deleteByQuery/DeleteByQueryTests.java @@ -125,7 +125,7 @@ public class DeleteByQueryTests extends ElasticsearchIntegrationTest { @Test public void testDeleteByFieldQuery() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); - int numDocs = atLeast(10); + int numDocs = scaledRandomIntBetween(10, 100); for (int i = 0; i < numDocs; i++) { client().prepareIndex("test", "test", Integer.toString(i)) .setRouting(randomAsciiOfLengthBetween(1, 5)) diff --git a/src/test/java/org/elasticsearch/gateway/fs/IndexGatewayTests.java b/src/test/java/org/elasticsearch/gateway/fs/IndexGatewayTests.java index 7d08f7b43f1..3473edc96eb 100644 --- a/src/test/java/org/elasticsearch/gateway/fs/IndexGatewayTests.java +++ b/src/test/java/org/elasticsearch/gateway/fs/IndexGatewayTests.java @@ -280,26 +280,37 @@ public class IndexGatewayTests extends ElasticsearchIntegrationTest { logger.info("--> refreshing and checking count"); client().admin().indices().prepareRefresh().execute().actionGet(); assertThat(client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount(), equalTo(0l)); - - logger.info("--> indexing 1234 docs"); - for (long i = 0; i < 1234; i++) { + long numDocs = between(100, rarely() ? 2000 : 1000); + logger.info("--> indexing " + numDocs + " docs"); + boolean hasSnapshoted = false; + boolean hasFlushed = false; + for (long i = 0; i < numDocs; i++) { client().prepareIndex("test", "type1", Long.toString(i)) .setCreate(true) // make sure we use create, so if we recover wrongly, we will get increments... .setSource(MapBuilder.newMapBuilder().put("test", "value" + i).map()).execute().actionGet(); - // snapshot every 100 so we get some actions going on in the gateway - if ((i % 11) == 0) { + // snapshot every 100 so we get some actions going on in the gateway + if (rarely()) { + hasSnapshoted = true; client().admin().indices().prepareGatewaySnapshot().execute().actionGet(); } // flush every once is a while, so we get different data - if ((i % 55) == 0) { + if (rarely()) { + hasFlushed = true; client().admin().indices().prepareFlush().execute().actionGet(); } } + if (!hasSnapshoted) { + client().admin().indices().prepareGatewaySnapshot().execute().actionGet(); + } + + if (!hasFlushed) { + client().admin().indices().prepareFlush().execute().actionGet(); + } logger.info("--> refreshing and checking count"); client().admin().indices().prepareRefresh().execute().actionGet(); - assertThat(client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount(), equalTo(1234l)); + assertThat(client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount(), equalTo(numDocs)); logger.info("--> closing the server"); @@ -319,7 +330,7 @@ public class IndexGatewayTests extends ElasticsearchIntegrationTest { assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); logger.info("--> checking count"); - assertThat(client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount(), equalTo(1234l)); + assertThat(client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount(), equalTo(numDocs)); logger.info("--> checking reuse / recovery status"); IndicesStatusResponse statusResponse = client().admin().indices().prepareStatus().setRecovery(true).execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/index/analysis/AnalyzerBackwardsCompatTests.java b/src/test/java/org/elasticsearch/index/analysis/AnalyzerBackwardsCompatTests.java index 3a230866384..880b9d80489 100644 --- a/src/test/java/org/elasticsearch/index/analysis/AnalyzerBackwardsCompatTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/AnalyzerBackwardsCompatTests.java @@ -24,6 +24,7 @@ import org.junit.Ignore; import java.io.IOException; +import static com.carrotsearch.randomizedtesting.RandomizedTest.scaledRandomIntBetween; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_VERSION_CREATED; /** @@ -32,7 +33,7 @@ public class AnalyzerBackwardsCompatTests extends ElasticsearchTokenStreamTestCa @Ignore private void testNoStopwordsAfter(org.elasticsearch.Version noStopwordVersion, String type) throws IOException { - final int iters = atLeast(10); + final int iters = scaledRandomIntBetween(10, 100); org.elasticsearch.Version version = org.elasticsearch.Version.CURRENT; for (int i = 0; i < iters; i++) { ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder().put("index.analysis.filter.my_stop.type", "stop"); diff --git a/src/test/java/org/elasticsearch/index/analysis/NGramTokenizerFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/NGramTokenizerFactoryTests.java index 0607744a726..855f5c849ec 100644 --- a/src/test/java/org/elasticsearch/index/analysis/NGramTokenizerFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/NGramTokenizerFactoryTests.java @@ -43,6 +43,7 @@ import java.util.Arrays; import java.util.List; import java.util.Random; +import static com.carrotsearch.randomizedtesting.RandomizedTest.scaledRandomIntBetween; import static org.hamcrest.Matchers.instanceOf; public class NGramTokenizerFactoryTests extends ElasticsearchTokenStreamTestCase { @@ -108,7 +109,7 @@ public class NGramTokenizerFactoryTests extends ElasticsearchTokenStreamTestCase @Test public void testBackwardsCompatibilityEdgeNgramTokenizer() throws IllegalArgumentException, IllegalAccessException { - int iters = atLeast(20); + int iters = scaledRandomIntBetween(20, 100); final Index index = new Index("test"); final String name = "ngr"; for (int i = 0; i < iters; i++) { @@ -150,7 +151,7 @@ public class NGramTokenizerFactoryTests extends ElasticsearchTokenStreamTestCase @Test public void testBackwardsCompatibilityNgramTokenizer() throws IllegalArgumentException, IllegalAccessException { - int iters = atLeast(20); + int iters = scaledRandomIntBetween(20, 100); for (int i = 0; i < iters; i++) { final Index index = new Index("test"); final String name = "ngr"; @@ -183,7 +184,7 @@ public class NGramTokenizerFactoryTests extends ElasticsearchTokenStreamTestCase @Test public void testBackwardsCompatibilityEdgeNgramTokenFilter() throws IllegalArgumentException, IllegalAccessException { - int iters = atLeast(20); + int iters = scaledRandomIntBetween(20, 100); for (int i = 0; i < iters; i++) { final Index index = new Index("test"); final String name = "ngr"; diff --git a/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java b/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java index 7719df60c84..425c339401d 100644 --- a/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java @@ -62,7 +62,7 @@ public class PreBuiltAnalyzerTests extends ElasticsearchTestCase { // special case, these two are the same instance assertThat(currentDefaultAnalyzer, is(currentStandardAnalyzer)); PreBuiltAnalyzers.DEFAULT.getAnalyzer(Version.V_1_0_0_Beta1); - final int n = atLeast(10); + final int n = scaledRandomIntBetween(10, 100); Version version = Version.CURRENT; for(int i = 0; i < n; i++) { if (version.equals(Version.V_1_0_0_Beta1)) { @@ -95,7 +95,7 @@ public class PreBuiltAnalyzerTests extends ElasticsearchTestCase { public void testAnalyzerChangedIn10RC1() throws IOException { Analyzer pattern = PreBuiltAnalyzers.PATTERN.getAnalyzer(Version.V_1_0_0_RC1); Analyzer standardHtml = PreBuiltAnalyzers.STANDARD_HTML_STRIP.getAnalyzer(Version.V_1_0_0_RC1); - final int n = atLeast(10); + final int n = scaledRandomIntBetween(10, 100); Version version = Version.CURRENT; for(int i = 0; i < n; i++) { if (version.equals(Version.V_1_0_0_RC1)) { diff --git a/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java index a33b47584a4..e8bbfb0a4f0 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java @@ -222,7 +222,7 @@ public abstract class AbstractStringFieldDataTests extends AbstractFieldDataImpl for (int i = 1; i < values.length; ++i) { values[i] = _TestUtil.randomUnicodeString(getRandom()); } - final int numDocs = atLeast(100); + final int numDocs = scaledRandomIntBetween(100, 10000); for (int i = 0; i < numDocs; ++i) { final String value = RandomPicks.randomFrom(getRandom(), values); if (value == null) { @@ -284,7 +284,7 @@ public abstract class AbstractStringFieldDataTests extends AbstractFieldDataImpl for (int i = 1; i < values.length; ++i) { values[i] = _TestUtil.randomUnicodeString(getRandom()); } - final int numDocs = atLeast(100); + final int numDocs = scaledRandomIntBetween(100, 10000); for (int i = 0; i < numDocs; ++i) { final String value = RandomPicks.randomFrom(getRandom(), values); if (value == null) { @@ -338,7 +338,7 @@ public abstract class AbstractStringFieldDataTests extends AbstractFieldDataImpl for (int i = 0; i < values.length; ++i) { values[i] = _TestUtil.randomSimpleString(getRandom()); } - final int numParents = atLeast(100); + final int numParents = scaledRandomIntBetween(100, 10000); List docs = new ArrayList(); final OpenBitSet parents = new OpenBitSet(); for (int i = 0; i < numParents; ++i) { diff --git a/src/test/java/org/elasticsearch/index/fielddata/DuelFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/DuelFieldDataTests.java index 80e78fe8e1f..db2cc87efcd 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/DuelFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/DuelFieldDataTests.java @@ -53,12 +53,6 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { return null; } - public static int atLeast(Random random, int i) { - int min = i; - int max = min + (min / 2); - return min + random.nextInt(max - min); - } - @Test public void testDuelAllTypesSingleValue() throws Exception { final String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") @@ -73,7 +67,7 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { .endObject().endObject().endObject().string(); final DocumentMapper mapper = MapperTestUtils.newParser().parse(mapping); Random random = getRandom(); - int atLeast = atLeast(random, 1000); + int atLeast = scaledRandomIntBetween(1000, 1500); for (int i = 0; i < atLeast; i++) { String s = Integer.toString(randomByte()); @@ -152,7 +146,7 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { final DocumentMapper mapper = MapperTestUtils.newParser().parse(mapping); Random random = getRandom(); - int atLeast = atLeast(random, 1000); + int atLeast = scaledRandomIntBetween(1000, 1500); final int maxNumValues = randomBoolean() ? 1 : randomIntBetween(2, 40); byte[] values = new byte[maxNumValues]; for (int i = 0; i < atLeast; i++) { @@ -230,7 +224,7 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { final DocumentMapper mapper = MapperTestUtils.newParser().parse(mapping); Random random = getRandom(); - int atLeast = atLeast(random, 1000); + int atLeast = scaledRandomIntBetween(1000, 1500); final int maxNumValues = randomBoolean() ? 1 : randomIntBetween(2, 40); float[] values = new float[maxNumValues]; for (int i = 0; i < atLeast; i++) { @@ -302,7 +296,7 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { @Test public void testDuelStrings() throws Exception { Random random = getRandom(); - int atLeast = atLeast(random, 1000); + int atLeast = scaledRandomIntBetween(1000, 1500); for (int i = 0; i < atLeast; i++) { Document d = new Document(); d.add(new StringField("_id", "" + i, Field.Store.NO)); @@ -377,7 +371,7 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { final DocumentMapper mapper = MapperTestUtils.newParser().parse(mapping); Random random = getRandom(); - int atLeast = atLeast(random, 1000); + int atLeast = scaledRandomIntBetween(1000, 1500); int maxValuesPerDoc = randomBoolean() ? 1 : randomIntBetween(2, 40); // to test deduplication double defaultLat = randomDouble() * 180 - 90; diff --git a/src/test/java/org/elasticsearch/index/fielddata/FieldDataFilterIntegrationTests.java b/src/test/java/org/elasticsearch/index/fielddata/FieldDataFilterIntegrationTests.java index 4dc76f85882..9514df2c827 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/FieldDataFilterIntegrationTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/FieldDataFilterIntegrationTests.java @@ -65,7 +65,7 @@ public class FieldDataFilterIntegrationTests extends ElasticsearchIntegrationTes .endObject().endObject(); assertAcked(builder.addMapping("type", mapping)); ensureGreen(); - int numDocs = atLeast(5); + int numDocs = scaledRandomIntBetween(5, 50); for (int i = 0; i < numDocs; i++) { client().prepareIndex("test", "type", "" + 0).setSource("name", "bacon bastards", "not_filtered", "bacon bastards").get(); } diff --git a/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java b/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java index e1565f59b89..0a90c0935a5 100644 --- a/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java +++ b/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java @@ -1702,7 +1702,7 @@ public class SimpleIndexQueryParserTests extends ElasticsearchTestCase { "{\"flt\": {\"fields\": [\"comment\"], \"like_text\": \"FFFdfds\",\"fuzziness\": 4}}", "{\"flt\": {\"fields\": [\"comment\"], \"like_text\": \"FFFdfds\",\"fuzziness\": 4.0}}" }; - int iters = atLeast(5); + int iters = scaledRandomIntBetween(5, 100); for (int i = 0; i < iters; i++) { parsedQuery = queryParser.parse(new BytesArray((String) randomFrom(queries))).query(); parsedQuery1 = queryParser.parse(new BytesArray((String) randomFrom(queries))).query(); diff --git a/src/test/java/org/elasticsearch/indices/fielddata/breaker/CircuitBreakerServiceTests.java b/src/test/java/org/elasticsearch/indices/fielddata/breaker/CircuitBreakerServiceTests.java index 16f2de999d1..c429b6a4eee 100644 --- a/src/test/java/org/elasticsearch/indices/fielddata/breaker/CircuitBreakerServiceTests.java +++ b/src/test/java/org/elasticsearch/indices/fielddata/breaker/CircuitBreakerServiceTests.java @@ -57,7 +57,7 @@ public class CircuitBreakerServiceTests extends ElasticsearchIntegrationTest { try { // index some different terms so we have some field data for loading - int docCount = atLeast(300); + int docCount = scaledRandomIntBetween(300, 1000); for (long id = 0; id < docCount; id++) { client.prepareIndex("cb-test", "type", Long.toString(id)) .setSource(MapBuilder.newMapBuilder().put("test", "value" + id).map()).execute().actionGet(); @@ -108,7 +108,7 @@ public class CircuitBreakerServiceTests extends ElasticsearchIntegrationTest { client.admin().cluster().prepareHealth("ramtest").setWaitForGreenStatus().setTimeout("10s").execute().actionGet(); // index some different terms so we have some field data for loading - int docCount = atLeast(300); + int docCount = scaledRandomIntBetween(300, 1000); for (long id = 0; id < docCount; id++) { client.prepareIndex("ramtest", "type", Long.toString(id)) .setSource(MapBuilder.newMapBuilder().put("test", "value" + id).map()).execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/indices/fielddata/breaker/RandomExceptionCircuitBreakerTests.java b/src/test/java/org/elasticsearch/indices/fielddata/breaker/RandomExceptionCircuitBreakerTests.java index a6097a5ef2a..f5728fad494 100644 --- a/src/test/java/org/elasticsearch/indices/fielddata/breaker/RandomExceptionCircuitBreakerTests.java +++ b/src/test/java/org/elasticsearch/indices/fielddata/breaker/RandomExceptionCircuitBreakerTests.java @@ -140,7 +140,7 @@ public class RandomExceptionCircuitBreakerTests extends ElasticsearchIntegration logger.info("Refresh failed: [{}] numShardsFailed: [{}], shardFailuresLength: [{}], successfulShards: [{}], totalShards: [{}] ", refreshFailed, refreshResponse.getFailedShards(), refreshResponse.getShardFailures().length, refreshResponse.getSuccessfulShards(), refreshResponse.getTotalShards()); - final int numSearches = atLeast(50); + final int numSearches = scaledRandomIntBetween(50, 150); NodesStatsResponse resp = client().admin().cluster().prepareNodesStats() .clear().setBreaker(true).execute().actionGet(); for (NodeStats stats : resp.getNodes()) { diff --git a/src/test/java/org/elasticsearch/indices/mapping/ConcurrentDynamicTemplateTests.java b/src/test/java/org/elasticsearch/indices/mapping/ConcurrentDynamicTemplateTests.java index 30027f595eb..9f3efdc4566 100644 --- a/src/test/java/org/elasticsearch/indices/mapping/ConcurrentDynamicTemplateTests.java +++ b/src/test/java/org/elasticsearch/indices/mapping/ConcurrentDynamicTemplateTests.java @@ -50,13 +50,13 @@ public class ConcurrentDynamicTemplateTests extends ElasticsearchIntegrationTest // The 'fieldNames' array is used to help with retrieval of index terms // after testing - int iters = atLeast(5); + int iters = scaledRandomIntBetween(5, 15); for (int i = 0; i < iters; i++) { wipeIndices("test"); assertAcked(prepareCreate("test") .addMapping(mappingType, mapping)); ensureYellow(); - int numDocs = atLeast(10); + int numDocs = scaledRandomIntBetween(10, 100); final CountDownLatch latch = new CountDownLatch(numDocs); final List throwable = new CopyOnWriteArrayList(); int currentID = 0; diff --git a/src/test/java/org/elasticsearch/indices/template/IndexTemplateFileLoadingTests.java b/src/test/java/org/elasticsearch/indices/template/IndexTemplateFileLoadingTests.java index 989f9745302..9718638b852 100644 --- a/src/test/java/org/elasticsearch/indices/template/IndexTemplateFileLoadingTests.java +++ b/src/test/java/org/elasticsearch/indices/template/IndexTemplateFileLoadingTests.java @@ -79,7 +79,7 @@ public class IndexTemplateFileLoadingTests extends ElasticsearchIntegrationTest @Test public void testThatLoadingTemplateFromFileWorks() throws Exception { - final int iters = atLeast(5); + final int iters = scaledRandomIntBetween(5, 20); Set indices = new HashSet(); for (int i = 0; i < iters; i++) { String indexName = "foo" + randomRealisticUnicodeOfLengthBetween(0, 5); diff --git a/src/test/java/org/elasticsearch/percolator/PercolatorFacetsAndAggregationsTests.java b/src/test/java/org/elasticsearch/percolator/PercolatorFacetsAndAggregationsTests.java index 83e25caf78a..d60f1656acb 100644 --- a/src/test/java/org/elasticsearch/percolator/PercolatorFacetsAndAggregationsTests.java +++ b/src/test/java/org/elasticsearch/percolator/PercolatorFacetsAndAggregationsTests.java @@ -51,7 +51,7 @@ public class PercolatorFacetsAndAggregationsTests extends ElasticsearchIntegrati client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); - int numQueries = atLeast(250); + int numQueries = scaledRandomIntBetween(250, 500); int numUniqueQueries = between(1, numQueries / 2); String[] values = new String[numUniqueQueries]; for (int i = 0; i < values.length; i++) { diff --git a/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java b/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java index 92729f66ea0..358fafecc23 100644 --- a/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java +++ b/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java @@ -310,7 +310,7 @@ public class RecoveryWhileUnderLoadTests extends ElasticsearchIntegrationTest { final AtomicLong idGenerator = new AtomicLong(); final AtomicLong indexCounter = new AtomicLong(); final AtomicBoolean stop = new AtomicBoolean(false); - Thread[] writers = new Thread[atLeast(3)]; + Thread[] writers = new Thread[scaledRandomIntBetween(3, 10)]; final CountDownLatch stopLatch = new CountDownLatch(writers.length); logger.info("--> starting {} indexing threads", writers.length); final CopyOnWriteArrayList failures = new CopyOnWriteArrayList(); diff --git a/src/test/java/org/elasticsearch/recovery/RelocationTests.java b/src/test/java/org/elasticsearch/recovery/RelocationTests.java index c9c24e0751f..bec55321fe3 100644 --- a/src/test/java/org/elasticsearch/recovery/RelocationTests.java +++ b/src/test/java/org/elasticsearch/recovery/RelocationTests.java @@ -108,8 +108,8 @@ public class RelocationTests extends ElasticsearchIntegrationTest { @Test @Slow public void testPrimaryRelocationWhileIndexingRandom() throws Exception { - int numRelocations = atLeast(rarely() ? 3 : 1); - int numWriters = atLeast(rarely() ? 3 : 1); + int numRelocations = scaledRandomIntBetween(1, rarely() ? 10 : 4); + int numWriters = scaledRandomIntBetween(1, rarely() ? 10 : 4); boolean batch = getRandom().nextBoolean(); logger.info("testPrimaryRelocationWhileIndexingRandom(numRelocations={}, numWriters={}, batch={}", numRelocations, numWriters, batch); @@ -261,8 +261,8 @@ public class RelocationTests extends ElasticsearchIntegrationTest { @Test @Slow public void testReplicaRelocationWhileIndexingRandom() throws Exception { - int numRelocations = atLeast(rarely() ? 3 : 1); - int numWriters = atLeast(rarely() ? 3 : 1); + int numRelocations = scaledRandomIntBetween(1, rarely() ? 10 : 4); + int numWriters = scaledRandomIntBetween(1, rarely() ? 10 : 4); boolean batch = getRandom().nextBoolean(); logger.info("testReplicaRelocationWhileIndexing(numRelocations={}, numWriters={}, batch={}", numRelocations, numWriters, batch); testReplicaRelocationWhileIndexing(numRelocations, numWriters, batch); diff --git a/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java b/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java index fa0f0245de8..52d29ff99ea 100644 --- a/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java +++ b/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java @@ -26,13 +26,13 @@ import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.ElasticsearchIntegrationTest; +import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.junit.Test; import java.util.concurrent.ExecutionException; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; -import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.*; +import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.SUITE; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; @@ -48,7 +48,7 @@ public class StressSearchServiceReaperTest extends ElasticsearchIntegrationTest @Slow @Test // see issue #5165 - this test fails each time without the fix in pull #5170 public void testStressReaper() throws ExecutionException, InterruptedException { - int num = atLeast(100); + int num = randomIntBetween(100, 150); IndexRequestBuilder[] builders = new IndexRequestBuilder[num]; for (int i = 0; i < builders.length; i++) { builders[i] = client().prepareIndex("test", "type", "" + i).setSource("f", English.intToEnglish(i)); @@ -56,7 +56,7 @@ public class StressSearchServiceReaperTest extends ElasticsearchIntegrationTest createIndex("test"); indexRandom(true, builders); ensureYellow(); - final int iterations = atLeast(500); + final int iterations = scaledRandomIntBetween(500, 1000); for (int i = 0; i < iterations; i++) { SearchResponse searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()).setSize(num).get(); assertNoFailures(searchResponse); diff --git a/src/test/java/org/elasticsearch/search/aggregations/RandomTests.java b/src/test/java/org/elasticsearch/search/aggregations/RandomTests.java index 8566de8f641..041e37be5f8 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/RandomTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/RandomTests.java @@ -51,7 +51,7 @@ public class RandomTests extends ElasticsearchIntegrationTest { // Make sure that unordered, reversed, disjoint and/or overlapping ranges are supported // Duel with filters public void testRandomRanges() throws Exception { - final int numDocs = atLeast(1000); + final int numDocs = scaledRandomIntBetween(1000, 10000); final double[][] docs = new double[numDocs][]; for (int i = 0; i < numDocs; ++i) { final int numValues = randomInt(5); @@ -142,7 +142,7 @@ public class RandomTests extends ElasticsearchIntegrationTest { // test long/double/string terms aggs with high number of buckets that require array growth public void testDuelTerms() throws Exception { // These high numbers of docs and terms are important to trigger page recycling - final int numDocs = atLeast(10000); + final int numDocs = scaledRandomIntBetween(10000, 20000); final int maxNumTerms = randomIntBetween(10, 100000); final IntOpenHashSet valuesSet = new IntOpenHashSet(); @@ -221,7 +221,7 @@ public class RandomTests extends ElasticsearchIntegrationTest { public void testDuelTermsHistogram() throws Exception { createIndex("idx"); - final int numDocs = atLeast(1000); + final int numDocs = scaledRandomIntBetween(1000, 5000); final int maxNumTerms = randomIntBetween(10, 2000); final int interval = randomIntBetween(1, 100); @@ -267,7 +267,8 @@ public class RandomTests extends ElasticsearchIntegrationTest { // test high numbers of percentile buckets to make sure paging and release work correctly createIndex("idx"); - final int numDocs = atLeast(25000); + final int numDocs = scaledRandomIntBetween(25000, 50000); + logger.info("Indexing [" + numDocs +"] docs"); int t = 0; for (int i = 0; i < numDocs; ) { BulkRequestBuilder request = client().prepareBulk(); diff --git a/src/test/java/org/elasticsearch/search/aggregations/metrics/GroupTreeTests.java b/src/test/java/org/elasticsearch/search/aggregations/metrics/GroupTreeTests.java index 5f29ef30b9f..7279cb6894a 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/metrics/GroupTreeTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/metrics/GroupTreeTests.java @@ -37,7 +37,7 @@ public class GroupTreeTests extends ElasticsearchTestCase { GroupRedBlackTree tree2 = new GroupRedBlackTree(randomInt(100)); // Add elements - final int elements = atLeast(100); + final int elements = scaledRandomIntBetween(100, 1000); for (int i = 0; i < elements; ++i) { final double centroid = randomDouble(); final int count = randomIntBetween(1, 5); diff --git a/src/test/java/org/elasticsearch/search/aggregations/metrics/RedBlackTreeTests.java b/src/test/java/org/elasticsearch/search/aggregations/metrics/RedBlackTreeTests.java index 4dc14111b22..d3e7888fb46 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/metrics/RedBlackTreeTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/metrics/RedBlackTreeTests.java @@ -106,7 +106,7 @@ public class RedBlackTreeTests extends ElasticsearchTestCase { public void testAdd() { Map map = Maps.newHashMap(); IntRedBlackTree tree = new IntRedBlackTree(); - final int iters = atLeast(1000); + final int iters = scaledRandomIntBetween(1000, 10000); for (int i = 0; i < iters; ++i) { final int value = randomInt(200); final boolean added = tree.add(value); @@ -133,7 +133,7 @@ public class RedBlackTreeTests extends ElasticsearchTestCase { } public void testRemove() { - final int numValues = atLeast(200); + final int numValues = scaledRandomIntBetween(200, 1000); final FixedBitSet values = new FixedBitSet(numValues); values.set(0, numValues); IntRedBlackTree tree = new IntRedBlackTree(); @@ -141,7 +141,7 @@ public class RedBlackTreeTests extends ElasticsearchTestCase { tree.add(i); } - final int iters = atLeast(300); + final int iters = scaledRandomIntBetween(300, 1000); for (int i = 0; i < iters; ++i) { final int value = randomInt(numValues - 1); final boolean removed = tree.remove(value); @@ -165,7 +165,7 @@ public class RedBlackTreeTests extends ElasticsearchTestCase { public void testReverse() { IntRedBlackTree tree = new IntRedBlackTree(); - final int iters = atLeast(1000); + final int iters = scaledRandomIntBetween(1000, 10000); for (int i = 0; i < iters; ++i) { final int value = randomInt(2000); tree.add(value); diff --git a/src/test/java/org/elasticsearch/search/aggregations/metrics/cardinality/HyperLogLogPlusPlusTests.java b/src/test/java/org/elasticsearch/search/aggregations/metrics/cardinality/HyperLogLogPlusPlusTests.java index d19ad83a6df..02316cfb387 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/metrics/cardinality/HyperLogLogPlusPlusTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/metrics/cardinality/HyperLogLogPlusPlusTests.java @@ -33,7 +33,7 @@ public class HyperLogLogPlusPlusTests extends ElasticsearchTestCase { @Test public void encodeDecode() { - final int iters = atLeast(100000); + final int iters = scaledRandomIntBetween(100000, 500000); // random hashes for (int i = 0; i < iters; ++i) { final int p1 = randomIntBetween(4, 24); diff --git a/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java b/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java index 4a700e9de31..c462b86bbf3 100644 --- a/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java +++ b/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java @@ -72,11 +72,11 @@ public class SearchWhileRelocatingTests extends ElasticsearchIntegrationTest { } indexRandom(true, indexBuilders.toArray(new IndexRequestBuilder[indexBuilders.size()])); assertHitCount(client().prepareSearch().get(), (long) (numDocs)); - final int numIters = atLeast(10); + final int numIters = scaledRandomIntBetween(10, 20); for (int i = 0; i < numIters; i++) { final AtomicBoolean stop = new AtomicBoolean(false); final List thrownExceptions = new CopyOnWriteArrayList(); - Thread[] threads = new Thread[atLeast(1)]; + Thread[] threads = new Thread[scaledRandomIntBetween(1, 3)]; for (int j = 0; j < threads.length; j++) { threads[j] = new Thread() { public void run() { diff --git a/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsTests.java b/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsTests.java index 076969d2be9..ff72a39a351 100644 --- a/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsTests.java +++ b/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsTests.java @@ -126,12 +126,11 @@ public class SearchWithRandomExceptionsTests extends ElasticsearchIntegrationTes RefreshResponse refreshResponse = client().admin().indices().prepareRefresh("test").execute().get(); // don't assert on failures here final boolean refreshFailed = refreshResponse.getShardFailures().length != 0 || refreshResponse.getFailedShards() != 0; logger.info("Refresh failed [{}] numShardsFailed: [{}], shardFailuresLength: [{}], successfulShards: [{}], totalShards: [{}] ", refreshFailed, refreshResponse.getFailedShards(), refreshResponse.getShardFailures().length, refreshResponse.getSuccessfulShards(), refreshResponse.getTotalShards()); - final int numSearches = atLeast(10); + final int numSearches = scaledRandomIntBetween(10, 20); // we don't check anything here really just making sure we don't leave any open files or a broken index behind. for (int i = 0; i < numSearches; i++) { try { int docToQuery = between(0, numDocs-1); - long expectedResults = added[docToQuery] ? 1 : 0; logger.info("Searching for [test:{}]", English.intToEnglish(docToQuery)); SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.matchQuery("test", English.intToEnglish(docToQuery))).get(); logger.info("Successful shards: [{}] numShards: [{}]", searchResponse.getSuccessfulShards(), test.numPrimaries); @@ -212,7 +211,7 @@ public class SearchWithRandomExceptionsTests extends ElasticsearchIntegrationTes logger.info("Refresh failed [{}] numShardsFailed: [{}], shardFailuresLength: [{}], successfulShards: [{}], totalShards: [{}] ", refreshFailed, refreshResponse.getFailedShards(), refreshResponse.getShardFailures().length, refreshResponse.getSuccessfulShards(), refreshResponse.getTotalShards()); NumShards test = getNumShards("test"); - final int numSearches = atLeast(100); + final int numSearches = scaledRandomIntBetween(100, 200); // we don't check anything here really just making sure we don't leave any open files or a broken index behind. for (int i = 0; i < numSearches; i++) { try { diff --git a/src/test/java/org/elasticsearch/search/facet/SimpleFacetsTests.java b/src/test/java/org/elasticsearch/search/facet/SimpleFacetsTests.java index 79d242a7ab1..c52127d7e5c 100644 --- a/src/test/java/org/elasticsearch/search/facet/SimpleFacetsTests.java +++ b/src/test/java/org/elasticsearch/search/facet/SimpleFacetsTests.java @@ -70,7 +70,7 @@ public class SimpleFacetsTests extends ElasticsearchIntegrationTest { protected int numberOfRuns() { if (numRuns == -1) { - numRuns = atLeast(3); + numRuns = scaledRandomIntBetween(3, 10); } return numRuns; } diff --git a/src/test/java/org/elasticsearch/search/functionscore/RandomScoreFunctionTests.java b/src/test/java/org/elasticsearch/search/functionscore/RandomScoreFunctionTests.java index d39792aec7c..77cfb29e9c3 100644 --- a/src/test/java/org/elasticsearch/search/functionscore/RandomScoreFunctionTests.java +++ b/src/test/java/org/elasticsearch/search/functionscore/RandomScoreFunctionTests.java @@ -41,17 +41,17 @@ public class RandomScoreFunctionTests extends ElasticsearchIntegrationTest { public void consistentHitsWithSameSeed() throws Exception { createIndex("test"); ensureGreen(); // make sure we are done otherwise preference could change? - int docCount = atLeast(100); + int docCount = randomIntBetween(100, 200); for (int i = 0; i < docCount; i++) { index("test", "type", "" + i, jsonBuilder().startObject().endObject()); } flush(); refresh(); - int outerIters = atLeast(10); + int outerIters = scaledRandomIntBetween(10, 20); for (int o = 0; o < outerIters; o++) { final long seed = randomLong(); final String preference = randomRealisticUnicodeOfLengthBetween(1, 10); // at least one char!! - int innerIters = atLeast(2); + int innerIters = scaledRandomIntBetween(2, 5); SearchHits hits = null; for (int i = 0; i < innerIters; i++) { SearchResponse searchResponse = client().prepareSearch() diff --git a/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchTests.java b/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchTests.java index 62a2d647de5..b53e1f2e48e 100644 --- a/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchTests.java +++ b/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchTests.java @@ -2091,7 +2091,7 @@ public class HighlighterSearchTests extends ElasticsearchIntegrationTest { .setSource("field1", "The quick brown fox jumps over", "field2", "The quick brown fox jumps over").get(); refresh(); - final int iters = atLeast(20); + final int iters = scaledRandomIntBetween(20, 30); for (int i = 0; i < iters; i++) { MultiMatchQueryBuilder.Type matchQueryType = rarely() ? null : RandomPicks.randomFrom(getRandom(), MultiMatchQueryBuilder.Type.values()); final MultiMatchQueryBuilder multiMatchQueryBuilder = multiMatchQuery("the quick brown fox", "field1", "field2").type(matchQueryType); diff --git a/src/test/java/org/elasticsearch/search/matchedqueries/MatchedQueriesTests.java b/src/test/java/org/elasticsearch/search/matchedqueries/MatchedQueriesTests.java index ba510ab11f6..8c31f87d4d8 100644 --- a/src/test/java/org/elasticsearch/search/matchedqueries/MatchedQueriesTests.java +++ b/src/test/java/org/elasticsearch/search/matchedqueries/MatchedQueriesTests.java @@ -217,7 +217,7 @@ public class MatchedQueriesTests extends ElasticsearchIntegrationTest { refresh(); // Execute search at least two times to load it in cache - int iter = atLeast(2); + int iter = scaledRandomIntBetween(2, 10); for (int i = 0; i < iter; i++) { SearchResponse searchResponse = client().prepareSearch() .setQuery( diff --git a/src/test/java/org/elasticsearch/search/query/MultiMatchQueryTests.java b/src/test/java/org/elasticsearch/search/query/MultiMatchQueryTests.java index 51800040c08..ec3e4781363 100644 --- a/src/test/java/org/elasticsearch/search/query/MultiMatchQueryTests.java +++ b/src/test/java/org/elasticsearch/search/query/MultiMatchQueryTests.java @@ -64,7 +64,7 @@ public class MultiMatchQueryTests extends ElasticsearchIntegrationTest { ); assertAcked(builder.addMapping("test", createMapping())); ensureGreen(); - int numDocs = atLeast(50); + int numDocs = scaledRandomIntBetween(50, 100); List builders = new ArrayList(); builders.add(client().prepareIndex("test", "test", "theone").setSource( "full_name", "Captain America", @@ -275,7 +275,7 @@ public class MultiMatchQueryTests extends ElasticsearchIntegrationTest { final int numDocs = (int) client().prepareCount("test") .setQuery(matchAllQuery()).get().getCount(); - int numIters = atLeast(5); + int numIters = scaledRandomIntBetween(5, 10); for (int i = 0; i < numIters; i++) { { MatchQueryBuilder.Type type = randomBoolean() ? null : MatchQueryBuilder.Type.BOOLEAN; diff --git a/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java b/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java index f467b8f861a..8bdc1e2c5e0 100644 --- a/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java +++ b/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java @@ -196,7 +196,7 @@ public class SimpleQueryTests extends ElasticsearchIntegrationTest { assertSearchHit(searchHit, hasScore(1.0f)); } - int num = atLeast(100); + int num = scaledRandomIntBetween(100, 200); IndexRequestBuilder[] builders = new IndexRequestBuilder[num]; for (int i = 0; i < builders.length; i++) { builders[i] = client().prepareIndex("test", "type", "" + i).setSource("f", English.intToEnglish(i)); @@ -204,7 +204,7 @@ public class SimpleQueryTests extends ElasticsearchIntegrationTest { createIndex("test_1"); indexRandom(true, builders); ensureYellow(); - int queryRounds = atLeast(10); + int queryRounds = scaledRandomIntBetween(10, 20); for (int i = 0; i < queryRounds; i++) { MatchQueryBuilder matchQuery = matchQuery("f", English.intToEnglish(between(0, num))); searchResponse = client().prepareSearch("test_1").setQuery(matchQuery).setSize(num).get(); @@ -241,7 +241,7 @@ public class SimpleQueryTests extends ElasticsearchIntegrationTest { indexRandom(true, client().prepareIndex("test", "type1", "1").setSource("foo", "bar"), client().prepareIndex("test", "type1", "2").setSource("foo", "bar") ); - int iters = atLeast(100); + int iters = scaledRandomIntBetween(100, 200); for (int i = 0; i < iters; i++) { SearchResponse searchResponse = client().prepareSearch("test").setQuery(queryString("*:*^10.0").boost(10.0f)).get(); assertHitCount(searchResponse, 2l); @@ -356,7 +356,7 @@ public class SimpleQueryTests extends ElasticsearchIntegrationTest { @Test public void testOmitTermFreqsAndPositions() throws Exception { Version version = Version.CURRENT; - int iters = atLeast(10); + int iters = scaledRandomIntBetween(10, 20); for (int i = 0; i < iters; i++) { try { // backwards compat test! diff --git a/src/test/java/org/elasticsearch/search/rescore/QueryRescorerTests.java b/src/test/java/org/elasticsearch/search/rescore/QueryRescorerTests.java index 03e96977e11..f121afb5a9d 100644 --- a/src/test/java/org/elasticsearch/search/rescore/QueryRescorerTests.java +++ b/src/test/java/org/elasticsearch/search/rescore/QueryRescorerTests.java @@ -55,7 +55,7 @@ public class QueryRescorerTests extends ElasticsearchIntegrationTest { public void testEnforceWindowSize() { createIndex("test"); // this - int iters = atLeast(10); + int iters = scaledRandomIntBetween(10, 20); for (int i = 0; i < iters; i ++) { client().prepareIndex("test", "type", Integer.toString(i)).setSource("f", Integer.toString(i)).execute().actionGet(); } @@ -236,7 +236,7 @@ public class QueryRescorerTests extends ElasticsearchIntegrationTest { public void testEquivalence() throws Exception { int numDocs = indexRandomNumbers("whitespace"); - final int iters = atLeast(50); + final int iters = scaledRandomIntBetween(50, 100); for (int i = 0; i < iters; i++) { int resultSize = between(5, 30); int rescoreWindow = between(1, 3) * resultSize; @@ -542,7 +542,7 @@ public class QueryRescorerTests extends ElasticsearchIntegrationTest { jsonBuilder().startObject().startObject("type1").startObject("properties").startObject("field1") .field("analyzer", analyzer).field("type", "string").endObject().endObject().endObject().endObject()) .setSettings(builder)); - int numDocs = atLeast(100); + int numDocs = randomIntBetween(100, 150); IndexRequestBuilder[] docs = new IndexRequestBuilder[numDocs]; for (int i = 0; i < numDocs; i++) { docs[i] = client().prepareIndex("test", "type1", String.valueOf(i)).setSource("field1", English.intToEnglish(i)); diff --git a/src/test/java/org/elasticsearch/search/scan/SearchScanScrollingTests.java b/src/test/java/org/elasticsearch/search/scan/SearchScanScrollingTests.java index 0ec7ba09c24..5a11bd3a042 100644 --- a/src/test/java/org/elasticsearch/search/scan/SearchScanScrollingTests.java +++ b/src/test/java/org/elasticsearch/search/scan/SearchScanScrollingTests.java @@ -38,7 +38,7 @@ public class SearchScanScrollingTests extends ElasticsearchIntegrationTest { @Test public void testRandomized() throws Exception { - testScroll(atLeast(100), between(1, 300), getRandom().nextBoolean(), getRandom().nextBoolean()); + testScroll(scaledRandomIntBetween(100, 200), between(1, 300), getRandom().nextBoolean(), getRandom().nextBoolean()); } private void testScroll(long numberOfDocs, int size, boolean unbalanced, boolean trackScores) throws Exception { diff --git a/src/test/java/org/elasticsearch/search/scan/SearchScanTests.java b/src/test/java/org/elasticsearch/search/scan/SearchScanTests.java index 08a7a198130..5da287c0c09 100644 --- a/src/test/java/org/elasticsearch/search/scan/SearchScanTests.java +++ b/src/test/java/org/elasticsearch/search/scan/SearchScanTests.java @@ -45,7 +45,7 @@ public class SearchScanTests extends ElasticsearchIntegrationTest { Set ids = Sets.newHashSet(); Set expectedIds = Sets.newHashSet(); - IndexRequestBuilder[] builders = new IndexRequestBuilder[atLeast(50)]; + IndexRequestBuilder[] builders = new IndexRequestBuilder[scaledRandomIntBetween(50, 100)]; for (int i = 0; i < builders.length/2; i++) { expectedIds.add(Integer.toString(i)); builders[i] = client().prepareIndex("test", "tweet", Integer.toString(i)).setSource( diff --git a/src/test/java/org/elasticsearch/search/simple/SimpleSearchTests.java b/src/test/java/org/elasticsearch/search/simple/SimpleSearchTests.java index 28e74c0124e..edb739feb6a 100644 --- a/src/test/java/org/elasticsearch/search/simple/SimpleSearchTests.java +++ b/src/test/java/org/elasticsearch/search/simple/SimpleSearchTests.java @@ -33,9 +33,7 @@ import java.util.concurrent.ExecutionException; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.rangeQuery; -import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; -import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; -import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; public class SimpleSearchTests extends ElasticsearchIntegrationTest { @@ -66,7 +64,7 @@ public class SimpleSearchTests extends ElasticsearchIntegrationTest { client().prepareIndex("test", "type", "5").setSource("field", "value"), client().prepareIndex("test", "type", "6").setSource("field", "value")); - int iters = atLeast(10); + int iters = scaledRandomIntBetween(10, 20); for (int i = 0; i < iters; i++) { // id is not indexed, but lets see that we automatically convert to SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).setPreference(randomUnicodeOfLengthBetween(0, 4)).get(); diff --git a/src/test/java/org/elasticsearch/search/sort/SimpleSortTests.java b/src/test/java/org/elasticsearch/search/sort/SimpleSortTests.java index 06e193eeca6..e2c318791bc 100644 --- a/src/test/java/org/elasticsearch/search/sort/SimpleSortTests.java +++ b/src/test/java/org/elasticsearch/search/sort/SimpleSortTests.java @@ -122,7 +122,7 @@ public class SimpleSortTests extends ElasticsearchIntegrationTest { TreeMap sparseBytes = new TreeMap(); TreeMap denseBytes = new TreeMap(); - int numDocs = atLeast(200); + int numDocs = randomIntBetween(200, 300); IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs]; for (int i = 0; i < numDocs; i++) { String docId = Integer.toString(i); @@ -1458,7 +1458,7 @@ public class SimpleSortTests extends ElasticsearchIntegrationTest { .startObject("_timestamp").field("enabled", true).field("store", true).field("index", !timestampDocValues || randomBoolean() ? "not_analyzed" : "no").startObject("fielddata").field("format", timestampDocValues ? "doc_values" : null).endObject().endObject() .endObject().endObject())); ensureGreen(); - final int numDocs = atLeast(10); + final int numDocs = randomIntBetween(10, 20); IndexRequestBuilder[] indexReqs = new IndexRequestBuilder[numDocs]; for (int i = 0; i < numDocs; ++i) { indexReqs[i] = client().prepareIndex("test", "typ", Integer.toString(i)).setTimestamp(Integer.toString(randomInt(1000))).setSource(); diff --git a/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java b/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java index 1eb5f5a3f75..48d8daa047e 100644 --- a/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java +++ b/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java @@ -977,10 +977,10 @@ public class CompletionSuggestSearchTests extends ElasticsearchIntegrationTest { @Test public void testMaxFieldLength() throws IOException { client().admin().indices().prepareCreate(INDEX).get(); - int iters = atLeast(10); + int iters = scaledRandomIntBetween(10, 20); for (int i = 0; i < iters; i++) { int maxInputLen = between(3, 50); - String str = replaceReservedChars(randomRealisticUnicodeOfCodepointLengthBetween(maxInputLen + 1, atLeast(maxInputLen + 2)), (char) 0x01); + String str = replaceReservedChars(randomRealisticUnicodeOfCodepointLengthBetween(maxInputLen + 1, maxInputLen + scaledRandomIntBetween(2, 50)), (char) 0x01); ElasticsearchAssertions.assertAcked(client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(jsonBuilder().startObject() .startObject(TYPE).startObject("properties") .startObject(FIELD) @@ -1025,7 +1025,7 @@ public class CompletionSuggestSearchTests extends ElasticsearchIntegrationTest { .endObject())); ensureYellow(); // can cause stack overflow without the default max_input_length - String longString = replaceReservedChars(randomRealisticUnicodeOfLength(atLeast(5000)), (char) 0x01); + String longString = replaceReservedChars(randomRealisticUnicodeOfLength(randomIntBetween(5000, 10000)), (char) 0x01); client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder() .startObject().startObject(FIELD) .startArray("input").value(longString).endArray() diff --git a/src/test/java/org/elasticsearch/search/suggest/completion/CompletionPostingsFormatTest.java b/src/test/java/org/elasticsearch/search/suggest/completion/CompletionPostingsFormatTest.java index 411c27268ca..9ad030503e4 100644 --- a/src/test/java/org/elasticsearch/search/suggest/completion/CompletionPostingsFormatTest.java +++ b/src/test/java/org/elasticsearch/search/suggest/completion/CompletionPostingsFormatTest.java @@ -128,7 +128,7 @@ public class CompletionPostingsFormatTest extends ElasticsearchTestCase { XAnalyzingSuggester reference = new XAnalyzingSuggester(new StandardAnalyzer(TEST_VERSION_CURRENT), null, new StandardAnalyzer( TEST_VERSION_CURRENT), options, 256, -1, preservePositionIncrements, null, false, 1, XAnalyzingSuggester.SEP_LABEL, XAnalyzingSuggester.PAYLOAD_SEP, XAnalyzingSuggester.END_BYTE, XAnalyzingSuggester.HOLE_CHARACTER); LineFileDocs docs = new LineFileDocs(getRandom()); - int num = atLeast(150); + int num = scaledRandomIntBetween(150, 300); final String[] titles = new String[num]; final long[] weights = new long[num]; for (int i = 0; i < titles.length; i++) { diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchLuceneTestCase.java b/src/test/java/org/elasticsearch/test/ElasticsearchLuceneTestCase.java index e9eebbecaa7..23329b4688d 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchLuceneTestCase.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchLuceneTestCase.java @@ -19,6 +19,7 @@ package org.elasticsearch.test; +import com.carrotsearch.randomizedtesting.RandomizedTest; import com.carrotsearch.randomizedtesting.annotations.*; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope; import org.apache.lucene.codecs.Codec; @@ -48,4 +49,8 @@ public abstract class ElasticsearchLuceneTestCase extends LuceneTestCase { public static void forceDefaultCodec() { Codec.setDefault(DEFAULT_CODEC); } + + public static int scaledRandomIntBetween(int min, int max) { + return RandomizedTest.scaledRandomIntBetween(min, max); + } } diff --git a/src/test/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java b/src/test/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java index 9f96310f83d..ecb05e12c47 100644 --- a/src/test/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java +++ b/src/test/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java @@ -115,7 +115,7 @@ public class ReproduceInfoPrinter extends RunListener { public ReproduceErrorMessageBuilder appendESProperties() { appendProperties("es.logger.level", "es.node.mode", "es.node.local", TestCluster.TESTS_ENABLE_MOCK_MODULES, - "tests.assertion.disabled", "tests.security.manager"); + "tests.assertion.disabled", "tests.security.manager", "tests.nighly"); if (System.getProperty("tests.jvm.argline") != null && !System.getProperty("tests.jvm.argline").isEmpty()) { appendOpt("tests.jvm.argline", "\"" + System.getProperty("tests.jvm.argline") + "\""); } diff --git a/src/test/java/org/elasticsearch/transport/netty/KeyedLockTests.java b/src/test/java/org/elasticsearch/transport/netty/KeyedLockTests.java index 28c0fda4cdf..3eb81d71cb7 100644 --- a/src/test/java/org/elasticsearch/transport/netty/KeyedLockTests.java +++ b/src/test/java/org/elasticsearch/transport/netty/KeyedLockTests.java @@ -76,7 +76,7 @@ public class KeyedLockTests extends ElasticsearchTestCase { KeyedLock connectionLock = new KeyedLock(); String[] names = new String[randomIntBetween(1, 40)]; connectionLock = new KeyedLock(); - String name = randomRealisticUnicodeOfLength(atLeast(10)); + String name = randomRealisticUnicodeOfLength(scaledRandomIntBetween(10, 50)); connectionLock.acquire(name); connectionLock.acquire(name); } @@ -88,7 +88,7 @@ public class KeyedLockTests extends ElasticsearchTestCase { KeyedLock connectionLock = new KeyedLock(); String[] names = new String[randomIntBetween(1, 40)]; connectionLock = new KeyedLock(); - String name = randomRealisticUnicodeOfLength(atLeast(10)); + String name = randomRealisticUnicodeOfLength(scaledRandomIntBetween(10, 50)); connectionLock.release(name); } @@ -114,7 +114,7 @@ public class KeyedLockTests extends ElasticsearchTestCase { } catch (InterruptedException e) { throw new RuntimeException(); } - int numRuns = atLeast(500); + int numRuns = scaledRandomIntBetween(500, 5000); for (int i = 0; i < numRuns; i++) { String curName = names[randomInt(names.length - 1)]; connectionLock.acquire(curName);