You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Shai Erera <se...@gmail.com> on 2015/03/26 22:21:20 UTC

Test failure: FullSolrCloudDistribCmdsTest.test

Hi

I've hit this failure while running tests on Windows:

java.nio.file.InvalidPathException: Illegal char <:> at index 10:
..\..\..\C:\Users\shaie\AppData\Local\Temp\solr.cloud.FullSolrCloudDistribCmdsTest
DE7AF8A38474E032-007\control-001
    at
__randomizedtesting.SeedInfo.seed([DE7AF8A38474E032:562EC7792A888DCA]:0)
    at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
    at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
    at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
    at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
    at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
    at java.io.File.toPath(File.java:2234)
    at
org.apache.solr.cloud.AbstractFullDistribZkTestBase.createJetty(AbstractFullDistribZkTestBase.java:536)
    at
org.apache.solr.BaseDistributedSearchTestCase.createJetty(BaseDistributedSearchTestCase.java:385)
    at
org.apache.solr.cloud.AbstractFullDistribZkTestBase.createServers(AbstractFullDistribZkTestBase.java:280)
    at
org.apache.solr.BaseDistributedSearchTestCase$ShardsRepeatRule$ShardsFixedStatement.callStatement(BaseDistributedSearchTestCase.java:958)
    at
org.apache.solr.BaseDistributedSearchTestCase$ShardsRepeatRule$ShardsStatement.evaluate(BaseDistributedSearchTestCase.java:935)

The problem is that my working directory is under D:\, but the temp
directory is under C:\, and therefore the relative path that's constructed
is illegal (you cannot move between C: and D: like that).

I changed AbstractFullDistribZkTestBase.getRelativeSolrHomePath to this:

  private File getRelativeSolrHomePath(File solrHome) {
    final Path solrHomePath = solrHome.toPath();
    final Path workDirPath = new File(".").getAbsoluteFile().toPath();

    if (!solrHomePath.getRoot().equals(workDirPath.getRoot())) {
      // root of workDir and solrHome are not the same, there's nothing to
relativize
      return solrHome;
    } else {
      return workDirPath.relativize(solrHomePath).toFile();
    }
  }

And the test passes w/ and w/o the seed that tripped it
(-Dtests.seed=DE7AF8A38474E032). createJetty randomly sets solrHome to a
relative path, so if you want to reproduce, this seed gets you there.

I didn't run other Solr tests yet, but I ran the test both when the temp
directory is set to the same root as the working directory, and to a
different one, and it passes. I also printed the relative path returned and
it looks correct.

Shall I apply this fix or does somebody know of a better way to fix it?

Shai