You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "lsq3497 (via GitHub)" <gi...@apache.org> on 2026/06/06 09:33:20 UTC
[PR] [ISSUE #10430] Add unit tests for srvutil package [rocketmq]
lsq3497 opened a new pull request, #10431:
URL: https://github.com/apache/rocketmq/pull/10431
### Which Issue(s) This PR Fixes
Fixes #10430
### Brief Description
Add unit tests for `ServerUtil` and `ShutdownHookThread` in the `srvutil` package.
The added tests cover:
- command line option construction
- command line to properties conversion
- null option handling
- shutdown hook callback execution
- exception handling during callback invocation
### How Did You Test This Change?
Run unit tests locally and verified all tests pass successfully.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE #10430] Add unit tests for srvutil package [rocketmq]
Posted by "RongtongJin (via GitHub)" <gi...@apache.org>.
RongtongJin commented on PR #10431:
URL: https://github.com/apache/rocketmq/pull/10431#issuecomment-4641194883
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE #10430] Add unit tests for srvutil package [rocketmq]
Posted by "ShannonDing (via GitHub)" <gi...@apache.org>.
ShannonDing merged PR #10431:
URL: https://github.com/apache/rocketmq/pull/10431
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE #10430] Add unit tests for srvutil package [rocketmq]
Posted by "ShannonDing (via GitHub)" <gi...@apache.org>.
ShannonDing commented on PR #10431:
URL: https://github.com/apache/rocketmq/pull/10431#issuecomment-4655231156
link #8262
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE #10430] Add unit tests for srvutil package [rocketmq]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #10431:
URL: https://github.com/apache/rocketmq/pull/10431#issuecomment-4641244498
## [Codecov](https://app.codecov.io/gh/apache/rocketmq/pull/10431?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 47.99%. Comparing base ([`330dccc`](https://app.codecov.io/gh/apache/rocketmq/commit/330dccc6b461d870378b17392d8ea6b059fe1bce?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a69e076`](https://app.codecov.io/gh/apache/rocketmq/commit/a69e076f1121ce825114d6bfbde0266121184ae0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 66 commits behind head on develop.
<details><summary>Additional details and impacted files</summary>
```diff
@@ 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
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/rocketmq/pull/10431?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org