mirror of https://github.com/apache/lucene.git
LUCENE-5974: Add check that backcompat indexes use default codecs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1627158 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
52a787e311
commit
07e00b4ffb
|
@ -179,6 +179,9 @@ Tests
|
|||
* LUCENE-5957: Add option for tests to not randomize codec
|
||||
(Ryan Ernst)
|
||||
|
||||
* LUCENE-5974: Add check that backcompat indexes use default codecs
|
||||
(Ryan Ernst)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-5960: Use a more efficient bitset, not a Set<Integer>, to
|
||||
|
|
|
@ -1002,6 +1002,24 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
|||
r.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void verifyUsesDefaultCodec(Directory dir, String name) throws Exception {
|
||||
DirectoryReader r = DirectoryReader.open(dir);
|
||||
for (AtomicReaderContext context : r.leaves()) {
|
||||
SegmentReader air = (SegmentReader) context.reader();
|
||||
Codec codec = air.getSegmentInfo().info.getCodec();
|
||||
assertTrue("codec used in " + name + " (" + codec.getName() + ") is not a default codec (does not begin with Lucene)",
|
||||
codec.getName().startsWith("Lucene"));
|
||||
}
|
||||
r.close();
|
||||
}
|
||||
|
||||
public void testAllIndexesUseDefaultCodec() throws Exception {
|
||||
for (String name : oldNames) {
|
||||
Directory dir = oldIndexDirs.get(name);
|
||||
verifyUsesDefaultCodec(dir, name);
|
||||
}
|
||||
}
|
||||
|
||||
public void testNumericFields() throws Exception {
|
||||
for (String name : oldNames) {
|
||||
|
@ -1203,6 +1221,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
|||
Path oldIndexDir = createTempDir("moreterms");
|
||||
TestUtil.unzip(getDataInputStream(moreTermsIndex), oldIndexDir);
|
||||
Directory dir = newFSDirectory(oldIndexDir);
|
||||
verifyUsesDefaultCodec(dir, moreTermsIndex);
|
||||
// TODO: more tests
|
||||
TestUtil.checkIndex(dir);
|
||||
dir.close();
|
||||
|
@ -1242,6 +1261,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
|||
Path oldIndexDir = createTempDir("dvupdates");
|
||||
TestUtil.unzip(getDataInputStream(dvUpdatesIndex), oldIndexDir);
|
||||
Directory dir = newFSDirectory(oldIndexDir);
|
||||
verifyUsesDefaultCodec(dir, dvUpdatesIndex);
|
||||
|
||||
verifyDocValues(dir);
|
||||
|
||||
|
|
Loading…
Reference in New Issue