fix: Endpoint#toString host formatting; add Endpoint unit test #3578
+33
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do
修复
Endpoint#toString()在打印host字段时缺少右单引号的 bug(会输出成host='localhost, port=8900}),导致日志或输出格式不规范。现已修复为:host='localhost'。同时新增单元测试EndpointTest,确保该格式不会回归。这个 PR 是否修复一个 issue?
Fixes #3573
实现方式
Endpoint#toString():补上 host 的闭合单引号。sentinel-transport/sentinel-transport-common/src/test/java/com/alibaba/csp/sentinel/transport/endpoint/EndpointTest.java,断言返回字符串包含闭合单引号。How to verify it
mvn -pl sentinel-transport/sentinel-transport-common -am -DskipTests=false testmvn -DskipTests=false clean verifyEndpointTest的断言应通过:Endpoint{protocol=HTTP, host='localhost', port=8900}Special notes for reviewers
document-lint工作流会对仓库中的 Markdown 做检查。如果你在 CI 看到document-lint失败,请放心 — 我会后续单独提交 docs PR 来处理 MD060 等问题(或我可以在需要时把 docs 改动一并提上 PR)。