Re: [PR] HBASE-30089 Rewrite AbstractTestAsyncTableScan and related sub classes [hbase]

2026-04-25 Thread via GitHub


Apache9 merged PR #8099:
URL: https://github.com/apache/hbase/pull/8099


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

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-30089 Rewrite AbstractTestAsyncTableScan and related sub classes [hbase]

2026-04-25 Thread via GitHub


Apache9 commented on PR #8099:
URL: https://github.com/apache/hbase/pull/8099#issuecomment-4319906301

   THe failed UTs are not related.


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

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-30089 Rewrite AbstractTestAsyncTableScan and related sub classes [hbase]

2026-04-25 Thread via GitHub


Apache9 commented on code in PR #8099:
URL: https://github.com/apache/hbase/pull/8099#discussion_r3142138681


##
hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableScan.java:
##
@@ -44,82 +45,66 @@
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.ConnectionRule;
 import org.apache.hadoop.hbase.HBaseTestingUtil;
 import org.apache.hadoop.hbase.MatcherPredicate;
-import org.apache.hadoop.hbase.MiniClusterRule;
-import org.apache.hadoop.hbase.StartTestingClusterOption;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.Waiter;
 import org.apache.hadoop.hbase.ipc.RemoteWithExtrasException;
 import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException;
 import org.apache.hadoop.hbase.trace.HBaseSemanticAttributes;
-import org.apache.hadoop.hbase.trace.OpenTelemetryClassRule;
-import org.apache.hadoop.hbase.trace.OpenTelemetryTestRule;
 import org.apache.hadoop.hbase.trace.TraceUtil;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.JVMClusterUtil;
 import org.apache.hadoop.hbase.util.Pair;
 import org.hamcrest.Matcher;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExternalResource;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TestName;
-import org.junit.rules.TestRule;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.params.provider.Arguments;
 
