Skip to content

HBASE-30089 Rewrite AbstractTestAsyncTableScan and related sub classes#8099

Open
Apache9 wants to merge 1 commit intoapache:masterfrom
Apache9:HBASE-30089
Open

HBASE-30089 Rewrite AbstractTestAsyncTableScan and related sub classes#8099
Apache9 wants to merge 1 commit intoapache:masterfrom
Apache9:HBASE-30089

Conversation

@Apache9
Copy link
Copy Markdown
Contributor

@Apache9 Apache9 commented Apr 17, 2026

No description provided.

@Apache9 Apache9 self-assigned this Apr 17, 2026
@Apache9 Apache9 requested review from Copilot and liuxiaocs7 April 18, 2026 14:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Migrates the async table scan test suite from JUnit 4 parameterized/rules-based execution to a JUnit 5 @TestTemplate + parameter provider model, while restructuring cluster/connection setup and OpenTelemetry test integration.

Changes:

  • Replace JUnit 4 @RunWith(Parameterized.class) + @Parameters/@Parameter with JUnit 5 parameter streams via @HBaseParameterizedTestTemplate.
  • Rewrite AbstractTestAsyncTableScan lifecycle from rule chains to @BeforeAll/@AfterAll/@BeforeEach, using HBaseTestingUtil and a shared AsyncConnection.
  • Update tracing assertions to use a stored test name instead of the JUnit 4 TestName rule.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRawAsyncTableScan.java Port parameterization to JUnit 5 template and update connection usage + trace naming.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableScanner.java Port parameterization to JUnit 5 template and use supplied table factory for scanning.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableScanAll.java Port parameterization to JUnit 5 template and update trace naming.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableScan.java Port parameterization to JUnit 5 template and update connection usage + trace naming.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableScan.java Replace JUnit 4 rules with JUnit 5 lifecycle; rework mini-cluster/connection and OpenTelemetry integration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

public final TestName testName = new TestName();
@BeforeEach
public void setUp(TestInfo testInfo) {
methodName = testInfo.getTestMethod().get().getName();
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

methodName is set to the Java method name only. With @TestTemplate parameterized invocations, multiple runs of the same test method will typically share this value, which can cause span name collisions (e.g., waitForSpan(hasName(methodName)) may match a span from a different invocation). Consider using testInfo.getDisplayName() (or storing both method name + display name) and using that consistently for TraceUtil.trace(...) and span matchers so each invocation has a unique parent span name.

Suggested change
methodName = testInfo.getTestMethod().get().getName();
methodName = testInfo.getDisplayName();

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +57
private Supplier<Scan> scanCreater;

@Parameter(0)
public String scanType;

@Parameter(1)
public Supplier<Scan> scanCreater;
// scanType is only for displaying
public TestRawAsyncTableScan(String scanType, Supplier<Scan> scanCreater) {
this.scanCreater = scanCreater;
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +57
private Supplier<Scan> scanCreater;

@Parameter(0)
public String scanType;

@Parameter(1)
public Supplier<Scan> scanCreater;
// scanType is only for displaying
public TestAsyncTableScan(String scanType, Supplier<Scan> scanCreater) {
this.scanCreater = scanCreater;
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot uses AI. Check for mistakes.
Comment on lines +208 to +211
UTIL.getHBaseCluster().getRegionServerThreads().stream()
.map(JVMClusterUtil.RegionServerThread::getRegionServer).forEach(
rs -> assertEquals(
"The scanner count of " + rs.getServerName() + " is "
+ rs.getRSRpcServices().getScannersCount(),
0, rs.getRSRpcServices().getScannersCount()));
rs -> assertEquals(0, rs.getRSRpcServices().getScannersCount(), "The scanner count of "
+ rs.getServerName() + " is " + rs.getRSRpcServices().getScannersCount()));
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rs.getRSRpcServices().getScannersCount() is called twice per region server (once as the assertion actual value and again to build the message). Store the count in a local variable and reuse it so the assertion message always matches the asserted value and avoids duplicate calls.

Copilot uses AI. Check for mistakes.
Comment on lines +51 to +60
private Supplier<AsyncTable<?>> getTable;

@Parameter(0)
public String tableType;
private Supplier<Scan> scanCreator;

@Parameter(1)
public Supplier<AsyncTable<?>> getTable;

@Parameter(2)
public String scanType;

@Parameter(3)
public Supplier<Scan> scanCreator;
// tableType and scanType are only for displaying
public TestAsyncTableScanner(String tableType, Supplier<AsyncTable<?>> getTable, String scanType,
Supplier<Scan> scanCreator) {
this.getTable = getTable;
this.scanCreator = scanCreator;
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These constructor-initialized fields can be made final to document immutability of the test configuration per invocation and prevent accidental reassignment later.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants