Sentinel
Sentinel copied to clipboard
fix: Endpoint#toString host formatting; add Endpoint unit test
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 test- 或完整构建:
mvn -DskipTests=false clean verify
- 在运行后,测试
EndpointTest的断言应通过:- 期望:
Endpoint{protocol=HTTP, host='localhost', port=8900}
- 期望:
Special notes for reviewers
- 本 PR 仅包含代码与新增单元测试,不包含文档修复(README 表格样式)。我会把文档修复拆为单独的 PR(fix/docs-table-style),以避免混淆和便于审查。
- 说明:CI 的
document-lint工作流会对仓库中的 Markdown 做检查。如果你在 CI 看到document-lint失败,请放心 — 我会后续单独提交 docs PR 来处理 MD060 等问题(或我可以在需要时把 docs 改动一并提上 PR)。