MultiBaseLocalDiskRepositoryManagerTest: fix for running on Mac from Eclipse
The alternateRepositoryLocation test was failing when running from
Eclipse on Mac because the created repository location would be:
/private/var/rest/of/path
while the alternateBasePath is:
/var/rest/of/path
This difference comes from the fact that on Mac the /var is a symlink to
/private/var and the creation of the repository would resolve the
location using getCanonicalFile().
Use alternateBasePath.toRealPath() to resolve any symlinks in the
alternateBasePath.
NOTE: this issue doesn't show up when running tests from bazel as
bazel's sandboxing uses different path locations.
Change-Id: I2cb1adc48e16edc5adffd7b7f8eea2b5ea1a60f3
diff --git a/javatests/com/google/gerrit/server/git/MultiBaseLocalDiskRepositoryManagerTest.java b/javatests/com/google/gerrit/server/git/MultiBaseLocalDiskRepositoryManagerTest.java
index 29f520b..4902830 100644
--- a/javatests/com/google/gerrit/server/git/MultiBaseLocalDiskRepositoryManagerTest.java
+++ b/javatests/com/google/gerrit/server/git/MultiBaseLocalDiskRepositoryManagerTest.java
@@ -93,12 +93,14 @@
Repository repo = repoManager.createRepository(someProjectKey);
assertThat(repo.getDirectory()).isNotNull();
assertThat(repo.getDirectory().exists()).isTrue();
- assertThat(repo.getDirectory().getParent()).isEqualTo(alternateBasePath.toString());
+ assertThat(repo.getDirectory().getParent())
+ .isEqualTo(alternateBasePath.toRealPath().toString());
repo = repoManager.openRepository(someProjectKey);
assertThat(repo.getDirectory()).isNotNull();
assertThat(repo.getDirectory().exists()).isTrue();
- assertThat(repo.getDirectory().getParent()).isEqualTo(alternateBasePath.toString());
+ assertThat(repo.getDirectory().getParent())
+ .isEqualTo(alternateBasePath.toRealPath().toString());
assertThat(repoManager.getBasePath(someProjectKey).toAbsolutePath().toString())
.isEqualTo(alternateBasePath.toString());