bgaborg commented on a change in pull request #1134: HADOOP-16433. S3Guard: Filter expired entries and tombstones when lis… URL: https://github.com/apache/hadoop/pull/1134#discussion_r306700684
########## File path: hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3GuardOutOfBandOperations.java ########## @@ -538,6 +540,47 @@ public void deleteAfterTombstoneExpiryOobCreate() throws Exception { } } + /** + * Test that a tombstone won't hide an entry after it's expired in the + * listing. + */ + @Test + public void testRootTombstones() throws Exception { + long ttl = 10L; + ITtlTimeProvider mockTimeProvider = mock(ITtlTimeProvider.class); + when(mockTimeProvider.getMetadataTtl()).thenReturn(ttl); + when(mockTimeProvider.getNow()).thenReturn(100L); + ITtlTimeProvider originalTimeProvider = guardedFs.getTtlTimeProvider(); + guardedFs.setTtlTimeProvider(mockTimeProvider); + + Path base = path(getMethodName() + UUID.randomUUID()); + Path testFile = new Path(base, "test.file"); + + try { + touch(guardedFs, testFile); + ContractTestUtils.assertDeleted(guardedFs, testFile, false); + + touch(rawFS, testFile); + awaitFileStatus(rawFS, testFile); + + // the rawFS will include the file= + LambdaTestUtils.eventually(5000, 1000, () -> { + checkListingContainsPath(rawFS, testFile); + }); + + // it will be hidden because of the tombstone + checkListingDoesNotContainPath(guardedFs, testFile); Review comment: ok, I just wanted this as easy to understand and clean as possible. but I can add more check for sure. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org