-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part6. #7419
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. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
a00507f
to
5c1eb58
Compare
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
54b3c70
to
29806c0
Compare
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
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
Thanks for the efforts. Added some thoughts and query around the changes. Rest looks good to me.
...ct/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractAppendTest.java
Show resolved
Hide resolved
...op-common/src/test/java/org/apache/hadoop/fs/contract/localfs/TestLocalFSContractLoaded.java
Show resolved
Hide resolved
...mon/src/test/java/org/apache/hadoop/fs/contract/rawlocal/TestRawlocalContractPathHandle.java
Show resolved
Hide resolved
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.hadoop.fs.extend; |
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.
Seems like there is a similar class present in org.apache.hadoop.test
package. Are we planning to replace that?
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.
Thank you for pointing out this issue! I will reference an existing class instead of defining a new one.
} | ||
|
||
@Test | ||
public void testDTCredentialProviderFromCurrentUserCreds() throws Throwable { | ||
describe("Add credentials to the current user, " | ||
+ "then verify that they can be found when S3ADelegationTokens binds"); | ||
Credentials cred = createDelegationTokens(); | ||
assertThat("Token size", cred.getAllTokens(), hasSize(1)); | ||
assertThat(cred.getAllTokens()).hasSize(1). |
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.
This assertThat method is from org.assertj.core.api
and other assert related methods like assertTrue are from org.junit.jupiter.api
What is the general guideline here to follow for deciding which one to go with?
Or is the goal here to just get rid of all org.junit.Assert
methods and other two can be used as per developers preference?
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.
Thank you for raising this question! Personally, I believe we should go with AssertJ, as it aligns with our future direction. My suggestion is to first upgrade the unit tests to JUnit 5, and then gradually replace some of the JUnit assertions with AssertJ. This might take some time, as there are a large number of unit tests across the project that need to be updated.
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.
Yes. Got it. Agreed on having a single usage across repo. But yeah it won't be easy to replace all current ones and definitely not as a part of this effort.
But moving ahead for new tests we can try to directly use AssertJ. Will keep this in mind while working on patches and reviewing as well.
Hi @slfan1989
I found that both are failing because setup method which was supposed to be called before each test is not getting called. Working fine on trunk. Looks like some Junit 5 issue or a misses annotation. Also recommend checking contract tests for other distros as well. Thanks |
@anujmodi2021 Thank you for your feedback! I will fix these two unit tests and check if similar issues exist in other distros. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@anujmodi2021 Thank you very much for reviewing the code and providing valuable feedback. I've made the suggested changes and decided to merge this PR into the trunk branch. If any issues arise, feel free to @slfan1989 — I’ll prioritize resolving them. |
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
…6. (apache#7419) * HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part6. Co-authored-by: Anuj Modi <[email protected]> Co-authored-by: Hualong Zhang <[email protected]> Reviewed-by: Anuj Modi <[email protected]> Reviewed-by: Hualong Zhang <[email protected]> Signed-off-by: Shilun Fan <[email protected]>
Description of PR
JIRA: HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part6.
How was this patch tested?
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?