Github user keith-turner commented on a diff in the pull request: https://github.com/apache/accumulo/pull/107#discussion_r65651340 --- Diff: server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogsTest.java --- @@ -234,4 +257,288 @@ public void testIsUUID() { assertFalse(GarbageCollectWriteAheadLogs.isUUID("0" + UUID.randomUUID().toString())); assertFalse(GarbageCollectWriteAheadLogs.isUUID(null)); } + + @Test + public void testTimeToDeleteTrue() throws InterruptedException { + gcwal.clearFirstSeenDead(); + HostAndPort address = HostAndPort.fromString("tserver1:9998"); + long wait = AccumuloConfiguration.getTimeInMillis("1s"); + gcwal.timeToDelete(address, wait); // to store first seen dead + sleep(wait * 2); + assertTrue(gcwal.timeToDelete(address, wait)); + } + + @Test + public void testTimeToDeleteFalse() { + HostAndPort address = HostAndPort.fromString("tserver1:9998"); + long wait = AccumuloConfiguration.getTimeInMillis("1h"); + long t1, t2; + boolean ttd; + do { + t1 = System.nanoTime(); + gcwal.clearFirstSeenDead(); + gcwal.timeToDelete(address, wait); + ttd = gcwal.timeToDelete(address, wait); + t2 = System.nanoTime(); + } while (t2 - t1 > (wait / 2) * 1000000); // as long as it took less than half of the configured wait --- End diff -- I saw you used TimeUnit earlier in the patch to convert time. Could use TimeUnit earlier in this test method to convert `wait` to nanos. IMO would be slightly more readable than multiplying by 1000000.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---