mirror of
https://github.com/apache/lucene.git
synced 2025-02-07 10:38:40 +00:00
Speed up TestBackwardsCompatibility#testCommandLineArgs. (#467)
This test unzip files that we already unzipped. This commit copies the already uncompressed files instead.
This commit is contained in:
parent
3f634e2ab9
commit
b3a36166a5
@ -106,6 +106,7 @@ import org.apache.lucene.store.BaseDirectoryWrapper;
|
||||
import org.apache.lucene.store.ByteBuffersDirectory;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.apache.lucene.store.IOContext;
|
||||
import org.apache.lucene.store.NIOFSDirectory;
|
||||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
@ -1664,17 +1665,22 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testCommandLineArgs() throws Exception {
|
||||
public void testIndexUpgraderCommandLineArgs() throws Exception {
|
||||
|
||||
PrintStream savedSystemOut = System.out;
|
||||
System.setOut(new PrintStream(new ByteArrayOutputStream(), false, "UTF-8"));
|
||||
try {
|
||||
for (Map.Entry<String, Directory> entry : oldIndexDirs.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
Directory origDir = entry.getValue();
|
||||
int indexCreatedVersion =
|
||||
SegmentInfos.readLatestCommit(entry.getValue()).getIndexCreatedVersionMajor();
|
||||
SegmentInfos.readLatestCommit(origDir).getIndexCreatedVersionMajor();
|
||||
Path dir = createTempDir(name);
|
||||
TestUtil.unzip(getDataInputStream("index." + name + ".zip"), dir);
|
||||
try (FSDirectory fsDir = FSDirectory.open(dir)) {
|
||||
for (String file : origDir.listAll()) {
|
||||
fsDir.copyFrom(origDir, file, file, IOContext.DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
String path = dir.toAbsolutePath().toString();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user