Apache Solr open-source search software
set the lastmod of the files to be deleted to be 1 day ago so that '-remove_old_solr_logs 0' doesn't run afoul of coarse granularity timestamps on windows jenkins machines if the test starts and runs quickly
Chris Hostetter0b7421eca671
diff --git a/solr/core/src/test/org/apache/solr/util/UtilsToolTest.java b/solr/core/src/test/org/apache/solr/util/UtilsToolTest.javaindex 4272ad76379..0ac35910add 100644--- a/solr/core/src/test/org/apache/solr/util/UtilsToolTest.java+++ b/solr/core/src/test/org/apache/solr/util/UtilsToolTest.java@@ -118,6 +118,20 @@ public class UtilsToolTest extends SolrTestCaseJ4 {@Testpublic void testRelativePath() throws Exception {++ // NOTE...+ //+ // some filesystems have coarse granularity for last modified attribute (ie: multiple milliseconds)+ // which means if the test runs very quickly after the creation / setLastMod of these file,+ // then "setLastMod(X days ago)" may be equal to (or even greater that) "now - X days" causing+ // "-remove_old_solr_logs X" to ignore them.+ // so make sure we use at least "setLastMod(X+1 days ago)"++ Files.setLastModifiedTime(dir.resolve("solr_log_20160102"),+ FileTime.from(Instant.now().minus(Period.ofDays(1))));+ Files.setLastModifiedTime(dir.resolve("solr_log_20160304"),+ FileTime.from(Instant.now().minus(Period.ofDays(2))));+String[] args = {"utils", "-remove_old_solr_logs", "0", "-l", dir.getFileName().toString(), "-s", dir.getParent().toString()};assertEquals(files.size(), fileCount());assertEquals(0, runTool(args));