From cf9ff08f4b9fe71b86444d59796b6809296f35c3 Mon Sep 17 00:00:00 2001 From: Bharat Viswanadham Date: Tue, 23 Jul 2019 20:23:06 -0700 Subject: [PATCH] HDDS-1848. Fix TestOzoneManagerHA and TestOzoneManagerSnapShotProvider. (#1148) --- .../test/java/org/apache/hadoop/ozone/MiniOzoneCluster.java | 3 ++- .../java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneCluster.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneCluster.java index 1139a6535bb..d3c96554d6c 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneCluster.java +++ b/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_PROCESSOR_INTERVAL_MS = 100; + protected static final int ACTIVE_OMS_NOT_SET = -1; protected final OzoneConfiguration conf; protected final String path; @@ -241,7 +242,7 @@ public interface MiniOzoneCluster { protected String clusterId; protected String omServiceId; protected int numOfOMs; - protected int numOfActiveOMs; + protected int numOfActiveOMs = ACTIVE_OMS_NOT_SET; protected Optional enableTrace = Optional.of(false); protected Optional hbInterval = Optional.empty(); diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java index 1d9a99e8931..58675e66297 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java +++ b/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 " + "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); initializeConfiguration(); StorageContainerManager scm;