Skip to content

HBASE-29876 Upgrade hbase-shell to use junit5#7752

Merged
Apache9 merged 2 commits intoapache:branch-2.5from
liuxiaocs7:HBASE-29876-branch-2.5
Feb 14, 2026
Merged

HBASE-29876 Upgrade hbase-shell to use junit5#7752
Apache9 merged 2 commits intoapache:branch-2.5from
liuxiaocs7:HBASE-29876-branch-2.5

Conversation

@liuxiaocs7
Copy link
Contributor

@Apache9 Apache9 merged commit b69e00c into apache:branch-2.5 Feb 14, 2026
19 checks passed
Comment on lines +97 to +98
@BeforeEach
public void setUpEach() throws Exception {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @Apache9

During the migration from Junit4 to Junit5, I discovered that the BeforeClass initialization method subclass with the same name in Junit4 would override the parent class. However, in Junit5, the subclass does not directly override the parent class. Instead, the parent class is executed first, followed by the subclass, which leads to method incompatibilities (such as the possibility of starting both MiniClusters, resulting in failure).

For example, in TestChangeSftShell and TestRSGroupShell, I believe there may be similar issues in other parts of the HBase codebase.

Here, we modified BeforeClass to BeforeEach and overridden it in the subclass. Since we only have one unit test method at most, how can we minimize modifications when there are many unit test methods? Do you have any suggestions, thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Better to only add BeforeAll AfterAll annotations in sub classes, and make sub classes call static method in the parent class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better to only add BeforeAll AfterAll annotations in sub classes, and make sub classes call static method in the parent class.

Got it, thanks!

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