goiri commented on a change in pull request #2419:
URL: https://github.com/apache/hadoop/pull/2419#discussion_r513577757
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBPOfferService.java
##########
@@ -318,45 +317,41 @@ public void blockUtilSendFullBlockReport() {
count.addAndGet(1);
Thread.sleep(1);
} catch (Exception e) {
- e.printStackTrace();
+ LOG.error("error addNewBlockThread", e);
}
}
});
addNewBlockThread.start();
// Make sure that generate blocks for DataNode and IBR not empty now.
- GenericTestUtils.waitFor(() -> {
- if(count.get() > 0) {
- return true;
- }
- return false;
- }, 100, 1000);
+ GenericTestUtils.waitFor(() -> count.get() > 0, 100, 1000);
// Trigger re-register using DataNode Command.
datanodeCommands[0] = new DatanodeCommand[]{RegisterCommand.REGISTER};
- bpos.triggerHeartbeatForTests();
+ bpos.triggerHeartbeatForTests();
+ addNewBlockThread.join();
+ addNewBlockThread = null;
+ // Verify FBR/IBR count is equal to generate number.
try {
- GenericTestUtils.waitFor(() -> {
- if(fullBlockReportCount == totalTestBlocks ||
- incrBlockReportCount == totalTestBlocks) {
- return true;
- }
- return false;
- }, 1000, 15000);
- } catch (Exception e) {}
+ GenericTestUtils.waitFor(() ->
+ (fullBlockReportCount == totalTestBlocks ||
+ incrBlockReportCount == totalTestBlocks), 1000, 15000);
+ } catch (Exception e) {
+ LOG.error("Timed out wait for IBR counts FBRCount = {},"
+ + " IBRCount = {}; expected = {}",
+ fullBlockReportCount, incrBlockReportCount, totalTestBlocks);
+ Assert.fail();
Review comment:
And do the static import of fail() as the other assertEquals() and so on.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]