sumitagrawl commented on code in PR #4624:
URL: https://github.com/apache/ozone/pull/4624#discussion_r1179913195


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestBlockDeletion.java:
##########
@@ -246,17 +246,19 @@ public void testBlockDeletion(ReplicationConfig 
repConfig) throws Exception {
     Assertions.assertEquals(0L, metrics.getNumBlockDeletionTransactionSent());
     // close the containers which hold the blocks for the key
     OzoneTestUtils.closeAllContainers(scm.getEventQueue(), scm);
-    Thread.sleep(2000);
-    // make sure the containers are closed on the dn
-    omKeyLocationInfoGroupList.forEach((group) -> {
-      List<OmKeyLocationInfo> locationInfo = group.getLocationList();
-      locationInfo.forEach(
-          (info) -> cluster.getHddsDatanodes().get(0).getDatanodeStateMachine()
-              .getContainer().getContainerSet()
-              .getContainer(info.getContainerID()).getContainerData()
-              .setState(ContainerProtos.ContainerDataProto.State.CLOSED));
-    });
 
+    // The blocks should be deleted in the DN.
+    GenericTestUtils.waitFor(() -> {
+      return !(omKeyLocationInfoGroupList.stream().filter((group) -> 
+        group.getLocationList().stream().filter(
+            (info) -> cluster.getHddsDatanodes().get(0)
+                .getDatanodeStateMachine().getContainer().getContainerSet()
+                .getContainer(info.getContainerID()).getContainerData()
+                .getState() != ContainerProtos.ContainerDataProto.State.CLOSED)
+            .findFirst().isPresent()
+      ).findFirst().isPresent());
+    }, 1000, 30000);

Review Comment:
   Updated...



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