Skip to content
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

MAPREDUCE-7418. [JDK17] Upgrade Junit 4 to 5 in hadoop-mapreduce-client-app. #7350

Merged
merged 6 commits into from
Feb 6, 2025

Conversation

slfan1989
Copy link
Contributor

@slfan1989 slfan1989 commented Feb 4, 2025

Description of PR

MAPREDUCE-7418. [JDK17] Upgrade Junit 4 to 5 in hadoop-mapreduce-client-app.

How was this patch tested?

Junit Test & mvn clean test.

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

@slfan1989 slfan1989 changed the title MAPREDUCE-7418. Upgrade Junit 4 to 5 in hadoop-mapreduce-client-app. MAPREDUCE-7418. [JDK17] Upgrade Junit 4 to 5 in hadoop-mapreduce-client-app. Feb 4, 2025
@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 19s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 51 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 22m 54s trunk passed
+1 💚 compile 0m 22s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 0m 19s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 0m 25s trunk passed
+1 💚 mvnsite 0m 25s trunk passed
+1 💚 javadoc 0m 26s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 0m 19s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 0m 42s trunk passed
+1 💚 shadedclient 20m 10s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 16s the patch passed
+1 💚 compile 0m 16s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 0m 16s the patch passed
+1 💚 compile 0m 14s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 0m 14s the patch passed
-1 ❌ blanks 0m 0s /blanks-eol.txt The patch has 23 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
-0 ⚠️ checkstyle 0m 17s /results-checkstyle-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-app.txt hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app: The patch generated 373 new + 856 unchanged - 89 fixed = 1229 total (was 945)
+1 💚 mvnsite 0m 17s the patch passed
+1 💚 javadoc 0m 15s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 0m 16s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 0m 38s the patch passed
+1 💚 shadedclient 24m 36s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 7m 9s /patch-unit-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-app.txt hadoop-mapreduce-client-app in the patch passed.
+1 💚 asflicense 0m 24s The patch does not generate ASF License warnings.
82m 14s
Reason Tests
Failed junit tests hadoop.mapreduce.v2.app.TestMRClientService
hadoop.mapreduce.v2.app.webapp.TestAMWebServicesJobConf
hadoop.mapreduce.v2.app.webapp.TestAMWebServicesAttempt
hadoop.mapreduce.v2.app.job.impl.TestJobImpl
hadoop.mapreduce.v2.app.webapp.TestAMWebApp
hadoop.mapred.TestTaskAttemptListenerImpl
hadoop.mapreduce.v2.app.TestJobEndNotifier
hadoop.mapreduce.v2.app.rm.TestRMContainerAllocator
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/1/artifact/out/Dockerfile
GITHUB PR #7350
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 216f2a95c08e 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 4d18776
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/1/testReport/
Max. process+thread count 741 (vs. ulimit of 5500)
modules C: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app U: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/1/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 21s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+0 🆗 detsecrets 0m 1s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 52 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 23m 11s trunk passed
+1 💚 compile 0m 21s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 0m 21s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 0m 27s trunk passed
+1 💚 mvnsite 0m 25s trunk passed
+1 💚 javadoc 0m 25s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 0m 21s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 0m 43s trunk passed
+1 💚 shadedclient 20m 9s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 14s the patch passed
+1 💚 compile 0m 16s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 0m 16s the patch passed
+1 💚 compile 0m 15s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 0m 15s the patch passed
-1 ❌ blanks 0m 0s /blanks-eol.txt The patch has 2 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
-0 ⚠️ checkstyle 0m 17s /results-checkstyle-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-app.txt hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app: The patch generated 118 new + 871 unchanged - 74 fixed = 989 total (was 945)
+1 💚 mvnsite 0m 17s the patch passed
+1 💚 javadoc 0m 15s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 0m 16s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 0m 38s the patch passed
+1 💚 shadedclient 19m 54s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 6m 57s /patch-unit-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-app.txt hadoop-mapreduce-client-app in the patch passed.
+1 💚 asflicense 0m 25s The patch does not generate ASF License warnings.
77m 41s
Reason Tests
Failed junit tests hadoop.mapreduce.v2.app.webapp.TestAMWebServicesJobConf
hadoop.mapreduce.v2.app.webapp.TestAMWebServicesAttempt
hadoop.mapreduce.v2.app.webapp.TestAMWebApp
hadoop.mapred.TestTaskAttemptListenerImpl
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/2/artifact/out/Dockerfile
GITHUB PR #7350
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux f3d5f5d9fb0c 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 405920d
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/2/testReport/
Max. process+thread count 740 (vs. ulimit of 5500)
modules C: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app U: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/2/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@slfan1989 slfan1989 marked this pull request as ready for review February 5, 2025 09:04
@github-actions github-actions bot added the YARN label Feb 5, 2025
@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 23s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 52 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 5m 31s Maven dependency ordering for branch
+1 💚 mvninstall 18m 52s trunk passed
+1 💚 compile 8m 53s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 8m 7s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 1m 58s trunk passed
+1 💚 mvnsite 1m 10s trunk passed
+1 💚 javadoc 1m 16s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 11s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 2m 0s trunk passed
+1 💚 shadedclient 20m 34s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 21s Maven dependency ordering for patch
+1 💚 mvninstall 0m 38s the patch passed
+1 💚 compile 8m 33s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 8m 33s the patch passed
+1 💚 compile 8m 16s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 8m 16s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 1m 59s /results-checkstyle-root.txt root: The patch generated 87 new + 910 unchanged - 74 fixed = 997 total (was 984)
+1 💚 mvnsite 1m 7s the patch passed
+1 💚 javadoc 1m 7s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 10s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 2m 9s the patch passed
+1 💚 shadedclient 20m 46s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 7m 49s /patch-unit-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-common.txt hadoop-yarn-common in the patch passed.
-1 ❌ unit 7m 11s /patch-unit-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-app.txt hadoop-mapreduce-client-app in the patch passed.
+1 💚 asflicense 0m 39s The patch does not generate ASF License warnings.
134m 37s
Reason Tests
Failed junit tests hadoop.yarn.webapp.TestWebApp
hadoop.mapred.TestTaskAttemptListenerImpl
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/3/artifact/out/Dockerfile
GITHUB PR #7350
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 9419db18b4eb 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 37e6bc2
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/3/testReport/
Max. process+thread count 720 (vs. ulimit of 5500)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/3/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@github-actions github-actions bot added the build label Feb 5, 2025
@slfan1989
Copy link
Contributor Author

