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

sodonnell 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 f2c20ce  HDDS-5751. Use Mini Cluster Provider to speed up 
TestHDDSUpgrade (#2650)
f2c20ce is described below

commit f2c20ce47196e5099d3e841a73e406bf7e3b326e
Author: Stephen O'Donnell <[email protected]>
AuthorDate: Thu Sep 16 19:56:08 2021 +0100

    HDDS-5751. Use Mini Cluster Provider to speed up TestHDDSUpgrade (#2650)
---
 .../hadoop/hdds/upgrade/TestHDDSUpgrade.java       | 37 +++++++++++++++++-----
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/upgrade/TestHDDSUpgrade.java
 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/upgrade/TestHDDSUpgrade.java
index 44983cc..7b7d6d1 100644
--- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/upgrade/TestHDDSUpgrade.java
+++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/upgrade/TestHDDSUpgrade.java
@@ -70,6 +70,7 @@ import 
org.apache.hadoop.hdds.scm.server.StorageContainerManager;
 import org.apache.hadoop.hdds.scm.storage.ContainerProtocolCalls;
 import org.apache.hadoop.ozone.HddsDatanodeService;
 import org.apache.hadoop.ozone.MiniOzoneCluster;
+import org.apache.hadoop.ozone.MiniOzoneClusterProvider;
 import org.apache.hadoop.ozone.client.ObjectStore;
 import org.apache.hadoop.ozone.client.OzoneClient;
 import org.apache.hadoop.ozone.client.OzoneClientFactory;
@@ -84,8 +85,10 @@ import 
org.apache.hadoop.security.authentication.client.AuthenticationException;
 import org.apache.ozone.test.GenericTestUtils;
 import org.apache.ozone.test.LambdaTestUtils;
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
@@ -120,6 +123,8 @@ public class TestHDDSUpgrade {
       ReplicationConfig.fromTypeAndFactor(HddsProtos.ReplicationType.RATIS,
           HddsProtos.ReplicationFactor.THREE);
 
+  private static MiniOzoneClusterProvider clusterProvider;
+
   /**
    * Create a MiniDFSCluster for testing.
    *
@@ -135,30 +140,46 @@ public class TestHDDSUpgrade {
     shutdown();
   }
 
-  public void init() throws Exception {
-    conf = new OzoneConfiguration();
+  @BeforeClass
+  public static void initClass() {
+    OzoneConfiguration conf = new OzoneConfiguration();
     conf.setTimeDuration(HDDS_PIPELINE_REPORT_INTERVAL, 1000,
         TimeUnit.MILLISECONDS);
     conf.set(OZONE_DATANODE_PIPELINE_LIMIT, "1");
-    cluster = MiniOzoneCluster.newBuilder(conf)
+
+    MiniOzoneCluster.Builder builder = MiniOzoneCluster.newBuilder(conf)
         .setNumDatanodes(NUM_DATA_NODES)
         // allow only one FACTOR THREE pipeline.
         .setTotalPipelineNumLimit(NUM_DATA_NODES + 1)
         .setHbInterval(500)
         .setHbProcessorInterval(500)
         .setScmLayoutVersion(INITIAL_VERSION.layoutVersion())
-        .setDnLayoutVersion(INITIAL_VERSION.layoutVersion())
-        .build();
-    cluster.waitForClusterToBeReady();
+        .setDnLayoutVersion(INITIAL_VERSION.layoutVersion());
+
+    // Setting the provider to a max of 100 clusters. Some of the tests here
+    // use multiple clusters, so its hard to know exactly how many will be
+    // needed. This means the provider will create 1 extra cluster than needed
+    // but that will not greatly affect runtimes.
+    clusterProvider = new MiniOzoneClusterProvider(conf, builder, 100);
+  }
+
+  @AfterClass
+  public static void afterClass() throws InterruptedException {
+    clusterProvider.shutdown();
+  }
+
+  public void init() throws Exception {
+    cluster = clusterProvider.provide();
+    conf = cluster.getConf();
     loadSCMState();
   }
 
   /**
    * Shutdown MiniDFSCluster.
    */
-  public void shutdown() {
+  public void shutdown() throws IOException, InterruptedException {
     if (cluster != null) {
-      cluster.shutdown();
+      clusterProvider.destroy(cluster);
     }
   }
 

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

Reply via email to