mirror of https://github.com/apache/lucene.git
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
This commit is contained in:
parent
37166ce4e9
commit
0b7421eca6
|
@ -118,6 +118,20 @@ public class UtilsToolTest extends SolrTestCaseJ4 {
|
|||
|
||||
@Test
|
||||
public 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));
|
||||
|
|
Loading…
Reference in New Issue