HBASE-30146 Upgrade hbase-server to use junit5 Part18#8245
Open
liuxiaocs7 wants to merge 1 commit into
Open
Conversation
Member
liuxiaocs7
commented
May 16, 2026
- for branch-2.6
- see: HBASE-30146
There was a problem hiding this comment.
Pull request overview
This PR continues the HBASE-30146 effort on branch-2.6 by migrating a set of hbase-server RegionServer tests from JUnit4 to JUnit5, including updating assertions, lifecycle annotations, categories/tags, and converting several parameterized tests to the project’s JUnit5 template-based parameterization.
Changes:
- Replace JUnit4 annotations/rules (
@Before,@After,@BeforeClass,@AfterClass,@Category,@RunWith(Parameterized.class),TestName, etc.) with JUnit5 equivalents (@BeforeEach,@AfterEach,@BeforeAll,@AfterAll,@Tag,TestInfo, etc.). - Update assertions to JUnit5 (
org.junit.jupiter.api.Assertions) and fix parameter ordering where needed. - Convert multiple JUnit4 parameterized tests to
@HBaseParameterizedTestTemplate+@TestTemplatewithStream<Arguments>.
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWideScanner.java | JUnit5 assertions/tags and lifecycle annotation migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWALMonotonicallyIncreasingSeqId.java | Convert parameterized test to HBaseParameterizedTestTemplate/TestTemplate; use TestInfo; update lifecycle. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWalAndCompactingMemStoreFlush.java | JUnit5 annotations/tags and assertion signature updates. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTimestampFilterSeekHint.java | JUnit5 annotations/tags and lifecycle updates. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTagsReverseScan.java | Switch to JUnit5 assertions imports. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java | Switch to JUnit5 assertions imports. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTableDescriptorHashComputation.java | Replace JUnit4 categories/class rules with JUnit5 tags. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSyncTimeRangeTracker.java | Update assertions and JUnit5 tags. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSwitchToStreamRead.java | Migrate to JUnit5 lifecycle and @Disabled. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStripeStoreFileManager.java | JUnit5 lifecycle + tags migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStripeStoreEngine.java | JUnit5 tags and assertions migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScannerClosure.java | JUnit5 tags/lifecycle migration; assertion updates. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java | JUnit5 tags and assertion updates; replace @Ignore with @Disabled. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFileWriter.java | Convert to HBaseParameterizedTestTemplate/TestTemplate; JUnit5 lifecycle/assertions. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFileScannerWithTagCompression.java | Migrate class to JUnit5 tags/lifecycle/assertions. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFileRefresherChore.java | Replace TestName rule with TestInfo and update lifecycle/tags. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFileInfo.java | Switch to JUnit5 assertions and tags. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWithBlockingFiles.java | JUnit5 lifecycle/tags migration; assertion updates. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java | JUnit5 lifecycle/tags migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java | Replace TestName with TestInfo storage; JUnit5 lifecycle/tags and assertion updates. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java | JUnit5 lifecycle/tags migration; assertion updates. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSimpleTimeRangeTracker.java | JUnit5 tags/assertions migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestShutdownWhileWALBroken.java | Convert to HBaseParameterizedTestTemplate/TestTemplate; JUnit5 lifecycle/tags. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSettingTimeoutOnBlockingPoint.java | Replace TestName with TestInfo; JUnit5 lifecycle/tags; update failure assertions. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestServerNonceManager.java | JUnit5 tags/assertions migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java | Convert to HBaseParameterizedTestTemplate/TestTemplate; JUnit5 lifecycle/tags. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSecureBulkLoadManager.java | Convert to HBaseParameterizedTestTemplate/TestTemplate; JUnit5 lifecycle/tags; assertion updates. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSecureBulkloadListener.java | Replace JUnit4 rules with TestInfo; migrate to JUnit5 lifecycle/tags; use assertThrows. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSCVFWithMiniCluster.java | JUnit5 lifecycle/tags and assertion import migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanWithBloomError.java | Convert to HBaseParameterizedTestTemplate/TestTemplate; JUnit5 lifecycle/tags. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithCorruptHFile.java | Replace expected-exception style with assertThrows; JUnit5 lifecycle/tags. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java | Replace TestName with TestInfo; JUnit5 lifecycle/tags; assertion updates. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerTimeoutHandling.java | JUnit5 lifecycle/tags and assertions migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerRPCScanMetrics.java | Replace TestName with TestInfo; JUnit5 lifecycle/tags migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerRetriableFailure.java | Replace TableNameTestRule usage with TestInfo; JUnit5 lifecycle/tags migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerLeaseCount.java | JUnit5 lifecycle/tags; switch to assertThrows/assertTrue. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerHeartbeatMessages.java | JUnit5 lifecycle/tags and assertions migration. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerBlockSizeLimits.java | JUnit5 lifecycle/tags and assertion signature updates. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java | Replace TestName with TestInfo; JUnit5 tags and assertion updates. |
Comments suppressed due to low confidence (1)
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFileWriter.java:77
- There is an extra trailing semicolon after the HBaseTestingUtility field initialization (
new HBaseTestingUtility();;). This can trip Checkstyle (empty statement) and should be removed.
private final int ROW_NUM = 100;
private final Random RANDOM = new Random(11);
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();;
private HRegion[] regions = new HRegion[2];
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4fb0b93 to
dd5d1e7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.