You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2018/02/21 20:03:39 UTC

hbase git commit: HBASE-20031 Unable to run integration test using mvn due to missing HBaseClassTestRule

Repository: hbase
Updated Branches:
  refs/heads/master d9b8dcc1d -> 401227ba6


HBASE-20031 Unable to run integration test using mvn due to missing HBaseClassTestRule


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

Branch: refs/heads/master
Commit: 401227ba6aeb3c7767e88d41a7fa2990b3717648
Parents: d9b8dcc
Author: tedyu <yu...@gmail.com>
Authored: Wed Feb 21 12:03:32 2018 -0800
Committer: tedyu <yu...@gmail.com>
Committed: Wed Feb 21 12:03:32 2018 -0800

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/HBaseClassTestRule.java  |  4 ++++
 .../apache/hadoop/hbase/HBaseClassTestRuleChecker.java    | 10 ++++++++++
 src/main/asciidoc/_chapters/developer.adoc                |  3 ++-
 3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/401227ba/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
index a41e383..c3bef0f 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase;
 
 import java.util.concurrent.TimeUnit;
 
+import org.apache.hadoop.hbase.testclassification.IntegrationTests;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
@@ -63,6 +64,9 @@ public final class HBaseClassTestRule implements TestRule {
         // All tests have a 10minute timeout.
         return TimeUnit.MINUTES.toSeconds(13);
       }
+      if (c == IntegrationTests.class) {
+        return TimeUnit.MINUTES.toSeconds(Long.MAX_VALUE);
+      }
     }
     throw new IllegalArgumentException(
         clazz.getName() + " does not have SmallTests/MediumTests/LargeTests in @Category");

http://git-wip-us.apache.org/repos/asf/hbase/blob/401227ba/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRuleChecker.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRuleChecker.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRuleChecker.java
index 97c657f..c374903 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRuleChecker.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRuleChecker.java
@@ -22,8 +22,12 @@ import static org.junit.Assert.fail;
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.hbase.testclassification.IntegrationTests;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.junit.ClassRule;
+import org.junit.experimental.categories.Category;
 import org.junit.runner.Description;
 import org.junit.runner.notification.RunListener;
 import org.junit.runner.notification.RunListener.ThreadSafe;
@@ -37,6 +41,12 @@ public class HBaseClassTestRuleChecker extends RunListener {
 
   @Override
   public void testStarted(Description description) throws Exception {
+    Category[] categories = description.getTestClass().getAnnotationsByType(Category.class);
+    for (Class<?> c : categories[0].value()) {
+      if (c == IntegrationTests.class) {
+        return;
+      }
+    }
     for (Field field : description.getTestClass().getFields()) {
       if (Modifier.isStatic(field.getModifiers()) && field.getType() == HBaseClassTestRule.class &&
         field.isAnnotationPresent(ClassRule.class)) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/401227ba/src/main/asciidoc/_chapters/developer.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/_chapters/developer.adoc b/src/main/asciidoc/_chapters/developer.adoc
index 3dbfe74..c752cd7 100644
--- a/src/main/asciidoc/_chapters/developer.adoc
+++ b/src/main/asciidoc/_chapters/developer.adoc
@@ -1014,7 +1014,7 @@ The first three categories, `small`, `medium`, and `large`, are for test cases w
 type `$ mvn test`.
 In other words, these three categorizations are for HBase unit tests.
 The `integration` category is not for unit tests, but for integration tests.
-These are run when you invoke `$ mvn verify`.
+These are normally run when you invoke `$ mvn verify`.
 Integration tests are described in <<integration.tests,integration.tests>>.
 
 Keep reading to figure which annotation of the set `small`, `medium`, and `large`
@@ -1041,6 +1041,7 @@ Large Tests (((LargeTests)))::
 Integration Tests (((IntegrationTests)))::
   _Integration_ tests are system level tests.
   See <<integration.tests,integration.tests>> for more info.
+  If you invoke `$ mvn test` on integration tests, there is no timeout for the test.
 
 [[hbase.unittests.cmds]]
 === Running tests