You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2021/11/24 07:33:50 UTC
[lucene] 02/02: Speed up TestBackwardsCompatibility#testCommandLineArgs. (#467)
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit b3a36166a531231ef6bfb3b90418c4bf2270a775
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Wed Nov 24 08:25:22 2021 +0100
Speed up TestBackwardsCompatibility#testCommandLineArgs. (#467)
This test unzip files that we already unzipped. This commit copies the already
uncompressed files instead.
---
.../lucene/backward_index/TestBackwardsCompatibility.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
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.java
index 11f69688..54922ad 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;
@@ -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();