@cnauroth Can you help review this pr? Thank you very much!

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 21s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 52 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 6m 42s Maven dependency ordering for branch
+1 💚 mvninstall 18m 58s trunk passed
+1 💚 compile 8m 50s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 8m 14s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 1m 59s trunk passed
+1 💚 mvnsite 1m 33s trunk passed
+1 💚 javadoc 1m 36s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 30s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+0 🆗 spotbugs 0m 28s branch/hadoop-project no spotbugs output file (spotbugsXml.xml)
+1 💚 shadedclient 20m 43s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 24s Maven dependency ordering for patch
+1 💚 mvninstall 0m 49s the patch passed
+1 💚 compile 8m 24s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 8m 24s the patch passed
+1 💚 compile 8m 9s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 8m 9s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 2m 2s /results-checkstyle-root.txt root: The patch generated 13 new + 907 unchanged - 77 fixed = 920 total (was 984)
+1 💚 mvnsite 1m 30s the patch passed
+1 💚 javadoc 1m 32s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 37s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+0 🆗 spotbugs 0m 25s hadoop-project has no data from spotbugs
+1 💚 shadedclient 22m 28s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 0m 24s hadoop-project in the patch passed.
+1 💚 unit 4m 50s hadoop-yarn-common in the patch passed.
+1 💚 unit 7m 11s hadoop-mapreduce-client-app in the patch passed.
+1 💚 asflicense 0m 40s The patch does not generate ASF License warnings.
138m 9s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/4/artifact/out/Dockerfile
GITHUB PR #7350
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient codespell detsecrets xmllint spotbugs checkstyle
uname Linux 0ca7f6270efd 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 3d7187e
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/4/testReport/
Max. process+thread count 666 (vs. ulimit of 5500)
modules C: hadoop-project hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/4/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@slfan1989
Copy link
Contributor Author

