hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [2/2] hbase git commit: HBASE-13084 addendum move replication_admin_test.rb to individual test
Date Tue, 14 Jul 2015 22:05:06 GMT
HBASE-13084 addendum move replication_admin_test.rb to individual test

Signed-off-by: stack <stack@apache.org>

Conflicts:
	hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java


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

Branch: refs/heads/branch-1.0
Commit: 347eb6bdbf435aedb866aafdb51127e3504ee223
Parents: 8bb2a02
Author: zhangduo <zhangduo@wandoujia.com>
Authored: Thu Feb 26 14:51:06 2015 +0800
Committer: Enis Soztutar <enis@apache.org>
Committed: Tue Jul 14 13:55:48 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/client/AbstractTestShell.java  | 67 ++++++++++++++++++++
 .../hbase/client/TestReplicationShell.java      | 37 +++++++++++
 .../apache/hadoop/hbase/client/TestShell.java   | 53 +---------------
 hbase-shell/src/test/ruby/tests_runner.rb       | 18 ++++++
 4 files changed, 125 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/347eb6bd/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..f75cea3
--- /dev/null
+++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/AbstractTestShell.java
@@ -0,0 +1,67 @@
+/**
+ * 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.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
+import org.apache.hadoop.hbase.security.access.SecureTestUtil;
+import org.apache.hadoop.hbase.security.visibility.VisibilityTestUtil;
+import org.jruby.embed.ScriptingContainer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+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().setBoolean("hbase.online.schema.update.enable", true);
+    TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100);
+    TEST_UTIL.getConfiguration().setInt("hbase.client.pause", 250);
+    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);
+    // Security setup configuration
+    SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration());
+    VisibilityTestUtil.enableVisiblityLabels(TEST_UTIL.getConfiguration());
+
+    TEST_UTIL.startMiniCluster();
+
+    // Configure jruby runtime
+    List<String> loadPaths = new ArrayList();
+    loadPaths.add("src/main/ruby");
+    loadPaths.add("src/test/ruby");
+    jruby.getProvider().setLoadPaths(loadPaths);
+    jruby.put("$TEST_CLUSTER", TEST_UTIL);
+    System.setProperty("jruby.jit.logging.verbose", "true");
+    System.setProperty("jruby.jit.logging", "true");
+    System.setProperty("jruby.native.verbose", "true");
+  }
+
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+    TEST_UTIL.shutdownMiniCluster();
+  }
+}

http://git-wip-us.apache.org/repos/asf/hbase/blob/347eb6bd/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java
b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java
new file mode 100644
index 0000000..4cafbeb
--- /dev/null
+++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java
@@ -0,0 +1,37 @@
+/**
+ * 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.testclassification.LargeTests;
+import org.jruby.embed.PathType;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category({ LargeTests.class })
+public class TestReplicationShell extends AbstractTestShell {
+
+  @Test
+  public void testRunShellTests() throws IOException {
+    System.setProperty("shell.test.include", "replication_admin_test.rb");
+    // Start all ruby tests
+    jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb");
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/hbase/blob/347eb6bd/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java
index 146b661..dde8fe7 100644
--- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java
+++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java
@@ -20,66 +20,19 @@
 package org.apache.hadoop.hbase.client;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
-import org.apache.hadoop.hbase.security.access.SecureTestUtil;
-import org.apache.hadoop.hbase.security.visibility.VisibilityTestUtil;
 import org.jruby.embed.PathType;
-import org.jruby.embed.ScriptingContainer;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(LargeTests.class)
-public class TestShell {
-  final Log LOG = LogFactory.getLog(getClass());
-  private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
-  private final static ScriptingContainer jruby = new ScriptingContainer();
-
-  @BeforeClass
-  public static void setUpBeforeClass() throws Exception {
-    // Start mini cluster
-    TEST_UTIL.getConfiguration().setBoolean("hbase.online.schema.update.enable", true);
-    TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100);
-    TEST_UTIL.getConfiguration().setInt("hbase.client.pause", 250);
-    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);
-    // Security setup configuration
-    SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration());
-    VisibilityTestUtil.enableVisiblityLabels(TEST_UTIL.getConfiguration());
-
-    TEST_UTIL.startMiniCluster();
-
-    // Configure jruby runtime
-    List<String> loadPaths = new ArrayList();
-    loadPaths.add("src/main/ruby");
-    loadPaths.add("src/test/ruby");
-    jruby.getProvider().setLoadPaths(loadPaths);
-    jruby.put("$TEST_CLUSTER", TEST_UTIL);
-    System.setProperty("jruby.jit.logging.verbose", "true");
-    System.setProperty("jruby.jit.logging", "true");
-    System.setProperty("jruby.native.verbose", "true");
-  }
-
-  @AfterClass
-  public static void tearDownAfterClass() throws Exception {
-    TEST_UTIL.shutdownMiniCluster();
-  }
-
+@Category({ LargeTests.class })
+public class TestShell extends AbstractTestShell {
   @Test
   public void testRunShellTests() throws IOException {
+    System.setProperty("shell.test.exclude", "replication_admin_test.rb");
     // Start all ruby tests
     jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb");
   }
 
 }
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/347eb6bd/hbase-shell/src/test/ruby/tests_runner.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/tests_runner.rb b/hbase-shell/src/test/ruby/tests_runner.rb
index e1458db..74ddb48 100644
--- a/hbase-shell/src/test/ruby/tests_runner.rb
+++ b/hbase-shell/src/test/ruby/tests_runner.rb
@@ -19,6 +19,7 @@
 
 require 'rubygems'
 require 'rake'
+require 'set'
 
 unless defined?($TEST_CLUSTER)
   include Java
@@ -44,8 +45,25 @@ require 'test_helper'
 
 puts "Running tests..."
 
+if java.lang.System.get_property('shell.test.include')
+  includes = Set.new(java.lang.System.get_property('shell.test.include').split(','))
+end
+
+if java.lang.System.get_property('shell.test.exclude')
+  excludes = Set.new(java.lang.System.get_property('shell.test.exclude').split(','))
+end
+
 files = Dir[ File.dirname(__FILE__) + "/**/*_test.rb" ]
 files.each do |file|
+  filename = File.basename(file)
+  if includes != nil && !includes.include?(filename)
+    puts "Skip #{filename} because of not included"
+    next
+  end
+  if excludes != nil && excludes.include?(filename)
+    puts "Skip #{filename} because of excluded"
+    next
+  end
   begin
     load(file)
   rescue => e


Mime
View raw message