LUCENE-5190: Fix failure of TestCheckIndex.testLuceneConstantVersion in Jenkins trunk clover build and other builds using -Ddev.version.suffix

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1518354 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-08-28 20:20:18 +00:00
parent 5e70c629a4
commit d58e179f62
1 changed files with 3 additions and 2 deletions

View File

@ -117,8 +117,10 @@ public class TestCheckIndex extends LuceneTestCase {
public void testLuceneConstantVersion() throws IOException { public void testLuceneConstantVersion() throws IOException {
// common-build.xml sets lucene.version // common-build.xml sets lucene.version
final String version = System.getProperty("lucene.version"); String version = System.getProperty("lucene.version");
assertNotNull( "null version", version); assertNotNull( "null version", version);
// remove anything after a "-" from the version string:
version = version.replaceAll("-.*$", "");
final String constantVersion; final String constantVersion;
String parts[] = Constants.LUCENE_MAIN_VERSION.split("\\."); String parts[] = Constants.LUCENE_MAIN_VERSION.split("\\.");
if (parts.length == 4) { if (parts.length == 4) {
@ -130,7 +132,6 @@ public class TestCheckIndex extends LuceneTestCase {
constantVersion = Constants.LUCENE_MAIN_VERSION; constantVersion = Constants.LUCENE_MAIN_VERSION;
} }
assertTrue("Invalid version: "+version, assertTrue("Invalid version: "+version,
version.equals(constantVersion+"-SNAPSHOT") ||
version.equals(constantVersion)); version.equals(constantVersion));
assertTrue(Constants.LUCENE_VERSION + " should start with: "+version, assertTrue(Constants.LUCENE_VERSION + " should start with: "+version,
Constants.LUCENE_VERSION.startsWith(version)); Constants.LUCENE_VERSION.startsWith(version));