@cnauroth

The PR has the following points that need to be explained:

TestAMWebApp.java

In this unit test, EnvironmentVariables was introduced to simulate an SSL environment by modifying the System.Env environment variables during runtime. However, starting from JDK 9, direct modification of environment variables is prohibited. Therefore, we replaced it with the recommended approach using System.setProperty to set temporary variables. Additionally, we added logic in the WebApps to retrieve environment variables to ensure the test runs smoothly.

TestStagingCleanup.java

The Checkstyle issues in this class cannot be automatically fixed due to an extra space at the beginning of each line, which causes Checkstyle errors.

New Dependency: mockito-junit-jupiter

We introduced the mockito-junit-jupiter dependency to support the Mockito mocking functionality required in the TestTaskAttemptListenerImpl class.

@@ -369,9 +369,15 @@ public void setup() {

if (httpScheme.equals(WebAppUtils.HTTPS_PREFIX)) {
String amKeystoreLoc = System.getenv("KEYSTORE_FILE_LOCATION");
if (StringUtils.isBlank(amKeystoreLoc)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why were changes needed in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your question!

We made this adjustment because the unit tests TestAMWebApp#testMRWebAppSSLEnabled and TestAMWebApp#testMRWebAppSSLEnabledWithClientAuth are failing in JUnit 5.

In the original JUnit 4 environment, these tests relied on the EnvironmentVariables.set method to modify System.Env data. However, in JUnit 5, we can no longer modify the environment variables directly. One important reason for this is that starting from JDK 9, System.Env became an immutable structure. It is recommended to use System.setProperty and System.getProperty as replacements.

Therefore, we modified the unit tests to temporarily set System.setProperty, and also check if the variables we set exist in System.getProperty when used.

Copy link
Contributor

Choose a reason for hiding this comment

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

Understood, thank you!

import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

public class EnvironmentVariablesExtension implements BeforeEachCallback {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed? I couldn't find it used anywhere else in the patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I previously tried using a JUnit 5 extension to set the environment variables, but this approach didn't work as expected. In the latest code, I have removed this class.

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 21s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 1s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 52 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 6m 14s Maven dependency ordering for branch
+1 💚 mvninstall 20m 10s trunk passed
+1 💚 compile 9m 4s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 9m 5s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 2m 1s trunk passed
+1 💚 mvnsite 1m 16s trunk passed
+1 💚 javadoc 1m 19s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 15s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+0 🆗 spotbugs 0m 23s branch/hadoop-project no spotbugs output file (spotbugsXml.xml)
+1 💚 shadedclient 21m 5s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 22s Maven dependency ordering for patch
+1 💚 mvninstall 0m 50s the patch passed
+1 💚 compile 8m 35s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 8m 35s the patch passed
+1 💚 compile 8m 5s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 8m 5s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 1m 58s /results-checkstyle-root.txt root: The patch generated 10 new + 907 unchanged - 77 fixed = 917 total (was 984)
+1 💚 mvnsite 1m 34s the patch passed
+1 💚 javadoc 1m 35s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 35s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+0 🆗 spotbugs 0m 25s hadoop-project has no data from spotbugs
+1 💚 shadedclient 20m 52s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 0m 22s hadoop-project in the patch passed.
+1 💚 unit 4m 59s hadoop-yarn-common in the patch passed.
+1 💚 unit 7m 8s hadoop-mapreduce-client-app in the patch passed.
+1 💚 asflicense 0m 38s The patch does not generate ASF License warnings.
137m 51s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/5/artifact/out/Dockerfile
GITHUB PR #7350
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient codespell detsecrets xmllint spotbugs checkstyle
uname Linux 1640a5fe7745 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 31fab37
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/5/testReport/
Max. process+thread count 738 (vs. ulimit of 5500)
modules C: hadoop-project hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/5/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 21s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 52 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 6m 23s Maven dependency ordering for branch
+1 💚 mvninstall 19m 22s trunk passed
+1 💚 compile 9m 18s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 8m 21s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 1m 56s trunk passed
+1 💚 mvnsite 1m 17s trunk passed
+1 💚 javadoc 1m 21s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 15s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+0 🆗 spotbugs 0m 24s branch/hadoop-project no spotbugs output file (spotbugsXml.xml)
+1 💚 shadedclient 20m 24s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 22s Maven dependency ordering for patch
+1 💚 mvninstall 0m 49s the patch passed
+1 💚 compile 8m 27s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 8m 27s the patch passed
+1 💚 compile 7m 58s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 7m 58s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 1m 55s /results-checkstyle-root.txt root: The patch generated 9 new + 907 unchanged - 77 fixed = 916 total (was 984)
+1 💚 mvnsite 1m 33s the patch passed
+1 💚 javadoc 1m 35s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 36s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+0 🆗 spotbugs 0m 26s hadoop-project has no data from spotbugs
+1 💚 shadedclient 20m 31s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 0m 22s hadoop-project in the patch passed.
+1 💚 unit 4m 57s hadoop-yarn-common in the patch passed.
+1 💚 unit 7m 10s hadoop-mapreduce-client-app in the patch passed.
+1 💚 asflicense 0m 41s The patch does not generate ASF License warnings.
135m 26s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/6/artifact/out/Dockerfile
GITHUB PR #7350
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient codespell detsecrets xmllint spotbugs checkstyle
uname Linux 27eed8c7f66f 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / b9e9833
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/6/testReport/
Max. process+thread count 712 (vs. ulimit of 5500)
modules C: hadoop-project hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7350/6/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@@ -257,12 +260,6 @@ public void testGetMapCompletionEvents() throws IOException {
createTce(3, false, TaskAttemptCompletionEventStatus.FAILED) };
TaskAttemptCompletionEvent[] mapEvents = { taskEvents[0], taskEvents[2] };
Job mockJob = mock(Job.class);
when(mockJob.getTaskAttemptCompletionEvents(0, 100))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this code removed intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your comment!

We removed this part of the code based on the suggestion from Mockito, which indicated that this code was not called in the test and recommended its removal.

The error messages are as follows:

org.mockito.exceptions.misusing.UnnecessaryStubbingException: 
Unnecessary stubbings detected.
Clean & maintainable test code requires zero unnecessary code.
Following stubbings are unnecessary (click to navigate to relevant line of code):
  1. -> at org.apache.hadoop.mapred.TestTaskAttemptListenerImpl.testGetMapCompletionEvents(TestTaskAttemptListenerImpl.java:264)
  2. -> at org.apache.hadoop.mapred.TestTaskAttemptListenerImpl.testGetMapCompletionEvents(TestTaskAttemptListenerImpl.java:266)
  3. -> at org.apache.hadoop.mapred.TestTaskAttemptListenerImpl.testGetMapCompletionEvents(TestTaskAttemptListenerImpl.java:268)
Please remove unnecessary stubbings or use 'lenient' strictness. More info: javadoc for UnnecessaryStubbingException class.

@@ -369,9 +369,15 @@ public void setup() {

if (httpScheme.equals(WebAppUtils.HTTPS_PREFIX)) {
String amKeystoreLoc = System.getenv("KEYSTORE_FILE_LOCATION");
if (StringUtils.isBlank(amKeystoreLoc)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Understood, thank you!

Copy link
Contributor

@cnauroth cnauroth left a comment

Choose a reason for hiding this comment

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

+1

Thanks for following up with explanations, @slfan1989 !

@slfan1989
Copy link
Contributor Author

@cnauroth Thank you very much for reviewing the code! I will merge this PR into the trunk branch.

The Checkstyle issues will not be fixed for now, as they are caused by the TestStagingCleanup.java class. Some methods in this class have inaccurate Checkstyle (an extra space on each line). It will be fixed in the future when possible.

@slfan1989 slfan1989 merged commit d552670 into apache:trunk Feb 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants