-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19426. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-azure-datalake Part2. #7757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
zhtttylz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1,LGTM @slfan1989
|
@anujmodi2021 Could you please help review this PR? Thank you very much! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the TestAdlPermissionLive class from JUnit 4 to JUnit 5 parameterized tests and removes the custom Parallelized runner.
- Converted JUnit 4 annotations and assertions to their JUnit 5 equivalents.
- Removed the
Parallelizedhelper and switched to@ParameterizedTestwith@MethodSource. - Updated imports and test setup/cleanup methods to use JUnit 5 APIs.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| hadoop-tools/hadoop-azure-datalake/src/test/java/org/apache/hadoop/fs/adl/live/TestAdlPermissionLive.java | Migrated tests to JUnit 5 parameterized style, replaced annotations and assertions |
| hadoop-tools/hadoop-azure-datalake/src/test/java/org/apache/hadoop/fs/adl/common/Parallelized.java | Removed obsolete JUnit 4 parallel runner helper |
Comments suppressed due to low confidence (2)
hadoop-tools/hadoop-azure-datalake/src/test/java/org/apache/hadoop/fs/adl/live/TestAdlPermissionLive.java:54
- [nitpick] The method name
initTestAdlPermissionLiveis verbose; consider renaming to a more concise name likesetupPermissionTestto better reflect its role.
public void initTestAdlPermissionLive(FsPermission pTestPermission) throws Exception {
hadoop-tools/hadoop-azure-datalake/src/test/java/org/apache/hadoop/fs/adl/live/TestAdlPermissionLive.java:84
- Consider annotating this setup method with
@BeforeEach(JUnit 5) instead of manual invocation in your init helper, to align with JUnit 5 conventions and reduce boilerplate.
public void setUp() throws Exception {
| } | ||
|
|
||
| @Parameterized.Parameters(name = "{0}") | ||
| public static Collection adlCreateNonRecursiveTestData() |
Copilot
AI
Jun 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a parameterized generic return type Collection<FsPermission> for the data provider to avoid raw-type warnings and improve type safety.
| public static Collection adlCreateNonRecursiveTestData() | |
| public static Collection<FsPermission[]> adlCreateNonRecursiveTestData() |
| if (AdlStorageConfiguration.isContractTestEnabled()) { | ||
| Assert.assertTrue(AdlStorageConfiguration.createStorageConnector() | ||
| assertTrue(AdlStorageConfiguration.createStorageConnector() | ||
| .delete(testRoot, true)); |
Copilot
AI
Jun 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Add a descriptive message to this assertion to clarify failure context, e.g., assertTrue(..., "Failed to clean up testRoot directory").
| .delete(testRoot, true)); | |
| .delete(testRoot, true), "Failed to clean up testRoot directory during cleanup."); |
anujmodi2021
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 LGTM
Just need to check if we need to add @beforeeach and @AfterEach at required places or not
| } | ||
| } | ||
|
|
||
| @Before |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need @beforeeach here after removing @before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anujmodi2021 Thank you for your question! ParameterizedTest in JUnit 5 is a special type of unit test. Unlike JUnit 4, ParameterizedTest requires the initialization of certain parameters directly in the test method, so the setup function is executed at that point. If we add @BeforeEach, the variables in setup would not be initialized yet. Therefore, we don't need to add @BeforeEach; instead, we should call setup within initTestAdlPermissionLive.
|
Thanks a lot @slfan1989 |
|
@anujmodi2021 @zhtttylz Thank you very much for the review! |
Description of PR
JIRA: HADOOP-19426. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-azure-datalake Part2.
How was this patch tested?
mvn clean test & junit test.
For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles?