hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject hbase git commit: Revert "HBASE-21258 Add resetting of flags for RS Group pre/post hooks in TestRSGroups"
Date Mon, 01 Oct 2018 23:28:33 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 a8f0f1d95 -> 81bd854f7


Revert "HBASE-21258 Add resetting of flags for RS Group pre/post hooks in TestRSGroups"

This reverts commit a8f0f1d95a6a175dd101e93ee15c8f5dda87bd13.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/81bd854f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/81bd854f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/81bd854f

Branch: refs/heads/branch-1
Commit: 81bd854f7773204d377b325822ad3294eed02c52
Parents: a8f0f1d
Author: Andrew Purtell <apurtell@apache.org>
Authored: Mon Oct 1 16:24:20 2018 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Mon Oct 1 16:24:20 2018 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/rsgroup/TestRSGroups.java      |  69 +++++---
 .../hadoop/hbase/rsgroup/TestRSGroups1.java     | 159 -------------------
 2 files changed, 46 insertions(+), 182 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/81bd854f/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups.java
b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups.java
index 64313f3..4320fea 100644
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups.java
+++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups.java
@@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.rsgroup;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.IOException;
 import java.util.Iterator;
@@ -42,6 +43,7 @@ import org.apache.hadoop.hbase.Waiter.Predicate;
 import org.apache.hadoop.hbase.coprocessor.BaseMasterObserver;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
+import org.apache.hadoop.hbase.coprocessor.MasterObserver;
 import org.apache.hadoop.hbase.coprocessor.ObserverContext;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
