suppress extrasfs from integ tests, fix bug in random version util

This commit is contained in:
Ryan Ernst 2015-04-18 13:24:25 -07:00
parent c00f0ff08e
commit b46df4d5dc
10 changed files with 51 additions and 30 deletions

View File

@ -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 {

View File

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

View File

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

View File

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

View File

@ -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 {
/**

View File

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

View File

@ -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() {

View File

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

View File

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

View File

@ -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 {