joshelser 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_r368024179
 
 

 ##########
 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:
   I like it.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to