You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "liuxiaocs7 (via GitHub)" <gi...@apache.org> on 2026/03/09 09:54:45 UTC

[PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

liuxiaocs7 opened a new pull request, #7887:
URL: https://github.com/apache/hbase/pull/7887

   - see: HBASE-29981


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #7887:
URL: https://github.com/apache/hbase/pull/7887#discussion_r2906468594


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/MiniClusterExtension.java:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.function.Supplier;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.client.AsyncConnection;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.Extension;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+/**
+ * An {@link Extension} that manages an instance of the {@link SingleProcessHBaseCluster}. Built on
+ * top of an instance of {@link HBaseTestingUtil}, so be weary of intermixing direct use of that
+ * class with this Extension.
+ * </p>
+ * Use in combination with {@link ConnectionExtension}, for example:
+ *
+ * <pre>
+ * {
+ *   &#64;code
+ *   public class TestMyClass {
+ *
+ *     &#64;RegisterExtension
+ *     public static final MiniClusterExtension miniClusterExtension =
+ *       MiniClusterExtension.newBuilder().build();
+ *
+ *     &#64;RegisterExtension
+ *     public final ConnectionExtension connectionExtension = ConnectionExtension
+ *       .createAsyncConnectionExtension(miniClusterExtension::createAsyncConnection);
+ *   }
+ * }
+ * </pre>
+ */
+public final class MiniClusterExtension implements BeforeAllCallback, AfterAllCallback {

Review Comment:
   We use  `MiniClusterExtension` in `TestCoprocessorEndpointTracing`, same as `ConnectionExtension`



##########
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpointTracing.java:
##########
@@ -118,39 +124,31 @@ public class TestCoprocessorEndpointTracing {
         ProtobufCoprocessorService.class.getName());
       return conf;
     }).build();
-  private static final ConnectionRule connectionRule =
-    ConnectionRule.createAsyncConnectionRule(miniclusterRule::createAsyncConnection);
-

Review Comment:
   we use `MiniClusterExtension` to replace `MiniClusterRule`



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on PR #7887:
URL: https://github.com/apache/hbase/pull/7887#issuecomment-4024968240

   > Are the changes in hbase-server module related?
   
   Yes, `TestAsyncCoprocessorEndpoint` and `TestAsyncCoprocessorOnAllRegionServersEndpoint`(under hbase-endpoint) extends `TestAsyncAdminBase`(under hbase-server), we need to update them together.
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #7887:
URL: https://github.com/apache/hbase/pull/7887#discussion_r2906451748


##########
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpointTracing.java:
##########
@@ -118,39 +124,31 @@ public class TestCoprocessorEndpointTracing {
         ProtobufCoprocessorService.class.getName());
       return conf;
     }).build();
-  private static final ConnectionRule connectionRule =
-    ConnectionRule.createAsyncConnectionRule(miniclusterRule::createAsyncConnection);
-

Review Comment:
   we use `MiniClusterExtension` to replace `MiniClusterRule`



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

Posted by "Apache9 (via GitHub)" <gi...@apache.org>.
Apache9 commented on PR #7887:
URL: https://github.com/apache/hbase/pull/7887#issuecomment-4045260048

   Please open PRs against other branches too?
   
   Thanks.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on PR #7887:
URL: https://github.com/apache/hbase/pull/7887#issuecomment-4028881273

   failed ut seems unrelated and pass locally
   
   <img width="1100" height="199" alt="image" src="https://github.com/user-attachments/assets/30e8bba0-c3ff-452c-b638-b1cfde626db9" />
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #7887:
URL: https://github.com/apache/hbase/pull/7887#discussion_r2906473076


##########
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpointTracing.java:
##########
@@ -98,18 +95,27 @@
 /**
  * Test cases to verify tracing coprocessor Endpoint execution
  */
-@Category({ CoprocessorTests.class, MediumTests.class })
+@Tag(CoprocessorTests.TAG)
+@Tag(MediumTests.TAG)
 public class TestCoprocessorEndpointTracing {
+
   private static final Logger logger =
     LoggerFactory.getLogger(TestCoprocessorEndpointTracing.class);
 
-  @ClassRule
-  public static final HBaseClassTestRule CLASS_RULE =
-    HBaseClassTestRule.forClass(TestCoprocessorEndpointTracing.class);
+  private static final TableName TEST_TABLE =
+    TableName.valueOf(TestCoprocessorEndpointTracing.class.getSimpleName());
+  private static final byte[] TEST_FAMILY = Bytes.toBytes("TestFamily");
+
+  private String testName;
+
+  @Order(1)
+  @RegisterExtension
+  private static final OpenTelemetryExtension otelExtension = OpenTelemetryExtension.create();
 
-  private static final OpenTelemetryClassRule otelClassRule = OpenTelemetryClassRule.create();
-  private static final MiniClusterRule miniclusterRule =
-    MiniClusterRule.newBuilder().setConfiguration(() -> {
+  @Order(2)
+  @RegisterExtension
+  private static final MiniClusterExtension miniClusterExtension =
+    MiniClusterExtension.newBuilder().setConfiguration(() -> {

Review Comment:
   We use `MiniClusterExtension` to replace `MiniClusterRule` here



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

Posted by "Apache9 (via GitHub)" <gi...@apache.org>.
Apache9 merged PR #7887:
URL: https://github.com/apache/hbase/pull/7887


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

Posted by "Apache9 (via GitHub)" <gi...@apache.org>.
Apache9 commented on code in PR #7887:
URL: https://github.com/apache/hbase/pull/7887#discussion_r2906083556


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/MiniClusterExtension.java:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.function.Supplier;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.client.AsyncConnection;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.Extension;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+/**
+ * An {@link Extension} that manages an instance of the {@link SingleProcessHBaseCluster}. Built on
+ * top of an instance of {@link HBaseTestingUtil}, so be weary of intermixing direct use of that
+ * class with this Extension.
+ * </p>
+ * Use in combination with {@link ConnectionExtension}, for example:
+ *
+ * <pre>
+ * {
+ *   &#64;code
+ *   public class TestMyClass {
+ *
+ *     &#64;RegisterExtension
+ *     public static final MiniClusterExtension miniClusterExtension =
+ *       MiniClusterExtension.newBuilder().build();
+ *
+ *     &#64;RegisterExtension
+ *     public final ConnectionExtension connectionExtension = ConnectionExtension
+ *       .createAsyncConnectionExtension(miniClusterExtension::createAsyncConnection);
+ *   }
+ * }
+ * </pre>
+ */
+public final class MiniClusterExtension implements BeforeAllCallback, AfterAllCallback {

Review Comment:
   Where do we use this extension in the current PR?



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-29981 Upgrade hbase-endpoint to use junit5 [hbase]

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 closed pull request #7887: HBASE-29981 Upgrade hbase-endpoint to use junit5
URL: https://github.com/apache/hbase/pull/7887


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org