[ISSUE #10430] Add unit tests for srvutil package#10431
Conversation
RongtongJin
left a comment
There was a problem hiding this comment.
ERROR: /home/runner/work/rocketmq/rocketmq/srvutil/BUILD.bazel:38:13: Building srvutil/libtests.jar (3 source files) failed: (Exit 1): java failed: error executing command (from target //srvutil:tests) external/remotejdk21_linux/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' ... (remaining 19 arguments skipped)
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
srvutil/src/test/java/org/apache/rocketmq/srvutil/ServerUtilTest.java:34: warning: [strict] Using type org.apache.commons.cli.Options from an indirect dependency (TOOL_INFO: "bazel-out/k8-fastbuild/bin/external/maven/v1/https/repo1.maven.org/maven2/commons-cli/commons-cli/1.5.0/header_commons-cli-1.5.0.jar").
Options options = ServerUtil.buildCommandlineOptions(new Options());
^
srvutil/src/test/java/org/apache/rocketmq/srvutil/ShutdownHookThreadTest.java:37: warning: [strict] Using type org.apache.rocketmq.logging.org.slf4j.Logger from an indirect dependency (TOOL_INFO: "bazel-out/k8-fastbuild/bin/external/maven/v1/https/repo1.maven.org/maven2/io/github/aliyunmq/rocketmq-slf4j-api/1.0.1/header_rocketmq-slf4j-api-1.0.1.jar").
Logger logger = Mockito.mock(Logger.class);
^
srvutil/src/test/java/org/apache/rocketmq/srvutil/ServerUtilTest.java:34: warning: [strict] Using type org.apache.commons.cli.Options from an indirect dependency (TOOL_INFO: "bazel-out/k8-fastbuild/bin/external/maven/v1/https/repo1.maven.org/maven2/commons-cli/commons-cli/1.5.0/header_commons-cli-1.5.0.jar").
Options options = ServerUtil.buildCommandlineOptions(new Options());
^
srvutil/src/test/java/org/apache/rocketmq/srvutil/ShutdownHookThreadTest.java:37: warning: [strict] Using type org.apache.rocketmq.logging.org.slf4j.Logger from an indirect dependency (TOOL_INFO: "bazel-out/k8-fastbuild/bin/external/maven/v1/https/repo1.maven.org/maven2/io/github/aliyunmq/rocketmq-slf4j-api/1.0.1/header_rocketmq-slf4j-api-1.0.1.jar").
Logger logger = Mockito.mock(Logger.class);
^
srvutil/src/test/java/org/apache/rocketmq/srvutil/ShutdownHookThreadTest.java:46: error: [DoNotCall] Calling run on Thread runs work on this thread, rather than the given thread, you probably meant to call start
shutdownHookThread.run();
^
(see https://errorprone.info/bugpattern/DoNotCall)
srvutil/src/test/java/org/apache/rocketmq/srvutil/ShutdownHookThreadTest.java:47: error: [DoNotCall] Calling run on Thread runs work on this thread, rather than the given thread, you probably meant to call start
shutdownHookThread.run();
^
(see https://errorprone.info/bugpattern/DoNotCall)
srvutil/src/test/java/org/apache/rocketmq/srvutil/ShutdownHookThreadTest.java:64: error: [DoNotCall] Calling run on Thread runs work on this thread, rather than the given thread, you probably meant to call start
shutdownHookThread.run();
^
(see https://errorprone.info/bugpattern/DoNotCall)
INFO: Elapsed time: 20.353s, Critical Path: 10.52s
INFO: 1168 processes: 604 remote cache hit, 562 internal, 2 remote.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10431 +/- ##
=============================================
- Coverage 48.90% 47.99% -0.91%
+ Complexity 13363 13287 -76
=============================================
Files 1373 1377 +4
Lines 99870 100613 +743
Branches 12904 12992 +88
=============================================
- Hits 48837 48293 -544
- Misses 45114 46376 +1262
- Partials 5919 5944 +25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Which Issue(s) This PR Fixes
Fixes #10430
Brief Description
Add unit tests for
ServerUtilandShutdownHookThreadin thesrvutilpackage.The added tests cover:
How Did You Test This Change?
Run unit tests locally and verified all tests pass successfully.