CoredumpCleanupRule { public static DiskCleanupRule forHost(Path processedCoredumpsPath) { return new HostCoredumpCleanupRule(processedCoredumpsPath); }  static DiskCleanupRule forContainer(Path containerCrashPath); static DiskCleanupRule forHost(Path processedCoredumpsPath);  }
@Test public void for_host_test() throws IOException { Path path = fileSystem.getPath("/test/path"); DiskCleanupRule rule = CoredumpCleanupRule.forHost(path); assertPriorities(rule, Map.of()); createFile(path.resolve("h123a/abcd-1234/dump_core1"), Instant.parse("2020-04-21T19:21:00Z")); createFile(path.resolve("h123a/abcd-1234/metadata.json"), Instant.parse("2020-04-21T19:26:00Z")); assertPriorities(rule, Map.of("/test/path/h123a/abcd-1234/dump_core1", Priority.MEDIUM)); createFile(path.resolve("h123a/abcd-efgh/dump_core1"), Instant.parse("2020-04-21T07:13:00Z")); createFile(path.resolve("h123a/56ad-af42/dump_vespa-distributor.321"), Instant.parse("2020-04-21T23:37:00Z")); createFile(path.resolve("h123a/4324-a23d/dump_core2"), Instant.parse("2020-04-22T04:56:00Z")); createFile(path.resolve("h123a/8534-7da3/dump_vespa-proton-bin.123"), Instant.parse("2020-04-19T15:35:00Z")); createFile(path.resolve("h123b/db1a-ab34/dump_core1"), Instant.parse("2020-04-21T07:01:00Z")); createFile(path.resolve("h123b/7392-59ad/dump_vespa-proton-bin.342"), Instant.parse("2020-04-22T12:05:00Z")); assertPriorities(rule, Map.of( "/test/path/h123a/abcd-1234/dump_core1", Priority.HIGH, "/test/path/h123a/abcd-efgh/dump_core1", Priority.HIGH, "/test/path/h123a/56ad-af42/dump_vespa-distributor.321", Priority.MEDIUM, "/test/path/h123a/4324-a23d/dump_core2", Priority.MEDIUM, "/test/path/h123a/8534-7da3/dump_vespa-proton-bin.123", Priority.MEDIUM, "/test/path/h123b/db1a-ab34/dump_core1", Priority.MEDIUM, "/test/path/h123b/7392-59ad/dump_vespa-proton-bin.342", Priority.MEDIUM )); }