sodonnel commented on code in PR #4684:
URL: https://github.com/apache/ozone/pull/4684#discussion_r1188519537


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/health/TestClosingContainerHandler.java:
##########
@@ -210,6 +215,31 @@ public void 
testClosingContainerStateIsUpdatedWhenThereAreNotReplicas() {
     });
   }
 
+  @Test
+  public void testEmptyContainerInClosingState() throws InterruptedException {
+    /*
+     * Empty Container in CLOSING state should be CLOSED after
+     * a timeout (ReplicationManager Interval * 5)
+     */
+    replicationManager.getConfig().setInterval(Duration.ofSeconds(1));
+    ContainerInfo containerInfo = ReplicationTestUtil.createContainerInfo(
+        RATIS_REPLICATION_CONFIG, 1, CLOSING);
+    Set<ContainerReplica> containerReplicas = new HashSet<>();
+    ReplicationManagerReport report = new ReplicationManagerReport();
+    ContainerCheckRequest request = new ContainerCheckRequest.Builder()
+        .setPendingOps(Collections.emptyList())
+        .setReport(report)
+        .setContainerInfo(containerInfo)
+        .setContainerReplicas(containerReplicas)
+        .build();
+
+    Thread.sleep(Duration.ofSeconds(5).toMillis());

Review Comment:
   We should not put sleeps into tests, as it means this test will take just 
over 5 seconds to run, which is very slow. Instead we should be using a Clock 
object where we can advance the time for the test instantly and avoid the 
sleep. See my other comment and also some examples in the ReplicationManager 
class.



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