This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new ccaaf57183 HDDS-10316. Speed up TestReconTasks (#6223)
ccaaf57183 is described below

commit ccaaf571833a72cefec3c8b8169ceabbebc3652f
Author: Raju Balpande <[email protected]>
AuthorDate: Tue Apr 2 16:42:58 2024 +0530

    HDDS-10316. Speed up TestReconTasks (#6223)
---
 .../apache/hadoop/ozone/recon/TestReconTasks.java  | 37 +++++++++++++++-------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconTasks.java
 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconTasks.java
index cba7311b3b..3d418459dc 100644
--- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconTasks.java
+++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconTasks.java
@@ -41,8 +41,12 @@ import org.apache.ozone.test.GenericTestUtils;
 import org.apache.ozone.test.LambdaTestUtils;
 import org.hadoop.ozone.recon.schema.ContainerSchemaDefinition;
 import org.hadoop.ozone.recon.schema.tables.pojos.UnhealthyContainers;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.TestMethodOrder;
+import org.junit.jupiter.api.TestInstance;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
 import org.slf4j.event.Level;
@@ -58,12 +62,14 @@ import static 
org.junit.jupiter.api.Assertions.assertNotEquals;
  * Integration Tests for Recon's tasks.
  */
 @Timeout(300)
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+@TestMethodOrder(OrderAnnotation.class)
 public class TestReconTasks {
   private MiniOzoneCluster cluster = null;
   private OzoneConfiguration conf;
 
-  @BeforeEach
-  public void init() throws Exception {
+  @BeforeAll
+  void init() throws Exception {
     conf = new OzoneConfiguration();
     conf.set(HDDS_CONTAINER_REPORT_INTERVAL, "5s");
     conf.set(HDDS_PIPELINE_REPORT_INTERVAL, "5s");
@@ -74,21 +80,22 @@ public class TestReconTasks {
 
     conf.set("ozone.scm.stale.node.interval", "6s");
     conf.set("ozone.scm.dead.node.interval", "8s");
-    cluster =  MiniOzoneCluster.newBuilder(conf).setNumDatanodes(1)
+    cluster =  MiniOzoneCluster.newBuilder(conf).setNumDatanodes(3)
         .includeRecon(true).build();
     cluster.waitForClusterToBeReady();
     GenericTestUtils.setLogLevel(SCMDatanodeHeartbeatDispatcher.LOG,
         Level.DEBUG);
   }
 
-  @AfterEach
-  public void shutdown() {
+  @AfterAll
+  void shutdown() {
     if (cluster != null) {
       cluster.shutdown();
     }
   }
 
   @Test
+  @Order(3)
   public void testSyncSCMContainerInfo() throws Exception {
     ReconStorageContainerManagerFacade reconScm =
         (ReconStorageContainerManagerFacade)
@@ -121,6 +128,7 @@ public class TestReconTasks {
   }
 
   @Test
+  @Order(1)
   public void testMissingContainerDownNode() throws Exception {
     ReconStorageContainerManagerFacade reconScm =
         (ReconStorageContainerManagerFacade)
@@ -141,7 +149,7 @@ public class TestReconTasks {
         (ReconContainerManager) reconScm.getContainerManager();
     ContainerInfo containerInfo =
         scmContainerManager
-            .allocateContainer(RatisReplicationConfig.getInstance(ONE), 
"test");
+            .allocateContainer(RatisReplicationConfig.getInstance(ONE), 
"testMissingContainer");
     long containerID = containerInfo.getContainerID();
 
     try (RDBBatchOperation rdbBatchOperation = new RDBBatchOperation()) {
@@ -181,6 +189,8 @@ public class TestReconTasks {
                   0, 1000);
       return (allMissingContainers.isEmpty());
     });
+    // Cleaning up some data
+    scmContainerManager.deleteContainer(containerInfo.containerID());
     IOUtils.closeQuietly(client);
   }
 
@@ -202,6 +212,7 @@ public class TestReconTasks {
    * @throws Exception
    */
   @Test
+  @Order(2)
   public void testEmptyMissingContainerDownNode() throws Exception {
     ReconStorageContainerManagerFacade reconScm =
         (ReconStorageContainerManagerFacade)
@@ -219,9 +230,10 @@ public class TestReconTasks {
     ContainerManager scmContainerManager = scm.getContainerManager();
     ReconContainerManager reconContainerManager =
         (ReconContainerManager) reconScm.getContainerManager();
+    int previousContainerCount = reconContainerManager.getContainers().size();
     ContainerInfo containerInfo =
         scmContainerManager
-            .allocateContainer(RatisReplicationConfig.getInstance(ONE), 
"test");
+            .allocateContainer(RatisReplicationConfig.getInstance(ONE), 
"testEmptyMissingContainer");
     long containerID = containerInfo.getContainerID();
 
     Pipeline pipeline =
@@ -230,8 +242,8 @@ public class TestReconTasks {
     runTestOzoneContainerViaDataNode(containerID, client);
 
     // Make sure Recon got the container report with new container.
-    assertEquals(scmContainerManager.getContainers(),
-        reconContainerManager.getContainers());
+    assertEquals(scmContainerManager.getContainers().size(),
+        reconContainerManager.getContainers().size() - previousContainerCount);
 
     // Bring down the Datanode that had the container replica.
     cluster.shutdownHddsDatanode(pipeline.getFirstNode());
@@ -305,7 +317,8 @@ public class TestReconTasks {
                   0, 1000);
       return (allMissingContainers.isEmpty());
     });
-
+    // Cleaning up some data
+    reconContainerManager.deleteContainer(containerInfo.containerID());
     IOUtils.closeQuietly(client);
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to