Browse Source

HDDS-1848. Fix TestOzoneManagerHA and TestOzoneManagerSnapShotProvider. (#1148)

Bharat Viswanadham 5 years ago
parent
commit
cf9ff08f4b

+ 2 - 1
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneCluster.java

@@ -234,6 +234,7 @@ public interface MiniOzoneCluster {
 
 
     protected static final int DEFAULT_HB_INTERVAL_MS = 1000;
     protected static final int DEFAULT_HB_INTERVAL_MS = 1000;
     protected static final int DEFAULT_HB_PROCESSOR_INTERVAL_MS = 100;
     protected static final int DEFAULT_HB_PROCESSOR_INTERVAL_MS = 100;
+    protected static final int ACTIVE_OMS_NOT_SET = -1;
 
 
     protected final OzoneConfiguration conf;
     protected final OzoneConfiguration conf;
     protected final String path;
     protected final String path;
@@ -241,7 +242,7 @@ public interface MiniOzoneCluster {
     protected String clusterId;
     protected String clusterId;
     protected String omServiceId;
     protected String omServiceId;
     protected int numOfOMs;
     protected int numOfOMs;
-    protected int numOfActiveOMs;
+    protected int numOfActiveOMs = ACTIVE_OMS_NOT_SET;
 
 
     protected Optional<Boolean> enableTrace = Optional.of(false);
     protected Optional<Boolean> enableTrace = Optional.of(false);
     protected Optional<Integer> hbInterval = Optional.empty();
     protected Optional<Integer> hbInterval = Optional.empty();

+ 5 - 0
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java

@@ -169,6 +169,11 @@ public final class MiniOzoneHAClusterImpl extends MiniOzoneClusterImpl {
         throw new IllegalArgumentException("Number of active OMs cannot be " +
         throw new IllegalArgumentException("Number of active OMs cannot be " +
             "more than the total number of OMs");
             "more than the total number of OMs");
       }
       }
+
+      // If num of ActiveOMs is not set, set it to numOfOMs.
+      if (numOfActiveOMs == ACTIVE_OMS_NOT_SET) {
+        numOfActiveOMs = numOfOMs;
+      }
       DefaultMetricsSystem.setMiniClusterMode(true);
       DefaultMetricsSystem.setMiniClusterMode(true);
       initializeConfiguration();
       initializeConfiguration();
       StorageContainerManager scm;
       StorageContainerManager scm;