Skip to content

Conversation

@Layau-code
Copy link
Contributor

@Layau-code Layau-code commented Nov 25, 2025

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

  1. 在本地确认:
    • mvn -pl sentinel-transport/sentinel-transport-common -am -DskipTests=false test
    • 或完整构建:
      mvn -DskipTests=false clean verify
  2. 在运行后,测试 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)。

@Layau-code Layau-code force-pushed the fix/endpoint-tostring branch from 8ec423b to 563663e Compare December 18, 2025 09:19
Copy link
Collaborator

@LearningGp LearningGp left a comment

Choose a reason for hiding this comment

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

LGTM

@LearningGp LearningGp merged commit 222670e into alibaba:1.8 Dec 22, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] com.alibaba.csp.sentinel.transport.endpoint.EndPoint#toString()打印格式有误

2 participants