simbadzina commented on code in PR #6873:
URL: https://github.com/apache/hadoop/pull/6873#discussion_r1637279944


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/util/TestCombinedHostsFileReader.java:
##########
@@ -87,4 +103,51 @@ public void testEmptyCombinedHostsFileReader() throws 
Exception {
         CombinedHostsFileReader.readFile(newFile.getAbsolutePath());
     assertEquals(0, all.length);
   }
+
+  /*
+   * When timeout is enabled, test for success when reading file within timeout
+   * limits
+   */
+  @Test
+  public void testReadFileWithTimeoutSuccess() throws Exception {
+
+    DatanodeAdminProperties[] all = 
CombinedHostsFileReader.readFileWithTimeout(
+        jsonFile.getAbsolutePath(), 1000);
+    assertEquals(7, all.length);
+  }
+
+  /*
+   * When timeout is enabled, test for IOException when reading file exceeds
+   * timeout limits
+   */
+  @Test
+  public void testReadFileWithTimeoutTimeoutException() throws Exception {
+    exception.expect(IOException.class);

Review Comment:
   You can just use `@Test(expected = IOException.class)` here since we don't 
check any other properties of the exception.
   Then you can remove the Rule declaration above and the new imports.



-- 
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]

Reply via email to