Apache Lucene open-source search software
Speed up TestBackwardsCompatibility#testCommandLineArgs. (#467)
Adrien Grandf80d816ce775
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.javaindex fcb79ad9b7b..a1e209c7e71 100644--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java@@ -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;@@ -1642,17 +1643,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();