[TEST] Enable MockFS on InternalEngineTests and TranslogTests
This commit is contained in:
parent
7d1eb6e900
commit
bba1528fa4
|
@ -38,7 +38,6 @@ import org.apache.lucene.store.AlreadyClosedException;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.MockDirectoryWrapper;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.LuceneTestCase.SuppressFileSystems;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
|
@ -82,7 +81,6 @@ import org.elasticsearch.index.translog.Translog;
|
|||
import org.elasticsearch.index.translog.TranslogConfig;
|
||||
import org.elasticsearch.test.DummyShardLock;
|
||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.hamcrest.MatcherAssert;
|
||||
import org.junit.After;
|
||||
|
@ -102,8 +100,6 @@ import static org.elasticsearch.index.engine.Engine.Operation.Origin.PRIMARY;
|
|||
import static org.elasticsearch.index.engine.Engine.Operation.Origin.REPLICA;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
// TODO: this guy isn't ready for mock filesystems yet
|
||||
@SuppressFileSystems("*")
|
||||
public class InternalEngineTests extends ElasticsearchTestCase {
|
||||
|
||||
protected final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||
|
@ -1555,9 +1551,8 @@ public class InternalEngineTests extends ElasticsearchTestCase {
|
|||
// fake a new translog, causing the engine to point to a missing one.
|
||||
Translog translog = createTranslog();
|
||||
long id = translog.currentFileGeneration();
|
||||
IOUtils.rm(translog.location().resolve(Translog.getFilename(id)));
|
||||
// we have to re-open the translog because o.w. it will complain about commit information going backwards, which is OK as we did a fake markComitted
|
||||
translog.close();
|
||||
IOUtils.rm(translog.location().resolve(Translog.getFilename(id)));
|
||||
try {
|
||||
engine = createEngine(store, primaryTranslogDir);
|
||||
fail("engine shouldn't start without a valid translog id");
|
||||
|
@ -1570,7 +1565,6 @@ public class InternalEngineTests extends ElasticsearchTestCase {
|
|||
engine = createEngine(indexSettingsService, store, primaryTranslogDir, createMergeScheduler(indexSettingsService));
|
||||
}
|
||||
|
||||
@TestLogging("index.translog:TRACE")
|
||||
public void testTranslogReplayWithFailure() throws IOException {
|
||||
boolean canHaveDuplicates = true;
|
||||
boolean autoGeneratedId = true;
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.lucene.index.Term;
|
|||
import org.apache.lucene.store.AlreadyClosedException;
|
||||
import org.apache.lucene.store.ByteArrayDataOutput;
|
||||
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.Version;
|
||||
|
@ -64,7 +63,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import static com.google.common.collect.Lists.newArrayList;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
@ -72,7 +70,6 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@LuceneTestCase.SuppressFileSystems("ExtrasFS")
|
||||
public class TranslogTests extends ElasticsearchTestCase {
|
||||
|
||||
protected final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||
|
@ -117,7 +114,7 @@ public class TranslogTests extends ElasticsearchTestCase {
|
|||
|
||||
protected Translog create(Path path) throws IOException {
|
||||
Settings build = ImmutableSettings.settingsBuilder()
|
||||
.put("index.translog.fs.type", TranslogWriter.Type.SIMPLE.name())
|
||||
.put(TranslogConfig.INDEX_TRANSLOG_FS_TYPE, TranslogWriter.Type.SIMPLE.name())
|
||||
.build();
|
||||
TranslogConfig translogConfig = new TranslogConfig(shardId, path, build, Translog.Durabilty.REQUEST, BigArrays.NON_RECYCLING_INSTANCE, null);
|
||||
return new Translog(translogConfig);
|
||||
|
|
Loading…
Reference in New Issue