You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/01/17 04:51:32 UTC

[GitHub] [hbase] virajjasani commented on a change in pull request #1057: HBASE-23701 Try to converge automated checks around Category

virajjasani commented on a change in pull request #1057: HBASE-23701 Try to converge automated checks around Category
URL: https://github.com/apache/hbase/pull/1057#discussion_r367768244
 
 

 ##########
 File path: hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
 ##########
 @@ -59,13 +59,20 @@ private HBaseClassTestRule(Class<?> clazz, Timeout timeout) {
 
   private static long getTimeoutInSeconds(Class<?> clazz) {
     Category[] categories = clazz.getAnnotationsByType(Category.class);
-    for (Class<?> c : categories[0].value()) {
-      if (c == SmallTests.class || c == MediumTests.class || c == LargeTests.class) {
-        // All tests have a 13 minutes timeout.
-        return TimeUnit.MINUTES.toSeconds(13);
-      }
-      if (c == IntegrationTests.class) {
-        return TimeUnit.MINUTES.toSeconds(Long.MAX_VALUE);
+    // This should never happen
+    if (categories.length > 1) {
+      throw new IllegalArgumentException("Code-bug: unsure how to handle more than one Category");
+    }
+    // Fail gracefully if there is no Category defined
+    if (categories.length == 1) {
+      for (Class<?> c : categories[0].value()) {
+        if (c == SmallTests.class || c == MediumTests.class || c == LargeTests.class) {
 
 Review comment:
   nit: good to create immutable final set/list of all 3 values and then check with `if set.contains(c)`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services