JanusGraph / JanusGraph/janusgraph

Tests fail on Windows due to usage of Unix-style path separators

Open
#1,019 2 comments 1 reaction 0 assignees View on GitHub
area/testing
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

This is caused by platform dependant handling of paths in the test, on v0.2.0 and master. File.separator should be used instead on hard-coded / in the paths.

Environment:

- Apache Maven 3.3.3
- Oracle JDK 1.8.0_152-b16
- Windows 10.0.17134.1

Test failure:

```
directoryShouldEqualSuppliedDirectory(org.janusgraph.diskstorage.common.LocalStoreManagerTest) Time elapsed: 0.211 sec <<< FAILURE!
org.junit.ComparisonFailure: expected: but was:
```

Fix (will submit pull request soon-ish):

```
--- a/janusgraph-test/src/test/java/org/janusgraph/diskstorage/common/LocalStoreManagerTest.java
+++ b/janusgraph-test/src/test/java/org/janusgraph/diskstorage/common/LocalStoreManagerTest.java
@@ -33,6 +33,7 @@ import static org.janusgraph.diskstorage.configuration.BasicConfiguration.Restri

import org.apache.commons.configuration.BaseConfiguration;

+import java.io.File;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
@@ -102,18 +103,18 @@ public class LocalStoreManagerTest {
@Test
public void directoryShouldEqualSuppliedDirectory() throws BackendException {
final Map map = getBaseConfigurationMap();
- map.put(STORAGE_DIRECTORY, "specific/absolute/directory");
+ map.put(STORAGE_DIRECTORY, "specific" + File.separator + "absolute" + File.separator + "directory");
final LocalStoreManager mgr = getStoreManager(map);
- assertEquals("specific/absolute/directory", mgr.directory.getPath());
+ assertEquals("specific" + File.separator + "absolute" + File.separator + "directory", mgr.directory.getPath());
}

@Test
public void directoryShouldEqualStorageRootPlusGraphName() throws BackendException {
final Map map = getBaseConfigurationMap();
- map.put(STORAGE_ROOT, "temp/root");
+ map.put(STORAGE_ROOT, "temp" + File.separator + "root");
map.put(GRAPH_NAME, "randomGraphName");
final LocalStoreManager mgr = getStoreManager(map);
- assertEquals("temp/root/randomGraphName", mgr.directory.getPath());
+ assertEquals("temp" + File.separator + "root" + File.separator + "randomGraphName", mgr.directory.getPath());
}

@Test
```

Contributor guide

Open the contributing guide

Research direction

Start in janusgraph-test/src/test/java/org/janusgraph/diskstorage/common/LocalStoreManagerTest.java, especially directoryShouldEqualSuppliedDirectory and directoryShouldEqualStorageRootPlusGraphName. Run these tests on Windows with Maven and verify that the expected and configured paths use the platform separator and pass on Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases, testing
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.