-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
[DISCUSS] [JDK17] Upgrade JUnit / JavaDoc from 4 to 5. #7337
base: trunk
Are you sure you want to change the base?
Conversation
💔 -1 overall
This message was automatically generated. |
Wow! Appreciate such a huge work! |
Thank you for your message! This PR is currently an experimental version (it cannot be merged directly). I have attempted to upgrade some modules related to hadoop-common from JUnit 4 to JUnit 5. During the upgrade process, there are some issues that need to be discussed with everyone to establish the basic standards for this module upgrade. |
@steveloughran @ayushtkn @Hexiaoqiao @jojochuang @aajisaka @cnauroth @szetszwo Upgrading JUnit from 4 to 5 is not only a technical upgrade opportunity but also a good chance for us to improve the test-related code and fix potential issues. I’d like to discuss whether the improvement strategies I’ve been considering are reasonable.
There are currently two ways to reference JUnit methods in the project:
I hope to unify all references to the first method (static imports) in this update, but I'm unsure if this is feasible.
I’ve noticed that many unit tests use the
There are several Checkstyle issues in the code, such as incomplete JavaDocs and typos. Should we also address these issues in this update? Some logs use
For example, the
We can’t make all the changes at once because there are too many involved modules, and some test classes have dependencies on each other. I’ve found that JUnit 4 and JUnit 5 can coexist, meaning that a module can have both JUnit 4 and JUnit 5 test styles, and the tests will still run successfully. For very large modules, we can modify them incrementally, based on the package structure. For example, for HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part1.
HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part2.
If we encounter unit tests that depend on other modules, we can leave them unchanged for now. Once the non-dependent parts of the other modules are upgraded, we can submit a single PR to complete the upgrade of the dependencies. Let’s illustrate with an example: The Due to these dependencies, we will not upgrade this abstract class for now. Instead, we will parallelly upgrade the parts of these three modules( I’d also like to sincerely thank @zhtttylz for providing the unit test upgrade tool. With this tool, I was able to complete the PR, which involves multiple modules, in just two days, significantly improving efficiency. If we can confirm the coding guidelines, @zhtttylz and I will submit the relevant PRs together to complete the JUnit version upgrade. I’m also willing to volunteer to drive and follow up on the upgrade work to ensure it’s completed in a shorter time frame. I estimate the upgrade should take about 1-3 months. |
Wow, this is awesome @slfan1989 and @zhtttylz ! Here are my opinions on how to proceed.
I'd like to suggest that in this phase, we stick to a minimal effort of making a straight translation to JUnit 5 in the interest of completing a JDK 17 release as soon as possible. These are going to be large pull requests to review, even after we break them into sub-tasks. It will take longer to code review if we start including other unrelated improvements. All of these proposals are good code quality improvements though. We can pick them up as future work after completing the JUnit 5 migration and after the JDK 17 release. I've also heard there's a desire to go toward AssertJ. If so, then that might change the plan on points 1 and 2.
I agree with your strategy here. It sounds like this is the best way to manage pull request size and code review process. |
@cnauroth Thank you for your message! I agree with your point of view. We will only make the necessary changes and will not adjust other improvements for now. Once the JUnit 5 upgrade is complete, we will proceed with further optimizations. Here are the improvement principles I've summarized:
|
@slfan1989 , great summary. Thank you for these patches! |
After the merge of HADOOP-15984, we noticed that some unit tests stopped running. To resolve this, we found a solution that allows the unit tests to run again. We can refer to HADOOP-19405. hadoop-aws and hadoop-azure tests have stopped running.(#7335) for more details. However, during the process of completing this PR, a new issue was exposed — we encountered a large number of Javadoc errors. During the JDK 11 upgrade, we addressed issues in some modules, but many modules still have Javadoc problems. We plan to address these issues during the JDK 17 upgrade process. I do not intend to create a separate JIRA and PR for each module to fix the Javadoc errors, as this would generate significant noise. Improving Javadoc does not pose any execution risks since the PRs won’t modify the code itself. For larger modules, such as hadoop-common, hdfs, hdfs-rbf, resourcemanager, and nodemanager, we will create individual JIRAs. For other modules, we will submit the changes under larger module scopes, such as |
To sync the recent progress, I have completed the upgrade of all MapReduce module tests from JUnit4 to JUnit5 locally (there may still be some issues, but we'll wait for Yetus feedback). I plan to start submitting the PRs tomorrow. |
The following PR is ready, please help to review it MapReduce: HADOOP: HDFS: |
Description of PR
Upgrading JUnit from 4 to 5 is a key task in the process of upgrading our Hadoop project to JDK 17. This task is somewhat complex due to the large number of unit tests and the high coupling between modules. The good news is that our team members have already submitted several upgrade-related PRs, which will significantly ease the workload for the subsequent upgrades. However, the previous upgrade efforts lacked a unified summary and tracking, making it difficult to monitor progress and manage the modules that still need to be upgraded. Therefore, the purpose of this PR is to centralize the tracking of the entire process of upgrading JUnit from 4 to 5, summarize the progress, address the issues encountered during the upgrade, and discuss key challenges.
I have thoroughly reviewed all of our modules and summarized the current upgrade progress.
The following modules need to be upgraded (if a module is completed, I will add the JIRA and PR links):
hadoop-client-integration-tests
HADOOP-19410. Upgrade JUnit from 4 to 5 in hadoop-client-integration-tests.
hadoop-cos
HADOOP-19411. Upgrade JUnit from 4 to 5 in hadoop-cos.
hadoop-huaweicloud
HADOOP-19412. Upgrade JUnit from 4 to 5 in hadoop-huaweicloud.
hadoop-auth
HADOOP-19414. Upgrade JUnit from 4 to 5 in hadoop-auth.
hadoop-common
HADOOP-19415. Upgrade JUnit from 4 to 5 in hadoop-common.(HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part1. #7339, HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part2. #7347)
hadoop-kms
HADOOP-19416. Upgrade JUnit from 4 to 5 in hadoop-kms.
hadoop-minikdc
HADOOP-19417. Upgrade JUnit from 4 to 5 in hadoop-minikdc.
hadoop-nfs
HADOOP-19418. Upgrade JUnit from 4 to 5 in hadoop-nfs.
hadoop-registry
HADOOP-19419. Upgrade JUnit from 4 to 5 in hadoop-registry.
hadoop-hdfs
HDFS-12431. Upgrade JUnit from 4 to 5 in hadoop-hdfs hdfs.
hadoop-hdfs-client
HDFS-17718. Upgrade JUnit from 4 to 5 in hadoop-hdfs-client.
hadoop-hdfs-httpfs
HDFS-17719. Upgrade JUnit from 4 to 5 in hadoop-hdfs-httpfs.
hadoop-hdfs-rbf
HDFS-17720. Upgrade JUnit from 4 to 5 in hadoop-hdfs-rbf.
hadoop-mapreduce-client-app
MAPREDUCE-7418. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-app.
hadoop-mapreduce-client-common
MAPREDUCE-7419. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-common.(MAPREDUCE-7419. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-common #5028)
hadoop-mapreduce-client-core
MAPREDUCE-7420. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-core.
hadoop-mapreduce-client-hs
MAPREDUCE-7414. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-hs.
hadoop-mapreduce-client-hs-plugins
MAPREDUCE-7413. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-hs-plugins.(MAPREDUCE-7413. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-hs-plugins #5023)
hadoop-mapreduce-client-jobclient
MAPREDUCE-7421. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-jobclient.
hadoop-mapreduce-client-nativetask
MAPREDUCE-7415. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-nativetask.(MAPREDUCE-7415. [JDK17] Upgrade Junit 4 to 5 in hadoop-mapreduce-client-nativetask. #7349)
hadoop-mapreduce-client-shuffle
MAPREDUCE-7416. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-shuffle.
hadoop-mapreduce-client-uploader
MAPREDUCE-7417. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-uploader.(MAPREDUCE-7417. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-uploader #5019)
hadoop-mapreduce-examples
MAPREDUCE-7422. Upgrade Junit 4 to 5 in hadoop-mapreduce-examples.(MAPREDUCE-7422. Upgrade Junit 4 to 5 in hadoop-mapreduce-examples #5029)
hadoop-aliyun
HADOOP-19421. Upgrade JUnit from 4 to 5 in hadoop-aliyun.
hadoop-archive-logs
HADOOP-19422. Upgrade JUnit from 4 to 5 in hadoop-archive-logs.
hadoop-archives
HADOOP-19423. Upgrade JUnit from 4 to 5 in hadoop-archives.
hadoop-aws
HADOOP-19424. Upgrade JUnit from 4 to 5 in hadoop-aws.
hadoop-azure
HADOOP-19425. Upgrade JUnit from 4 to 5 in hadoop-azure.
hadoop-azure-datalake
HADOOP-19426. Upgrade JUnit from 4 to 5 in hadoop-azure-datalake.
hadoop-compat-bench
HADOOP-19427. Upgrade JUnit from 4 to 5 in hadoop-compat-bench.
hadoop-datajoin
HADOOP-19430. Upgrade JUnit from 4 to 5 in hadoop-datajoin.
hadoop-distcp
HADOOP-19431. Upgrade JUnit from 4 to 5 in hadoop-distcp.
hadoop-dynamometer-blockgen
HADOOP-19428. Upgrade JUnit from 4 to 5 in hadoop-dynamometer-blockgen.
hadoop-dynamometer-infra
HADOOP-19429. Upgrade JUnit from 4 to 5 in hadoop-dynamometer-infra.
hadoop-dynamometer-workload
HADOOP-19432. Upgrade JUnit from 4 to 5 in hadoop-dynamometer-workload.
hadoop-extras
HADOOP-19433. Upgrade JUnit from 4 to 5 in hadoop-extras.
hadoop-federation-balance
HADOOP-19434. Upgrade JUnit from 4 to 5 in hadoop-federation-balance.
hadoop-fs2img
HADOOP-19435. Upgrade JUnit from 4 to 5 in hadoop-fs2img.
hadoop-gridmix
HADOOP-19436. Upgrade JUnit from 4 to 5 in hadoop-gridmix.
hadoop-kafka
HADOOP-19437. Upgrade JUnit from 4 to 5 in hadoop-kafka.
hadoop-resourceestimator
HADOOP-19438. Upgrade JUnit from 4 to 5 in hadoop-resourceestimator.
hadoop-rumen
HADOOP-19439. Upgrade JUnit from 4 to 5 in hadoop-rumen.
hadoop-sls
HADOOP-19440. Upgrade JUnit from 4 to 5 in hadoop-sls.
hadoop-streaming
HADOOP-19441. Upgrade JUnit from 4 to 5 in hadoop-streaming.
hadoop-yarn-api
YARN-8943. Upgrade JUnit from 4 to 5 in hadoop-yarn-api
hadoop-yarn-applications-catalog-webapp
YARN-11336. Upgrade Junit 4 to 5 in hadoop-yarn-applications-catalog-webapp (YARN-11336. Upgrade Junit 4 to 5 in hadoop-yarn-applications-catalog-webapp #4992)
hadoop-yarn-applications-distributedshell
YARN-11760. Upgrade JUnit from 4 to 5 in hadoop-yarn-applications-distributedshell.
hadoop-yarn-applications-mawo-core
YARN-11337. Upgrade Junit 4 to 5 in hadoop-yarn-applications-mawo(YARN-11337. Upgrade Junit 4 to 5 in hadoop-yarn-applications-mawo #4993)
hadoop-yarn-applications-unmanaged-am-launcher
YARN-11338. Upgrade Junit 4 to 5 in hadoop-yarn-applications-unmanaged-am-launcher(YARN-11338. Upgrade Junit 4 to 5 in hadoop-yarn-applications-unmanaged-am-launcher #4994)
hadoop-yarn-services-api
YARN-11339. Upgrade Junit 4 to 5 in hadoop-yarn-services-api.(YARN-11339. Upgrade Junit 4 to 5 in hadoop-yarn-services-api #4995)
hadoop-yarn-services-core
YARN-11761. Upgrade JUnit from 4 to 5 in hadoop-yarn-services-core.
hadoop-yarn-client
YARN-11244. Upgrade JUnit from 4 to 5 in hadoop-yarn-client.
hadoop-yarn-common
YARN-6946. Upgrade JUnit from 4 to 5 in hadoop-yarn-common.(YARN-6946. Upgrade JUnit from 4 to 5 in hadoop-yarn-common #4717)
hadoop-yarn-csi
YARN-11245. Upgrade JUnit from 4 to 5 in hadoop-yarn-csi (YARN-11245. Upgrade JUnit from 4 to 5 in hadoop-yarn-csi #4778)
hadoop-yarn-server-applicationhistoryservice
YARN-10793. Upgrade Junit from 4 to 5 in hadoop-yarn-server-applicationhistoryservice(YARN-10793. Upgrade Junit from 4 to 5 in hadoop-yarn-server-applicationhistoryservice #4603)
hadoop-yarn-server-common
YARN-11258. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-common.
hadoop-yarn-server-globalpolicygenerator
YARN-11762. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-globalpolicygenerator.
hadoop-yarn-server-nodemanager
YARN-11263. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-nodemanager.
hadoop-yarn-server-resourcemanager
YARN-11262. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-resourcemanager.
hadoop-yarn-server-router
YARN-11267. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-router.
hadoop-yarn-server-sharedcachemanager
YARN-11265. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-sharedcachemanager.(YARN-11265. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-sharedcachemanager #4772)
hadoop-yarn-server-tests
YARN-11264. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-tests.(YARN-11264. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-tests #4776)
hadoop-yarn-server-timeline-pluginstorage
YARN-11269. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timeline-pluginstorage.(YARN-11269. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timeline-pluginstorage #4771)
hadoop-yarn-server-timelineservice
YARN-11260. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timelineservice.(YARN-11260. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timelineservice #4775)
hadoop-yarn-server-timelineservice-documentstore
YARN-11268. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timelineservice-documentstore.
hadoop-yarn-server-timelineservice-hbase-client
YARN-11270. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timelineservice-hbase-client.(YARN-11270. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timelineservice-hbase-client #4773)
hadoop-yarn-server-timelineservice-hbase-common
YARN-11271. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timelineservice-hbase-common. (YARN-11271. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timelineservice-hbase-common #4774)
hadoop-yarn-server-timelineservice-hbase-server-2
YARN-11763. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timelineservice-hbase-server-2.
hadoop-yarn-server-timelineservice-hbase-tests
YARN-11266. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-timelineservice-hbase-tests.
hadoop-yarn-server-web-proxy
YARN-11261. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-web-proxy.(YARN-11261. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-web-proxy #4777)
How was this patch tested?
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?