You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2020/02/08 14:56:29 UTC
[hbase] branch branch-2.2 updated: HBASE-23809 The RSGroup shell
test is missing (#1142)
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.2 by this push:
new 43c15fb HBASE-23809 The RSGroup shell test is missing (#1142)
43c15fb is described below
commit 43c15fbc62d3ad4a0a376719b0b75f35ce9a87bf
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Sat Feb 8 17:10:00 2020 +0800
HBASE-23809 The RSGroup shell test is missing (#1142)
Signed-off-by: Guanghao Zhang <zg...@apache.org>
---
.../hadoop/hbase/client/AbstractTestShell.java | 44 +++++++++------
.../hadoop/hbase/client/TestRSGroupShell.java | 63 ++++++++++++++++++++++
2 files changed, 90 insertions(+), 17 deletions(-)
diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java
index 7f67b01..1988c03 100644
--- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java
+++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java
@@ -17,9 +17,10 @@
*/
package org.apache.hadoop.hbase.client;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
@@ -34,26 +35,25 @@ public abstract class AbstractTestShell {
protected final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
protected final static ScriptingContainer jruby = new ScriptingContainer();
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- // Start mini cluster
- TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100);
- TEST_UTIL.getConfiguration().setInt("hbase.client.pause", 250);
- TEST_UTIL.getConfiguration().setBoolean("hbase.quota.enabled", true);
- TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6);
- TEST_UTIL.getConfiguration().setBoolean(CoprocessorHost.ABORT_ON_ERROR_KEY, false);
- TEST_UTIL.getConfiguration().setInt("hfile.format.version", 3);
+ protected static void setUpConfig() throws IOException {
+ Configuration conf = TEST_UTIL.getConfiguration();
+ conf.setInt("hbase.regionserver.msginterval", 100);
+ conf.setInt("hbase.client.pause", 250);
+ conf.setBoolean("hbase.quota.enabled", true);
+ conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6);
+ conf.setBoolean(CoprocessorHost.ABORT_ON_ERROR_KEY, false);
+ conf.setInt("hfile.format.version", 3);
// Below settings are necessary for task monitor test.
- TEST_UTIL.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, 0);
- TEST_UTIL.getConfiguration().setInt(HConstants.REGIONSERVER_INFO_PORT, 0);
- TEST_UTIL.getConfiguration().setBoolean(HConstants.REGIONSERVER_INFO_PORT_AUTO, true);
+ conf.setInt(HConstants.MASTER_INFO_PORT, 0);
+ conf.setInt(HConstants.REGIONSERVER_INFO_PORT, 0);
+ conf.setBoolean(HConstants.REGIONSERVER_INFO_PORT_AUTO, true);
// Security setup configuration
- SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration());
- VisibilityTestUtil.enableVisiblityLabels(TEST_UTIL.getConfiguration());
-
- TEST_UTIL.startMiniCluster();
+ SecureTestUtil.enableSecurity(conf);
+ VisibilityTestUtil.enableVisiblityLabels(conf);
+ }
+ protected static void setUpJRubyRuntime() {
// Configure jruby runtime
List<String> loadPaths = new ArrayList<>(2);
loadPaths.add("src/main/ruby");
@@ -65,6 +65,16 @@ public abstract class AbstractTestShell {
System.setProperty("jruby.native.verbose", "true");
}
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ setUpConfig();
+
+ // Start mini cluster
+ TEST_UTIL.startMiniCluster(1);
+
+ setUpJRubyRuntime();
+ }
+
@AfterClass
public static void tearDownAfterClass() throws Exception {
TEST_UTIL.shutdownMiniCluster();
diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestRSGroupShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestRSGroupShell.java
new file mode 100644
index 0000000..68ec518
--- /dev/null
+++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestRSGroupShell.java
@@ -0,0 +1,63 @@
+/**
+ * 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.client;
+
+import java.io.IOException;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
+import org.apache.hadoop.hbase.rsgroup.RSGroupAdminEndpoint;
+import org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer;
+import org.apache.hadoop.hbase.testclassification.ClientTests;
+import org.apache.hadoop.hbase.testclassification.LargeTests;
+import org.jruby.embed.PathType;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category({ ClientTests.class, LargeTests.class })
+public class TestRSGroupShell extends AbstractTestShell {
+
+ @ClassRule
+ public static final HBaseClassTestRule CLASS_RULE =
+ HBaseClassTestRule.forClass(TestRSGroupShell.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ setUpConfig();
+
+ // enable rs group
+ TEST_UTIL.getConfiguration().set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
+ TEST_UTIL.getConfiguration().get(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY) + "," +
+ RSGroupAdminEndpoint.class.getName());
+ TEST_UTIL.getConfiguration().set(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
+ RSGroupBasedLoadBalancer.class.getName());
+
+ TEST_UTIL.startMiniCluster(3);
+
+ setUpJRubyRuntime();
+ }
+
+ @Test
+ public void testRunShellTests() throws IOException {
+ System.setProperty("shell.test.include", "rsgroup_shell_test.rb");
+ // Start all ruby tests
+ jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb");
+ }
+}