ayushtkn commented on code in PR #8638:
URL: https://github.com/apache/hadoop/pull/8638#discussion_r3672997503
##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockTokenWithDFS.java:
##########
@@ -222,6 +224,26 @@ protected Configuration getConf(int numDataNodes) {
return conf;
}
+ /**
+ * A non-positive block token lifetime makes every block token expire at the
+ * instant it is created, so it must be rejected instead of failing later on
+ * every write pipeline.
+ */
+ @Test
+ public void testInvalidBlockTokenLifetime() {
+ for (long lifetime : new long[] {0, -1}) {
+ Configuration conf = getConf(1);
+ conf.setLong(DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_LIFETIME_KEY,
lifetime);
+ HadoopIllegalArgumentException e = assertThrows(
+ HadoopIllegalArgumentException.class,
+ () -> new MiniDFSCluster.Builder(conf).numDataNodes(1).build());
+ assertTrue(
+ e.getMessage().contains(
+ DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_LIFETIME_KEY),
+ "unexpected message: " + e.getMessage());
+ }
Review Comment:
Can we assert in the `assertThrows` itself
```
assertThrows(HadoopIllegalArgumentException.class, () -> new
MiniDFSCluster.Builder(conf).numDataNodes(1).build(),
DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_LIFETIME_KEY);
```
##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockTokenWithDFS.java:
##########
@@ -222,6 +224,26 @@ protected Configuration getConf(int numDataNodes) {
return conf;
}
+ /**
+ * A non-positive block token lifetime makes every block token expire at the
+ * instant it is created, so it must be rejected instead of failing later on
+ * every write pipeline.
+ */
+ @Test
Review Comment:
the class doesn't have javadocs for the tests, we can live without having
this javadoc, the test is self explaining
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]