-public abstract class AbstractTestAsyncTableScan {
+import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
 
-  protected static final OpenTelemetryClassRule OTEL_CLASS_RULE = 
OpenTelemetryClassRule.create();
+public abstract class AbstractTestAsyncTableScan {
 
-  private static Configuration createConfiguration() {
-Configuration conf = new Configuration();
-// Disable directory sharing to prevent race conditions when tests run in 
parallel.
-// Each test instance gets its own isolated directories to avoid one 
test's tearDown()
-// deleting directories another parallel test is still using.
-conf.setBoolean("hbase.test.disable-directory-sharing", true);
-return conf;
-  }
+  @RegisterExtension
+  protected static final OpenTelemetryExtension OTEL_EXT = 
OpenTelemetryExtension.create();
 
-  protected static final MiniClusterRule MINI_CLUSTER_RULE =
-MiniClusterRule.newBuilder().setConfiguration(createConfiguration())
-  
.setMiniClusterOption(StartTestingClusterOption.builder().numWorkers(3).build()).build();
+  protected static final HBaseTestingUtil UTIL = new HBaseTestingUtil();
 
-  protected static final ConnectionRule CONN_RULE =
-
ConnectionRule.createAsyncConnectionRule(MINI_CLUSTER_RULE::createAsyncConnection);
+  protected static AsyncConnection CONN;
 
-  private static final class Setup extends ExternalResource {
-@Override
-protected void before() throws Throwable {
-  final HBaseTestingUtil testingUtil = 
MINI_CLUSTER_RULE.getTestingUtility();
-  final AsyncConnection conn = CONN_RULE.getAsyncConnection();
+  protected String methodName;
 
-  byte[][] splitKeys = new byte[8][];
-  for (int i = 111; i < 999; i += 111) {
-splitKeys[i / 111 - 1] = Bytes.toBytes(String.format("%03d", i));
-  }
-  testingUtil.createTable(TABLE_NAME, FAMILY, splitKeys);
-  testingUtil.waitTableAvailable(TABLE_NAME);
-  conn.getTable(TABLE_NAME)
-.putAll(IntStream.range(0, COUNT)
-  .mapToObj(i -> new Put(Bytes.toBytes(String.format("%03d", i)))
-.addColumn(FAMILY, CQ1, Bytes.toBytes(i)).addColumn(FAMILY, CQ2, 
Bytes.toBytes(i * i)))
-  .collect(Collectors.toList()))
-.get();
+  @BeforeAll
+  public static void setUpBeforeClass() throws Exception {
+UTIL.startMiniCluster(3);
+byte[][] splitKeys = new byte[8][];
+for (int i = 111; i < 999; i += 111) {
+  splitKeys[i / 111 - 1] = Bytes.toBytes(String.format("%03d", i));
 }
+UTIL.createTable(TABLE_NAME, FAMILY, splitKeys);
+UTIL.waitTableAvailable(TABLE_NAME);
+try (Table table = UTIL.getConnection().getTable(TABLE_NAME)) {
+  table.put(IntStream.range(0, COUNT)
+.mapToObj(i -> new Put(Bytes.toBytes(String.format("%03d", i)))
+  .addColumn(FAMILY, CQ1, Bytes.toBytes(i)).addColumn(FAMILY, CQ2, 
Bytes.toBytes(i * i)))
+.collect(Collectors.toList()));
+}
+CONN = 
ConnectionFactory.createAsyncConnection(UTIL.getConfiguration()).get();
   }
 
-  @ClassRule
-  public static final TestRule classRule = RuleChain.outerRule(OTEL_CLASS_RULE)
-.around(MINI_CLUSTER_RULE).around(CONN

Re: [PR] HBASE-30089 Rewrite AbstractTestAsyncTableScan and related sub classes [hbase]

2026-04-24 Thread via GitHub


liuxiaocs7 commented on PR #8099:
URL: https://github.com/apache/hbase/pull/8099#issuecomment-4311671879

   Hi, @Apache9, sorry for the late reply, seems there are conflicts now


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

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-30089 Rewrite AbstractTestAsyncTableScan and related sub classes [hbase]

2026-04-20 Thread via GitHub


Copilot commented on code in PR #8099:
URL: https://github.com/apache/hbase/pull/8099#discussion_r3109020274


##
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRawAsyncTableScan.java:
##
@@ -32,37 +32,31 @@
 import java.util.List;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
+import java.util.stream.Stream;
+import org.apache.hadoop.hbase.HBaseParameterizedTestTemplate;
 import org.apache.hadoop.hbase.client.trace.StringTraceRenderer;
 import org.apache.hadoop.hbase.testclassification.ClientTests;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.hamcrest.Matcher;
-import org.junit.ClassRule;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.params.provider.Arguments;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@RunWith(Parameterized.class)
-@Category({ LargeTests.class, ClientTests.class })
+@Tag(LargeTests.TAG)
+@Tag(ClientTests.TAG)
+@HBaseParameterizedTestTemplate(name = "{index}: scan={0}")
 public class TestRawAsyncTableScan extends AbstractTestAsyncTableScan {
   private static final Logger logger = 
LoggerFactory.getLogger(TestRawAsyncTableScan.class);
 
-  @ClassRule
-  public static final HBaseClassTestRule CLASS_RULE =
-HBaseClassTestRule.forClass(TestRawAsyncTableScan.class);
+  private Supplier scanCreater;
 
-  @Parameter(0)
-  public String scanType;
-
-  @Parameter(1)
-  public Supplier scanCreater;
+  // scanType is only for displaying
+  public TestRawAsyncTableScan(String scanType, Supplier scanCreater) {
+this.scanCreater = scanCreater;
+  }

Review Comment:
   The field/parameter name `scanCreater` appears to be a misspelling and is 
inconsistent with other classes in this PR that use `scanCreator`. Renaming to 
`scanCreator` will improve readability and reduce confusion.



##
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableScan.java:
##
@@ -32,37 +32,31 @@
 import java.util.concurrent.ForkJoinPool;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
+import java.util.stream.Stream;
+import org.apache.hadoop.hbase.HBaseParameterizedTestTemplate;
 import org.apache.hadoop.hbase.client.trace.StringTraceRenderer;
 import org.apache.hadoop.hbase.testclassification.ClientTests;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.hamcrest.Matcher;
-import org.junit.ClassRule;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.params.provider.Arguments;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@RunWith(Parameterized.class)
-@Category({ LargeTests.class, ClientTests.class })
+@Tag(LargeTests.TAG)
+@Tag(ClientTests.TAG)
+@HBaseParameterizedTestTemplate(name = "{index}: scan={0}")
 public class TestAsyncTableScan extends AbstractTestAsyncTableScan {
   private static final Logger logger = 
LoggerFactory.getLogger(TestAsyncTableScan.class);
 
-  @ClassRule
-  public static final HBaseClassTestRule CLASS_RULE =
-HBaseClassTestRule.forClass(TestAsyncTableScan.class);
+  private Supplier scanCreater;
 
-  @Parameter(0)
-  public String scanType;
-
-  @Parameter(1)
-  public Supplier scanCreater;
+  // scanType is only for displaying
+  public TestAsyncTableScan(String scanType, Supplier scanCreater) {
+this.scanCreater = scanCreater;
+  }

Review Comment:
   Same as in `TestRawAsyncTableScan`: `scanCreater` looks like a misspelling. 
Rename to `scanCreator` for consistency with 
`TestAsyncTableScanner`/`TestAsyncTableScanAll` and to avoid propagating the 
typo.



##
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableScanner.java:
##
@@ -29,46 +29,37 @@
 import io.opentelemetry.sdk.trace.data.SpanData;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.ForkJoinPool;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
+import java.util.stream.Stream;
+import org.apache.hadoop.hbase.HBaseParameterizedTestTemplate;
 import org.apache.hadoop.hbase.client.trace.StringTraceRenderer;
 import org.apache.hadoop.hbase.testclassification.ClientTests;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.hamcrest.Matcher;
-import org.junit.ClassRule;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.

[PR] HBASE-30089 Rewrite AbstractTestAsyncTableScan and related sub classes [hbase]

2026-04-17 Thread via GitHub


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

   (no comment)


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

For queries about this service, please contact Infrastructure at:
[email protected]