diff options
author | Adrian Goerler <adrian.goerler@sap.com> | 2011-08-10 17:09:27 +0200 |
---|---|---|
committer | Adrian Goerler <adrian.goerler@sap.com> | 2011-08-10 17:09:27 +0200 |
commit | 0e44707bde1730c8f3c0f1049a1683bce52fb610 (patch) | |
tree | 4d520078e013b783922cc436bdb55bd7b1b06887 | |
parent | 55b35eeddb31377423f0c4b3df844319ed3f2723 (diff) |
Fix case-issue with path name on Windows
The tests SchemaCreatorTest and SchemaUpdaterTest sometimes fail on
windows when executed from the MSysGit Bash. The issue is caused by the
fact that NTFS is preserving case but is not case-sensitive. The tests
use the current working directory to create a review site and compare
its path name with the path name from the system configuration. On NTFS,
these path names may differ in upper/lower-case causing the tests to
fail.
Using a canonical path fixes the issue.
Change-Id: I1445b85cb4677a20308fefdd15552cb589aebc1b
Signed-off-by: Adrian Goerler <adrian.goerler@sap.com>
-rw-r--r-- | gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java | 6 | ||||
-rw-r--r-- | gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaUpdaterTest.java | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java index 50b87dae38..d31bd3cfa1 100644 --- a/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java +++ b/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java @@ -24,6 +24,7 @@ import com.google.gwtorm.jdbc.JdbcSchema; import junit.framework.TestCase; import java.io.File; +import java.io.IOException; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashSet; @@ -44,7 +45,8 @@ public class SchemaCreatorTest extends TestCase { super.tearDown(); } - public void testGetCauses_CreateSchema() throws OrmException, SQLException { + public void testGetCauses_CreateSchema() throws OrmException, SQLException, + IOException { // Initially the schema should be empty. // { @@ -74,7 +76,7 @@ public class SchemaCreatorTest extends TestCase { if (sitePath.getName().equals(".")) { sitePath = sitePath.getParentFile(); } - assertEquals(sitePath.getAbsolutePath(), db.getSystemConfig().sitePath); + assertEquals(sitePath.getCanonicalPath(), db.getSystemConfig().sitePath); } public void testCreateSchema_ApprovalCategory_CodeReview() diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaUpdaterTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaUpdaterTest.java index dfdf1f43a6..7d696728f2 100644 --- a/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaUpdaterTest.java +++ b/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaUpdaterTest.java @@ -38,6 +38,7 @@ import org.eclipse.jgit.lib.PersonIdent; import java.io.File; import java.io.FileNotFoundException; +import java.io.IOException; import java.util.List; import java.util.UUID; @@ -56,7 +57,8 @@ public class SchemaUpdaterTest extends TestCase { super.tearDown(); } - public void testUpdate() throws OrmException, FileNotFoundException { + public void testUpdate() throws OrmException, FileNotFoundException, + IOException { db.create(); final File site = new File(UUID.randomUUID().toString()); @@ -110,6 +112,6 @@ public class SchemaUpdaterTest extends TestCase { db.assertSchemaVersion(); final SystemConfig sc = db.getSystemConfig(); - assertEquals(paths.site_path.getAbsolutePath(), sc.sitePath); + assertEquals(paths.site_path.getCanonicalPath(), sc.sitePath); } } |