diff --git a/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasTests.java b/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasTests.java index fa90ca48bfc..9741aaae43f 100644 --- a/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasTests.java +++ b/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasTests.java @@ -55,7 +55,6 @@ import static org.hamcrest.Matchers.*; * Tests for indices that use shadow replicas and a shared filesystem */ @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numDataNodes = 0) -@LuceneTestCase.SuppressFileSystems("ExtrasFS") @Slow public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { diff --git a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java index cf150000046..429ee7ac775 100644 --- a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java +++ b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java @@ -92,7 +92,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.*; @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE) -@LuceneTestCase.SuppressFileSystems("ExtrasFS") // TODO: need to only do the checksum check on lucene files public class CorruptedFileTest extends ElasticsearchIntegrationTest { @Override diff --git a/src/test/java/org/elasticsearch/indices/IndicesCustomDataPathTests.java b/src/test/java/org/elasticsearch/indices/IndicesCustomDataPathTests.java index 4369b3aa7e4..628913dcefa 100644 --- a/src/test/java/org/elasticsearch/indices/IndicesCustomDataPathTests.java +++ b/src/test/java/org/elasticsearch/indices/IndicesCustomDataPathTests.java @@ -44,7 +44,6 @@ import static org.hamcrest.Matchers.equalTo; /** * Tests for custom data path locations and templates */ -@LuceneTestCase.SuppressFileSystems("ExtrasFS") //TODO: assertPathHasBeenCleared seems like a bad method altogether, should it be agnostic to extra files that already existed? public class IndicesCustomDataPathTests extends ElasticsearchIntegrationTest { private String path; diff --git a/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java b/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java index 35a3f662b90..e87fa1821af 100644 --- a/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java +++ b/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java @@ -81,7 +81,6 @@ import static org.hamcrest.Matchers.*; /** */ @ClusterScope(scope = Scope.TEST, numDataNodes = 0) -@LuceneTestCase.SuppressFileSystems("ExtrasFS") // not ready for this yet public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests { @Test diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java index ebfb6732fc9..94756ba67c8 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java @@ -32,6 +32,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.http.impl.client.HttpClients; import org.apache.lucene.store.StoreRateLimiting; import org.apache.lucene.util.IOUtils; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.TestUtil; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; @@ -226,6 +227,7 @@ import static org.hamcrest.Matchers.notNullValue; */ @Ignore @ElasticsearchIntegrationTest.Integration +@LuceneTestCase.SuppressFileSystems("ExtrasFS") // doesn't work with potential multi data path from test cluster yet public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase { /** diff --git a/src/test/java/org/elasticsearch/test/VersionUtils.java b/src/test/java/org/elasticsearch/test/VersionUtils.java index 8638b0d5e0d..316a3926d5d 100644 --- a/src/test/java/org/elasticsearch/test/VersionUtils.java +++ b/src/test/java/org/elasticsearch/test/VersionUtils.java @@ -88,7 +88,7 @@ public class VersionUtils { if (minVersion != null) { minVersionIndex = SORTED_VERSIONS.indexOf(minVersion); } - int maxVersionIndex = SORTED_VERSIONS.size(); + int maxVersionIndex = SORTED_VERSIONS.size() - 1; if (maxVersion != null) { maxVersionIndex = SORTED_VERSIONS.indexOf(maxVersion); } diff --git a/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java b/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java index a6639ea3d16..47bcff77b99 100644 --- a/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java +++ b/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java @@ -20,6 +20,7 @@ package org.elasticsearch.test.test; import com.google.common.collect.ImmutableSet; import org.apache.lucene.util.IOUtils; +import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.common.settings.Settings; @@ -41,6 +42,7 @@ import static org.hamcrest.Matchers.hasEntry; * Basic test that ensure that the internal cluster reproduces the same * configuration given the same seed / input. */ +@LuceneTestCase.SuppressFileSystems("ExtrasFS") // doesn't work with potential multi data path from test cluster yet public class InternalTestClusterTests extends ElasticsearchTestCase { public void testInitializiationIsConsistent() { diff --git a/src/test/java/org/elasticsearch/test/test/VersionUtilsTests.java b/src/test/java/org/elasticsearch/test/test/VersionUtilsTests.java index d9ff8e63198..450ff5ee1be 100644 --- a/src/test/java/org/elasticsearch/test/test/VersionUtilsTests.java +++ b/src/test/java/org/elasticsearch/test/test/VersionUtilsTests.java @@ -18,12 +18,14 @@ */ package org.elasticsearch.test.test; +import com.carrotsearch.randomizedtesting.annotations.Seed; import org.elasticsearch.Version; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.test.VersionUtils; import java.util.List; +@Seed("E619863BE07FF5CB") public class VersionUtilsTests extends ElasticsearchTestCase { public void testAllVersionsSorted() { @@ -34,30 +36,50 @@ public class VersionUtilsTests extends ElasticsearchTestCase { } public void testRandomVersionBetween() { - int numReps = randomIntBetween(10, 20); - while (numReps-- > 0) { - Version v1 = VersionUtils.randomVersion(random()); - Version v2 = VersionUtils.randomVersion(random()); - if (v1.after(v2)) { - Version tmp = v1; - v1 = v2; - v2 = tmp; - } - Version got = VersionUtils.randomVersionBetween(random(), v1, v2); - assertTrue(got.onOrAfter(v1)); - assertTrue(got.onOrBefore(v2)); + // full range + Version got = VersionUtils.randomVersionBetween(random(), VersionUtils.getFirstVersion(), Version.CURRENT); + assertTrue(got.onOrAfter(VersionUtils.getFirstVersion())); + assertTrue(got.onOrBefore(Version.CURRENT)); + got = VersionUtils.randomVersionBetween(random(), null, Version.CURRENT); + assertTrue(got.onOrAfter(VersionUtils.getFirstVersion())); + assertTrue(got.onOrBefore(Version.CURRENT)); + got = VersionUtils.randomVersionBetween(random(), VersionUtils.getFirstVersion(), null); + assertTrue(got.onOrAfter(VersionUtils.getFirstVersion())); + assertTrue(got.onOrBefore(Version.CURRENT)); - got = VersionUtils.randomVersionBetween(random(), null, v2); - assertTrue(got.onOrAfter(VersionUtils.getFirstVersion())); - assertTrue(got.onOrBefore(v2)); + // sub range + got = VersionUtils.randomVersionBetween(random(), Version.V_0_90_12, Version.V_1_4_5); + assertTrue(got.onOrAfter(Version.V_0_90_12)); + assertTrue(got.onOrBefore(Version.V_1_4_5)); - got = VersionUtils.randomVersionBetween(random(), v1, null); - assertTrue(got.onOrAfter(v1)); - assertTrue(got.onOrBefore(Version.CURRENT)); - - got = VersionUtils.randomVersionBetween(random(), v1, v1); - assertEquals(got, v1); - } + // unbounded lower + got = VersionUtils.randomVersionBetween(random(), null, Version.V_1_4_5); + assertTrue(got.onOrAfter(VersionUtils.getFirstVersion())); + assertTrue(got.onOrBefore(Version.V_1_4_5)); + got = VersionUtils.randomVersionBetween(random(), null, VersionUtils.allVersions().get(0)); + assertTrue(got.onOrAfter(VersionUtils.getFirstVersion())); + assertTrue(got.onOrBefore(VersionUtils.allVersions().get(0))); + // unbounded upper + got = VersionUtils.randomVersionBetween(random(), Version.V_0_90_12, null); + assertTrue(got.onOrAfter(Version.V_0_90_12)); + assertTrue(got.onOrBefore(Version.CURRENT)); + got = VersionUtils.randomVersionBetween(random(), VersionUtils.getPreviousVersion(), null); + assertTrue(got.onOrAfter(VersionUtils.getPreviousVersion())); + assertTrue(got.onOrBefore(Version.CURRENT)); + + // range of one + got = VersionUtils.randomVersionBetween(random(), VersionUtils.getFirstVersion(), VersionUtils.getFirstVersion()); + assertEquals(got, VersionUtils.getFirstVersion()); + got = VersionUtils.randomVersionBetween(random(), Version.CURRENT, Version.CURRENT); + assertEquals(got, Version.CURRENT); + got = VersionUtils.randomVersionBetween(random(), Version.V_1_2_4, Version.V_1_2_4); + assertEquals(got, Version.V_1_2_4); + + // implicit range of one + got = VersionUtils.randomVersionBetween(random(), null, VersionUtils.getFirstVersion()); + assertEquals(got, VersionUtils.getFirstVersion()); + got = VersionUtils.randomVersionBetween(random(), Version.CURRENT, null); + assertEquals(got, Version.CURRENT); } } diff --git a/src/test/java/org/elasticsearch/tribe/TribeTests.java b/src/test/java/org/elasticsearch/tribe/TribeTests.java index a9fc640e30f..880f88ef4d1 100644 --- a/src/test/java/org/elasticsearch/tribe/TribeTests.java +++ b/src/test/java/org/elasticsearch/tribe/TribeTests.java @@ -20,6 +20,7 @@ package org.elasticsearch.tribe; import com.google.common.collect.ImmutableMap; +import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.client.Client; @@ -58,6 +59,7 @@ import static org.hamcrest.Matchers.notNullValue; * does it by default. */ @Slow +@LuceneTestCase.SuppressFileSystems("ExtrasFS") // doesn't work with potential multi data path from test cluster yet public class TribeTests extends ElasticsearchIntegrationTest { public static final String SECOND_CLUSTER_NODE_PREFIX = "node_tribe2"; diff --git a/src/test/java/org/elasticsearch/watcher/FileWatcherTest.java b/src/test/java/org/elasticsearch/watcher/FileWatcherTest.java index 37fa1540c92..c5c2856f3ec 100644 --- a/src/test/java/org/elasticsearch/watcher/FileWatcherTest.java +++ b/src/test/java/org/elasticsearch/watcher/FileWatcherTest.java @@ -36,9 +36,6 @@ import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; -/** - * - */ @LuceneTestCase.SuppressFileSystems("ExtrasFS") public class FileWatcherTest extends ElasticsearchTestCase {