@@ -65,10 +67,10 @@ import com.google.common.collect.Sets;
 @Category({MediumTests.class})
 public class TestRSGroups extends TestRSGroupsBase {
   protected static final Log LOG = LogFactory.getLog(TestRSGroups.class);
-  static HMaster master;
+  private static HMaster master;
   private static boolean init = false;
   private static RSGroupAdminEndpoint RSGroupAdminEndpoint;
-  static CPMasterObserver observer;
+  private static CPMasterObserver observer;
 
   @BeforeClass
   public static void setUp() throws Exception {
@@ -121,7 +123,7 @@ public class TestRSGroups extends TestRSGroupsBase {
       init = true;
       afterMethod();
     }
-    observer.resetFlags();
+
   }
 
   @After
@@ -147,6 +149,7 @@ public class TestRSGroups extends TestRSGroupsBase {
     } catch (Exception ex) {
       // ignore
     }
+    assertTrue(observer.preMoveServersCalled);
     TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
       @Override
       public boolean evaluate() throws Exception {
@@ -214,6 +217,46 @@ public class TestRSGroups extends TestRSGroupsBase {
   }
 
   @Test
+  public void testNamespaceConstraint() throws Exception {
+    String nsName = tablePrefix+"_foo";
+    String groupName = tablePrefix+"_foo";
+    LOG.info("testNamespaceConstraint");
+    rsGroupAdmin.addRSGroup(groupName);
+    assertTrue(observer.preAddRSGroupCalled);
+    assertTrue(observer.postAddRSGroupCalled);
+
+    admin.createNamespace(NamespaceDescriptor.create(nsName)
+        .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, groupName)
+        .build());
+    //test removing a referenced group
+    try {
+      rsGroupAdmin.removeRSGroup(groupName);
+      fail("Expected a constraint exception");
+    } catch (IOException ex) {
+    }
+    //test modify group
+    //changing with the same name is fine
+    admin.modifyNamespace(
+        NamespaceDescriptor.create(nsName)
+          .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, groupName)
+          .build());
+    String anotherGroup = tablePrefix+"_anotherGroup";
+    rsGroupAdmin.addRSGroup(anotherGroup);
+    //test add non-existent group
+    admin.deleteNamespace(nsName);
+    rsGroupAdmin.removeRSGroup(groupName);
+    assertTrue(observer.preRemoveRSGroupCalled);
+    assertTrue(observer.postRemoveRSGroupCalled);
+    try {
+      admin.createNamespace(NamespaceDescriptor.create(nsName)
+          .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, "foo")
+          .build());
+      fail("Expected a constraint exception");
+    } catch (IOException ex) {
+    }
+  }
+
+  @Test
   public void testGroupInfoMultiAccessing() throws Exception {
     RSGroupInfoManager manager = RSGroupAdminEndpoint.getGroupInfoManager();
     final RSGroupInfo defaultGroup = manager.getRSGroup("default");
@@ -240,24 +283,6 @@ public class TestRSGroups extends TestRSGroupsBase {
     boolean preMoveServersAndTables = false;
     boolean postMoveServersAndTables = false;
 
-    void resetFlags() {
-      LOG.debug("calling resetFlags");
-      preBalanceRSGroupCalled = false;
-      postBalanceRSGroupCalled = false;
-      preMoveServersCalled = false;
-      postMoveServersCalled = false;
-      preMoveTablesCalled = false;
-      postMoveTablesCalled = false;
-      preAddRSGroupCalled = false;
-      postAddRSGroupCalled = false;
-      preRemoveRSGroupCalled = false;
-      postRemoveRSGroupCalled = false;
-      preRemoveServersCalled = false;
-      postRemoveServersCalled = false;
-      preMoveServersAndTables = false;
-      postMoveServersAndTables = false;
-    }
-
     @Override
     public void preMoveServersAndTables(final ObserverContext<MasterCoprocessorEnvironment>
ctx,
         Set<Address> servers, Set<TableName> tables, String targetGroup) throws
IOException {
@@ -293,7 +318,6 @@ public class TestRSGroups extends TestRSGroupsBase {
     @Override
     public void preAddRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
         String name) throws IOException {
-      LOG.debug("setting preAddRSGroupCalled");
       preAddRSGroupCalled = true;
     }
     @Override
@@ -314,7 +338,6 @@ public class TestRSGroups extends TestRSGroupsBase {
     @Override
     public void preMoveServers(final ObserverContext<MasterCoprocessorEnvironment>
ctx,
         Set<Address> servers, String targetGroup) throws IOException {
-      LOG.debug("setting preMoveServersCalled");
       preMoveServersCalled = true;
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/81bd854f/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups1.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups1.java
b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups1.java
deleted file mode 100644
index 12a0b81..0000000
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups1.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.rsgroup;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.NamespaceDescriptor;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/*
- * The two tests in this class are separated from TestRSGroups
- *   so that the observer pre/post hook called checks are stable.
- * There are some tests from TestRSGroupsBase which are empty since
- *   they would be run by TestRSGroups.
- */
-@Category({MediumTests.class})
-public class TestRSGroups1 extends TestRSGroups {
-  protected static final Log LOG = LogFactory.getLog(TestRSGroups1.class);
-
-  @Test
-  public void testNamespaceConstraint() throws Exception {
-    String nsName = tablePrefix+"_foo";
-    String groupName = tablePrefix+"_foo";
-    LOG.info("testNamespaceConstraint");
-    rsGroupAdmin.addRSGroup(groupName);
-    assertTrue(observer.preAddRSGroupCalled);
-    assertTrue(observer.postAddRSGroupCalled);
-
-    admin.createNamespace(NamespaceDescriptor.create(nsName)
-        .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, groupName)
-        .build());
-    //test removing a referenced group
-    try {
-      rsGroupAdmin.removeRSGroup(groupName);
-      fail("Expected a constraint exception");
-    } catch (IOException ex) {
-    }
-    //test modify group
-    //changing with the same name is fine
-    admin.modifyNamespace(
-        NamespaceDescriptor.create(nsName)
-          .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, groupName)
-          .build());
-    String anotherGroup = tablePrefix+"_anotherGroup";
-    rsGroupAdmin.addRSGroup(anotherGroup);
-    //test add non-existent group
-    admin.deleteNamespace(nsName);
-    rsGroupAdmin.removeRSGroup(groupName);
-    assertTrue(observer.preRemoveRSGroupCalled);
-    assertTrue(observer.postRemoveRSGroupCalled);
-    try {
-      admin.createNamespace(NamespaceDescriptor.create(nsName)
-          .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, "foo")
-          .build());
-      fail("Expected a constraint exception");
-    } catch (IOException ex) {
-    }
-  }
-
-  @Test
-  public void testMoveServers() throws Exception {
-    super.testMoveServers();
-    assertTrue(observer.preMoveServersCalled);
-    assertTrue(observer.postMoveServersCalled);
-  }
-
-  @Ignore @Test
-  public void testBogusArgs() throws Exception {
-  }
-  @Ignore @Test
-  public void testCreateMultiRegion() throws IOException {
-  }
-  @Ignore @Test
-  public void testCreateAndDrop() throws Exception {
-  }
-  @Ignore @Test
-  public void testSimpleRegionServerMove() throws IOException,
-      InterruptedException {
-  }
-  @Ignore @Test
-  public void testTableMoveTruncateAndDrop() throws Exception {
-  }
-  @Ignore @Test
-  public void testGroupBalance() throws Exception {
-  }
-  @Ignore @Test
-  public void testRegionMove() throws Exception {
-  }
-  @Ignore @Test
-  public void testFailRemoveGroup() throws IOException, InterruptedException {
-  }
-  @Ignore @Test
-  public void testKillRS() throws Exception {
-  }
-  @Ignore @Test
-  public void testValidGroupNames() throws IOException {
-  }
-  @Ignore @Test
-  public void testMultiTableMove() throws Exception {
-  }
-  @Ignore @Test
-  public void testMoveServersAndTables() throws Exception {
-  }
-  @Ignore @Test
-  public void testDisabledTableMove() throws Exception {
-  }
-  @Ignore @Test
-  public void testClearDeadServers() throws Exception {
-  }
-  @Ignore @Test
-  public void testRemoveServers() throws Exception {
-  }
-  @Ignore @Test
-  public void testBasicStartUp() throws IOException {
-  }
-  @Ignore @Test
-  public void testNamespaceCreateAndAssign() throws Exception {
-  }
-  @Ignore @Test
-  public void testDefaultNamespaceCreateAndAssign() throws Exception {
-  }
-  @Ignore @Test
-  public void testGroupInfoMultiAccessing() throws Exception {
-  }
-  @Ignore @Test
-  public void testMisplacedRegions() throws Exception {
-  }
-  @Ignore @Test
-  public void testRSGroupBalancerSwitch() throws IOException {
-  }
-  @Ignore @Test
-  public void testCloneSnapshot() throws Exception {
-  }
-}


Mime
View raw message