You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xy...@apache.org on 2019/08/09 18:28:45 UTC

[hadoop] branch trunk updated: HDDS-1906. TestScmSafeMode#testSCMSafeModeRestrictedOp is failing. (#1260)

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

xyao pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 98dd7c4  HDDS-1906. TestScmSafeMode#testSCMSafeModeRestrictedOp is failing. (#1260)
98dd7c4 is described below

commit 98dd7c48ff539198e94f5f314184f0a661a2f857
Author: Nanda kumar <na...@apache.org>
AuthorDate: Fri Aug 9 23:58:38 2019 +0530

    HDDS-1906. TestScmSafeMode#testSCMSafeModeRestrictedOp is failing. (#1260)
---
 .../test/java/org/apache/hadoop/ozone/MiniOzoneCluster.java   |  5 +++++
 .../java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java    | 11 +++++++++++
 .../test/java/org/apache/hadoop/ozone/om/TestScmSafeMode.java |  6 ++++++
 3 files changed, 22 insertions(+)

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 d3c9655..44c005c 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
@@ -227,6 +227,11 @@ public interface MiniOzoneCluster {
   void startHddsDatanodes();
 
   /**
+   * Shuts down all the DataNodes.
+   */
+  void shutdownHddsDatanodes();
+
+  /**
    * Builder class for MiniOzoneCluster.
    */
   @SuppressWarnings("visibilitymodifier")
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
index e6f09a8..be1b77b 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
@@ -375,6 +375,17 @@ public class MiniOzoneClusterImpl implements MiniOzoneCluster {
     });
   }
 
+  @Override
+  public void shutdownHddsDatanodes() {
+    hddsDatanodes.forEach((datanode) -> {
+      try {
+        shutdownHddsDatanode(datanode.getDatanodeDetails());
+      } catch (IOException e) {
+        LOG.error("Exception while trying to shutdown datanodes:", e);
+      }
+    });
+  }
+
   private CertificateClient getCAClient() {
     return this.caClient;
   }
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestScmSafeMode.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestScmSafeMode.java
index 9f300d6..04368b2 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestScmSafeMode.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestScmSafeMode.java
@@ -58,6 +58,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
+import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_DEADNODE_INTERVAL;
+import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -91,6 +93,8 @@ public class TestScmSafeMode {
   @Before
   public void init() throws Exception {
     conf = new OzoneConfiguration();
+    conf.set(OZONE_SCM_STALENODE_INTERVAL, "10s");
+    conf.set(OZONE_SCM_DEADNODE_INTERVAL, "25s");
     builder = MiniOzoneCluster.newBuilder(conf)
         .setHbInterval(1000)
         .setHbProcessorInterval(500)
@@ -328,6 +332,8 @@ public class TestScmSafeMode {
     }, 50, 1000 * 30);
     assertTrue(clientProtocolServer.getSafeModeStatus());
 
+    cluster.shutdownHddsDatanodes();
+    Thread.sleep(30000);
     LambdaTestUtils.intercept(SCMException.class,
         "Open container " + containers.get(0).getContainerID() + " "
             + "doesn't have enough replicas to service this operation in Safe"


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org