Skip to content

HBASE-29910 Upgrade hbase-client to use junit5 - #7773

Merged
Apache9 merged 1 commit into
apache:masterfrom
liuxiaocs7:HBASE-29910
Feb 24, 2026
Merged

HBASE-29910 Upgrade hbase-client to use junit5#7773
Apache9 merged 1 commit into
apache:masterfrom
liuxiaocs7:HBASE-29910

Conversation

@liuxiaocs7

Copy link
Copy Markdown
Member

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request migrates the hbase-client test module from JUnit 4 to JUnit 5 (Jupiter) as part of HBASE-29910. The migration involves updating test annotations, assertions, lifecycle methods, and dependencies across approximately 60+ test files.

Changes:

  • Migrated all JUnit 4 annotations to JUnit 5 equivalents (@Test, @Before/@After, @BeforeClass/@AfterClass, @Category, etc.)
  • Updated assertion imports and reordered parameters to match JUnit 5 conventions (message parameter moved to last position)
  • Converted @Test(expected=...) to assertThrows() pattern
  • Migrated parameterized tests to use JUnit 5 approach with @HBaseParameterizedTestTemplate and @TestTemplate
  • Replaced TestName rule with TestInfo parameter injection
  • Updated OpenTelemetry testing from OpenTelemetryRule to OpenTelemetryExtension
  • Removed junit-vintage-engine dependency from pom.xml

Reviewed changes

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

Show a summary per file
FileDescription
pom.xmlRemoved junit-vintage-engine dependency
TestZNodePaths.javaUpdated to JUnit 5 annotations, removed HBaseClassTestRule
TestThreadLocalPoolMap.javaMigrated annotations and assertions
TestRoundRobinPoolMap.javaMigrated annotations and assertions
TestRotateFile.javaMigrated lifecycle annotations and TestName to TestInfo
PoolMapTestBase.javaUpdated @Before to @BeforeEach
BuilderStyleTest.javaSwapped assertion parameters to JUnit 5 order
TestProtobufUtil.javaMigrated annotations, updated javadoc reference
TestSaslUtil.javaConverted ExpectedException rule to assertThrows (with issues)
TestDefaultProviderSelector.javaConverted @test(expected) to assertThrows
TestSpaceLimitSettings.javaConverted exception tests to assertThrows pattern
TestQuotaSettingsFactory.javaComprehensive migration of assertions and exception tests
TestKeyOnlyFilter.javaMigrated to parameterized template with Stream API
TestMetricsConnection.javaMigrated to parameterized template
TestAsyncTableTracing.javaUpdated to OpenTelemetryExtension (with issue)
TestAsyncRegionLocatorTracing.javaUpdated to OpenTelemetryExtension (with issue)
TestAsyncConnectionTracing.javaUpdated to OpenTelemetryExtension (with issue)
(Additional ~40 files)Similar migration patterns applied consistently
Comments suppressed due to low confidence (6)

hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestBufferedMutatorParams.java:131

  • Extra semicolon after statement. This appears to be a typo - the line ends with ";;" instead of just ";".
 ;

hbase-client/src/test/java/org/apache/hadoop/hbase/security/TestSaslUtil.java:51

  • The assertion inside the assertThrows lambda will never be evaluated because initSaslProperties("xyz") will throw an exception. The assertion on line 50 will not execute. This assertion should be removed or the test logic restructured.
    hbase-client/src/test/java/org/apache/hadoop/hbase/security/TestSaslUtil.java:54
  • The assertThrows after the previous one (line 53) is missing. In the original code, there was a second exception.expect(IllegalArgumentException.class) before SaslUtil.initSaslProperties(""). This test case expects an exception to be thrown for empty string, but the new code doesn't wrap it in assertThrows.
    hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableTracing.java:113
  • The OpenTelemetryExtension is declared as static, but it should be non-static for JUnit 5 @RegisterExtension when used in instance methods. Static extensions are initialized once per class, while non-static extensions are initialized for each test. Since this extension is used in @BeforeEach methods, it should be non-static to ensure proper lifecycle management per test.
 @RegisterExtension
public static final OpenTelemetryExtension traceRule = OpenTelemetryExtension.create();

hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionLocatorTracing.java:79

  • The OpenTelemetryExtension is declared as static, but it should be non-static for JUnit 5 @RegisterExtension when used in instance methods. Static extensions are initialized once per class, while non-static extensions are initialized for each test. Since this extension is used in @BeforeEach methods, it should be non-static to ensure proper lifecycle management per test.
 @RegisterExtension
public static final OpenTelemetryExtension traceRule = OpenTelemetryExtension.create();

hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncConnectionTracing.java:58

  • The OpenTelemetryExtension is declared as static, but it should be non-static for JUnit 5 @RegisterExtension when used in instance methods. Static extensions are initialized once per class, while non-static extensions are initialized for each test. Since this extension is used in @BeforeEach methods, it should be non-static to ensure proper lifecycle management per test.
 @RegisterExtension
public static final OpenTelemetryExtension traceRule = OpenTelemetryExtension.create();

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

@Apache9
Apache9 merged commit 2ac4974 into apache:masterFeb 24, 2026
11 checks passed
Apache9 pushed a commit that referenced this pull request Feb 24, 2026
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 2ac4974)
Sign up for freeto 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.

3 participants

@liuxiaocs7@Apache9