Apache Lucene open-source search software
SOLR-10075: TestNonWritablePersistFile fails when run as a single test under root.
markrmiller848a410ca1e4
diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestNonWritablePersistFile.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestNonWritablePersistFile.javaindex a7d3d0afec3..4d43ff6bc1b 100644--- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestNonWritablePersistFile.java+++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestNonWritablePersistFile.java@@ -70,10 +70,24 @@ public class TestNonWritablePersistFile extends AbstractDataImportHandlerTestCastry {// execute the test only if we are able to set file to read only mode- assumeTrue("No dataimport.properties file", f.exists() || f.createNewFile());- assumeTrue("dataimport.properties can't be set read only", f.setReadOnly());- assumeFalse("dataimport.properties is still writable even though " +- "marked readonly - test running as superuser?", f.canWrite());+ // we don't use assume because if no tests executes when you run a single test+ // it's considered a fail++ if (!(f.exists() || f.createNewFile())) {+ System.err.println("No dataimport.properties file, skipping rest of test ...");+ return;+ }++ if (!f.setReadOnly()) {+ System.err.println("dataimport.properties can't be set read only, skipping rest of test ...");+ return;+ }++ if (f.canWrite()) {+ System.err.println("dataimport.properties is still writable even though \" + \n" ++ " \"marked readonly - test running as superuser?, skipping rest of test ...");+ return;+ }ignoreException("Properties is not writable");