mirror of https://github.com/apache/lucene.git
LUCENE-5066: fix TestFieldsReader OOM (test bug)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1495290 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b3d70e8f69
commit
b7cc38c0bc
|
@ -170,12 +170,11 @@ public class TestFieldsReader extends LuceneTestCase {
|
|||
@Override
|
||||
public void readInternal(byte[] b, int offset, int length) throws IOException {
|
||||
simOutage();
|
||||
delegate.seek(getFilePointer());
|
||||
delegate.readBytes(b, offset, length);
|
||||
}
|
||||
@Override
|
||||
public void seekInternal(long pos) throws IOException {
|
||||
//simOutage();
|
||||
delegate.seek(pos);
|
||||
}
|
||||
@Override
|
||||
public long length() {
|
||||
|
@ -187,7 +186,14 @@ public class TestFieldsReader extends LuceneTestCase {
|
|||
}
|
||||
@Override
|
||||
public FaultyIndexInput clone() {
|
||||
return new FaultyIndexInput(delegate.clone());
|
||||
FaultyIndexInput i = new FaultyIndexInput(delegate.clone());
|
||||
// seek the clone to our current position
|
||||
try {
|
||||
i.seek(getFilePointer());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,8 +203,9 @@ public class TestFieldsReader extends LuceneTestCase {
|
|||
|
||||
try {
|
||||
Directory dir = new FaultyFSDirectory(indexDir);
|
||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
|
||||
TEST_VERSION_CURRENT, new MockAnalyzer(random())).setOpenMode(OpenMode.CREATE));
|
||||
IndexWriterConfig iwc = newIndexWriterConfig(
|
||||
TEST_VERSION_CURRENT, new MockAnalyzer(random())).setOpenMode(OpenMode.CREATE);
|
||||
IndexWriter writer = new IndexWriter(dir, iwc);
|
||||
for(int i=0;i<2;i++)
|
||||
writer.addDocument(testDoc);
|
||||
writer.forceMerge(1);
|
||||
|
|
|
@ -84,6 +84,9 @@ final class TestRuleSetupAndRestoreClassEnv extends AbstractBeforeAfterRule {
|
|||
|
||||
@Override
|
||||
public void message(String component, String message) {
|
||||
if ("TP".equals(component)) {
|
||||
return; // ignore test points!
|
||||
}
|
||||
final String name;
|
||||
if (Thread.currentThread().getName().startsWith("TEST-")) {
|
||||
// The name of the main thread is way too
|
||||
|
|
Loading…
Reference in New Issue