Enabled mockfs on base test class. All tests pass. Added suppressions

with nocommits for tests that need to be investigated.
This commit is contained in:
Ryan Ernst 2015-04-16 00:25:02 -07:00
parent 4d44fa0192
commit 93e591c5fa
17 changed files with 41 additions and 11 deletions

View File

@ -78,6 +78,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo;
@LuceneTestCase.SuppressCodecs({"Lucene3x", "MockFixedIntBlock", "MockVariableIntBlock", "MockSep", "MockRandom", "Lucene40", "Lucene41", "Appending", "Lucene42", "Lucene45", "Lucene46", "Lucene49"}) @LuceneTestCase.SuppressCodecs({"Lucene3x", "MockFixedIntBlock", "MockVariableIntBlock", "MockSep", "MockRandom", "Lucene40", "Lucene41", "Appending", "Lucene42", "Lucene45", "Lucene46", "Lucene49"})
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numDataNodes = 0) @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numDataNodes = 0)
@LuceneTestCase.SuppressFileSystems("ExtrasFS")
public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegrationTest { public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegrationTest {
// TODO: test for proper exception on unsupported indexes (maybe via separate test?) // TODO: test for proper exception on unsupported indexes (maybe via separate test?)
// We have a 0.20.6.zip etc for this. // We have a 0.20.6.zip etc for this.

View File

@ -18,10 +18,10 @@
*/ */
package org.elasticsearch.common.blobstore; package org.elasticsearch.common.blobstore;
import com.carrotsearch.randomizedtesting.LifecycleScope;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefBuilder; import org.apache.lucene.util.BytesRefBuilder;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.common.blobstore.fs.FsBlobStore; import org.elasticsearch.common.blobstore.fs.FsBlobStore;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -41,6 +41,7 @@ import static com.google.common.collect.Maps.newHashMap;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
@LuceneTestCase.SuppressFileSystems("ExtrasFS")
public class BlobStoreTest extends ElasticsearchTestCase { public class BlobStoreTest extends ElasticsearchTestCase {
@Test @Test

View File

@ -20,6 +20,7 @@ package org.elasticsearch.env;
import org.apache.lucene.store.LockObtainFailedException; import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.ElasticsearchIllegalStateException; import org.elasticsearch.ElasticsearchIllegalStateException;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.io.PathUtils;
@ -46,6 +47,7 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
@LuceneTestCase.SuppressFileSystems("*") // nocommit: equality of paths with mockfs doesn't seem to work right, the got/expected are printed exactly the same...
public class NodeEnvironmentTests extends ElasticsearchTestCase { public class NodeEnvironmentTests extends ElasticsearchTestCase {
private final Settings idxSettings = ImmutableSettings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).build(); private final Settings idxSettings = ImmutableSettings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).build();

View File

@ -19,6 +19,7 @@
package org.elasticsearch.gateway; package org.elasticsearch.gateway;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.lucene.util.LuceneTestCase.Slow;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
@ -52,6 +53,7 @@ import static org.hamcrest.Matchers.nullValue;
*/ */
@ClusterScope(scope = Scope.TEST, numDataNodes = 0) @ClusterScope(scope = Scope.TEST, numDataNodes = 0)
@Slow @Slow
@LuceneTestCase.SuppressFileSystems("*") // nocommit: no idea...no exceptions, just 0 results from searches
public class GatewayIndexStateTests extends ElasticsearchIntegrationTest { public class GatewayIndexStateTests extends ElasticsearchIntegrationTest {
private final ESLogger logger = Loggers.getLogger(GatewayIndexStateTests.class); private final ESLogger logger = Loggers.getLogger(GatewayIndexStateTests.class);

View File

@ -73,6 +73,7 @@ import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.startsWith; import static org.hamcrest.Matchers.startsWith;
@LuceneTestCase.SuppressFileSystems("*") // nocommit: lots of checks on number of files in a dir here, but suppressing ExtraFS doesn't seem to work?
public class MetaDataStateFormatTest extends ElasticsearchTestCase { public class MetaDataStateFormatTest extends ElasticsearchTestCase {

View File

@ -47,6 +47,7 @@ import static org.hamcrest.Matchers.*;
* *
*/ */
@ClusterScope(numDataNodes =0, scope= Scope.TEST) @ClusterScope(numDataNodes =0, scope= Scope.TEST)
@SuppressFileSystems("*") // nocommit: no idea what is happening here...
public class QuorumGatewayTests extends ElasticsearchIntegrationTest { public class QuorumGatewayTests extends ElasticsearchIntegrationTest {
@Override @Override

View File

@ -19,6 +19,7 @@
package org.elasticsearch.gateway; package org.elasticsearch.gateway;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.lucene.util.LuceneTestCase.Slow;
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
import org.elasticsearch.action.admin.indices.recovery.ShardRecoveryResponse; import org.elasticsearch.action.admin.indices.recovery.ShardRecoveryResponse;
@ -58,6 +59,7 @@ import static org.hamcrest.Matchers.notNullValue;
*/ */
@ClusterScope(numDataNodes = 0, scope = Scope.TEST) @ClusterScope(numDataNodes = 0, scope = Scope.TEST)
@Slow @Slow
@LuceneTestCase.SuppressFileSystems("*") // nocommit: no idea...
public class RecoveryFromGatewayTests extends ElasticsearchIntegrationTest { public class RecoveryFromGatewayTests extends ElasticsearchIntegrationTest {
@Test @Test

View File

@ -19,6 +19,7 @@
package org.elasticsearch.index; package org.elasticsearch.index;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
@ -53,6 +54,7 @@ import static org.hamcrest.Matchers.*;
* Tests for indices that use shadow replicas and a shared filesystem * Tests for indices that use shadow replicas and a shared filesystem
*/ */
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numDataNodes = 0) @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numDataNodes = 0)
@LuceneTestCase.SuppressFileSystems("ExtrasFS")
public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest {
/** /**

View File

@ -22,6 +22,7 @@ package org.elasticsearch.index.store;
import com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.collect.Lists; import com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.collect.Lists;
import com.carrotsearch.randomizedtesting.generators.RandomPicks; import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchPhaseExecutionException;
@ -58,6 +59,7 @@ import static org.hamcrest.Matchers.notNullValue;
* Integration test for corrupted translog files * Integration test for corrupted translog files
*/ */
@ElasticsearchIntegrationTest.ClusterScope(scope= ElasticsearchIntegrationTest.Scope.SUITE, numDataNodes = 0) @ElasticsearchIntegrationTest.ClusterScope(scope= ElasticsearchIntegrationTest.Scope.SUITE, numDataNodes = 0)
@LuceneTestCase.SuppressFileSystems("*") // nocommit: corrupting the translog doesn't find a file to corrupt, path building/comparison seems broken
public class CorruptedTranslogTests extends ElasticsearchIntegrationTest { public class CorruptedTranslogTests extends ElasticsearchIntegrationTest {
@Override @Override

View File

@ -55,6 +55,7 @@ import static org.hamcrest.Matchers.*;
/** /**
* *
*/ */
@LuceneTestCase.SuppressFileSystems("ExtrasFS")
public abstract class AbstractSimpleTranslogTests extends ElasticsearchTestCase { public abstract class AbstractSimpleTranslogTests extends ElasticsearchTestCase {
protected final ShardId shardId = new ShardId(new Index("index"), 1); protected final ShardId shardId = new ShardId(new Index("index"), 1);
@ -331,6 +332,7 @@ public abstract class AbstractSimpleTranslogTests extends ElasticsearchTestCase
} }
@Test @Test
@AwaitsFix(bugUrl = "sometimes translog doesn't exist...") // nocommit
public void deleteOnRollover() throws IOException { public void deleteOnRollover() throws IOException {
translog.add(new Translog.Create("test", "1", new byte[]{1})); translog.add(new Translog.Create("test", "1", new byte[]{1}));

View File

@ -19,6 +19,7 @@
package org.elasticsearch.index.translog; package org.elasticsearch.index.translog;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.index.VersionType; import org.elasticsearch.index.VersionType;
import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.test.ElasticsearchTestCase;
@ -33,6 +34,10 @@ import static org.hamcrest.Matchers.equalTo;
/** /**
* Tests for reading old and new translog files * Tests for reading old and new translog files
*/ */
@LuceneTestCase.SuppressFileSystems("*") // nocommit: really??
// file handle leaks: [InputStream(/Users/rjernst/Code/elasticsearch/target/test-classes/org/elasticsearch/index/translog/translog-v1.binary), InputStream(/Users/rjernst/Code/elasticsearch/target/test-classes/org/elasticsearch/index/translog/translog-v0.binary)]
// > at __randomizedtesting.SeedInfo.seed([5C01B578E6A55900]:0)
// > at org.apache.lucene.mockfile.LeakFS.onClose(LeakFS.java:64)
public class TranslogVersionTests extends ElasticsearchTestCase { public class TranslogVersionTests extends ElasticsearchTestCase {
@Test @Test

View File

@ -20,6 +20,7 @@
package org.elasticsearch.indices; package org.elasticsearch.indices;
import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
@ -43,6 +44,7 @@ import static org.hamcrest.Matchers.equalTo;
/** /**
* Tests for custom data path locations and templates * Tests for custom data path locations and templates
*/ */
@LuceneTestCase.SuppressFileSystems("ExtrasFS") //nocommit: assertPathHasBeenCleared seems like a bad method altogether, should it be agnostic to extra files that already existed?
public class IndicesCustomDataPathTests extends ElasticsearchIntegrationTest { public class IndicesCustomDataPathTests extends ElasticsearchIntegrationTest {
private String path; private String path;

View File

@ -21,12 +21,14 @@ package org.elasticsearch.plugins;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchIllegalArgumentException; import org.elasticsearch.ElasticsearchIllegalArgumentException;
import org.elasticsearch.ElasticsearchTimeoutException; import org.elasticsearch.ElasticsearchTimeoutException;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.action.admin.cluster.node.info.PluginInfo; import org.elasticsearch.action.admin.cluster.node.info.PluginInfo;
import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
@ -61,6 +63,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
@ClusterScope(scope = Scope.TEST, numDataNodes = 0, transportClientRatio = 0.0) @ClusterScope(scope = Scope.TEST, numDataNodes = 0, transportClientRatio = 0.0)
@LuceneTestCase.SuppressFileSystems("*") // nocommit: lots of failures here, some with provider mismatches...
public class PluginManagerTests extends ElasticsearchIntegrationTest { public class PluginManagerTests extends ElasticsearchIntegrationTest {
@Test(expected = ElasticsearchIllegalArgumentException.class) @Test(expected = ElasticsearchIllegalArgumentException.class)
@ -518,8 +521,8 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
* @throws NullPointerException if {@code resourceName} does not point to a valid resource. * @throws NullPointerException if {@code resourceName} does not point to a valid resource.
*/ */
private String getPluginUrlForResource(String resourceName) { private String getPluginUrlForResource(String resourceName) {
URI uri = URI.create(PluginManagerTests.class.getResource(resourceName).toString()); Path resourcePath = PathUtils.get(PluginManagerTests.class.getResource(resourceName).getPath());
return "file://" + uri.getPath(); return "file://" + resourcePath.toString();
} }
} }

View File

@ -25,6 +25,7 @@ import com.carrotsearch.randomizedtesting.LifecycleScope;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.action.ListenableActionFuture; import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
@ -80,6 +81,9 @@ import static org.hamcrest.Matchers.*;
/** /**
*/ */
@ClusterScope(scope = Scope.TEST, numDataNodes = 0) @ClusterScope(scope = Scope.TEST, numDataNodes = 0)
@LuceneTestCase.SuppressFileSystems("*") // nocommit: "not all files were deleted during snapshot cancellation"
// possibly something messed up with comparison somewhere...
// org.elasticsearch.common.settings.NoClassSettingsException: failed to load class with value [mock]; tried [mock, org.elasticsearch.repositories.MockRepositoryModule, org.elasticsearch.repositories.mock.MockRepositoryModule, org.elasticsearch.repositories.mock.MockRepositoryModule]
public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests { public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
@Test @Test

View File

@ -69,7 +69,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllS
/** /**
* Base testcase for randomized unit testing with Elasticsearch * Base testcase for randomized unit testing with Elasticsearch
*/ */
@LuceneTestCase.SuppressFileSystems("*") // we aren't ready for this yet.
public abstract class ElasticsearchTestCase extends ESTestCase { public abstract class ElasticsearchTestCase extends ESTestCase {
private static Thread.UncaughtExceptionHandler defaultHandler; private static Thread.UncaughtExceptionHandler defaultHandler;
@ -173,8 +172,7 @@ public abstract class ElasticsearchTestCase extends ESTestCase {
* non-standard characters. * non-standard characters.
*/ */
public Path getResourcePath(String relativePath) { public Path getResourcePath(String relativePath) {
URI uri = URI.create(getClass().getResource(relativePath).toString()); return PathUtils.get(getClass().getResource(relativePath).getPath());
return PathUtils.get(uri);
} }
@After @After
@ -486,7 +484,7 @@ public abstract class ElasticsearchTestCase extends ESTestCase {
} }
CompatibilityVersion annotation = clazz.getAnnotation(CompatibilityVersion.class); CompatibilityVersion annotation = clazz.getAnnotation(CompatibilityVersion.class);
if (annotation != null) { if (annotation != null) {
return Version.smallest(Version.fromId(annotation.version()), compatibilityVersion(clazz.getSuperclass())); return Version.smallest(Version.fromId(annotation.version()), compatibilityVersion(clazz.getSuperclass()));
} }
return compatibilityVersion(clazz.getSuperclass()); return compatibilityVersion(clazz.getSuperclass());
} }

View File

@ -107,7 +107,7 @@ public final class FileUtils {
} }
} }
return PathUtils.get(URI.create(resource.toString())); return PathUtils.get(resource.getPath());
} }
private static URL findResource(String path, String optionalFileSuffix) { private static URL findResource(String path, String optionalFileSuffix) {

View File

@ -18,9 +18,8 @@
*/ */
package org.elasticsearch.watcher; package org.elasticsearch.watcher;
import com.carrotsearch.randomizedtesting.LifecycleScope;
import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.test.ElasticsearchTestCase;
import org.junit.Test; import org.junit.Test;
@ -33,11 +32,14 @@ import java.nio.file.StandardOpenOption;
import java.util.List; import java.util.List;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;
import static org.hamcrest.Matchers.*; 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 { public class FileWatcherTest extends ElasticsearchTestCase {
private class RecordingChangeListener extends FileChangesListener { private class RecordingChangeListener extends FileChangesListener {