Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-14217

tests respect tests.workDir correctly (prevent SSD destruction)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 8.5
    • Tests
    • None

    Description

      To prevent SSD destruction you should be able to set in your gradle.properties:

      tests.workDir=/tmp/lucene_gradle
      

      This causes all tests to write their temporary stuff (e.g. indexes) to that location, instead of build/ directories inside the checkout.

      Unfortunately if you do this, some solr tests fail, because their configs will then try to reach out to invalid places. It happens because they load up configuration files with logic that looks like this:

      <lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar" />
      

      Because solr.install.dir is not set, it falls back to an inappropriate relative path, and tries to access bogus locations on the filesystem, causing tests to fail:

        2> Caused by: org.apache.solr.common.SolrException: Error loading solr config from /tmp/lucene_gradle/solr.client.solrj.embedded.SolrExampleJettyTest_FF93943C1C04FCAC-001/tempDir-001/collection1/conf/solrconfig.xml
        2>    at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:157)
        2>    at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:111)
        2>    at org.apache.solr.core.ConfigSetService.loadConfigSet(ConfigSetService.java:82)
        2>    ... 8 more
        2> Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "/tmp/lucene_gradle/solr.client.solrj.embedded.SolrExampleJettyTest_FF93943C1C04FCAC-001/tempDir-001/collection1/../../../../contrib/extraction/lib" "read")
        2>    at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
        2>    at java.base/java.security.AccessController.checkPermission(AccessController.java:1036)
        2>    at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:408)
        2>    at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:747)
        2>    at java.base/sun.nio.fs.UnixPath.checkRead(UnixPath.java:818)
        2>    at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:399)
        2>    at java.base/java.nio.file.Files.newDirectoryStream(Files.java:607)
        2>    at org.apache.solr.core.SolrResourceLoader.getURLs(SolrResourceLoader.java:286)
        2>    at org.apache.solr.core.SolrResourceLoader.getFilteredURLs(SolrResourceLoader.java:319)
        2>    at org.apache.solr.core.SolrConfig.initLibs(SolrConfig.java:782)
        2>    at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:176)
        2>    at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:149)
        2>    ... 10 more
      

      The system property must be set so that these tests will work with the configured tests.workDir

      It has no impact on tests speed, because solr tests are all sitting in Thread.sleep, not bottlenecked on anything related to this.

      Attachments

        1. SOLR-14217.patch
          1 kB
          Robert Muir

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rcmuir Robert Muir
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: