steveloughran commented on a change in pull request #802: HADOOP-16279.
S3Guard: Implement time-based (TTL) expiry for entries …
URL: https://github.com/apache/hadoop/pull/802#discussion_r291959146
##########
File path:
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3GuardOutOfBandOperations.java
##########
@@ -430,6 +431,54 @@ public void createNonRecursiveFailsIfParentDeleted()
throws Exception {
}
}
+ /**
+ * When lastUpdated = 0 the entry should not expire. This is a special case
+ * eg. for old metadata entries
+ */
+ @Test
+ public void testLastUpdatedZeroWontExpire() throws Exception {
+ LOG.info("Authoritative mode: {}", authoritative);
+
+ String testFile = methodName + UUID.randomUUID().toString() +
+ "/theFileToTry";
+
+ long ttl = 10L;
+ final Path filePath = path(testFile);
+
+ // Create a directory with
+ ITtlTimeProvider mockTimeProvider = mock(ITtlTimeProvider.class);
+ ITtlTimeProvider originalTimeProvider = guardedFs.getTtlTimeProvider();
+
+ try {
+ guardedFs.setTtlTimeProvider(mockTimeProvider);
+ when(mockTimeProvider.getMetadataTtl()).thenReturn(ttl);
Review comment:
be aware that using the {{doAnswer()}} mockito API may be less "elegant" but
it backports to the older mockito (and hence hadoop) versions more easily. I'd
recommend going with the older API for now, to make that backport lower-stress
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]