aajisaka commented on a change in pull request #3280:
URL: https://github.com/apache/hadoop/pull/3280#discussion_r688673319
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestDecommissioningStatus.java
##########
@@ -307,6 +323,59 @@ public void testDecommissionStatus() throws Exception {
AdminStatesBaseTest.cleanupFile(fileSys, file2);
}
+ protected void verifyInitialState(FSNamesystem fsn, DatanodeManager dm)
+ throws InterruptedException {
+ dm.getDatanodes().forEach(datanodeDescriptor -> {
+ try {
+ checkDecommissionStatus(datanodeDescriptor, 0, 0, 0);
+ } catch (TimeoutException | InterruptedException e) {
+ throw new AssertionError("Datanode not in good state.", e);
+ }
+ });
+ int c = 0;
+ int totalBlocks;
+ long totalReplicatedBlocks;
+ while (true) {
+ totalBlocks = fsn.getBlockManager().getTotalBlocks();
+ totalReplicatedBlocks = fsn.getBlockManager().getTotalReplicatedBlocks();
+ if (totalBlocks == 4 && totalReplicatedBlocks == 4) {
+ break;
+ } else {
+ if (c == 4) {
+ throw new AssertionError("Unexpected Total blocks " + totalBlocks
+ + " and replicated blocks " + totalReplicatedBlocks);
+ }
+ Thread.sleep(3000);
+ }
+ c++;
+ }
Review comment:
Can we use `GenericUtils.waitFor()`?
--
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]