Fix test failures with testIndexUpgraderCommandLineArgs and ExtraFS.

This commit is contained in:
Adrien Grand 2021-11-25 08:50:27 +01:00
parent f80d816ce7
commit 8710252116
1 changed files with 6 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -1655,10 +1656,14 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
SegmentInfos.readLatestCommit(origDir).getIndexCreatedVersionMajor();
Path dir = createTempDir(name);
try (FSDirectory fsDir = FSDirectory.open(dir)) {
// beware that ExtraFS might add extraXXX files
Set<String> extraFiles = Set.of(fsDir.listAll());
for (String file : origDir.listAll()) {
if (extraFiles.contains(file) == false) {
fsDir.copyFrom(origDir, file, file, IOContext.DEFAULT);
}
}
}
String path = dir.toAbsolutePath().toString();