Skip to content

[ISSUE #13437] fix: readiness http response code 500 when not health #13644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2025

Conversation

shalk
Copy link
Contributor

@shalk shalk commented Jul 25, 2025

Please do not create a Pull Request without creating an issue first.

What is the purpose of the change

fix #13437

Brief changelog

XX

Verifying this change

XXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

Copy link

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API新增配置参数修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

Copy link

lingma-agents bot commented Jul 25, 2025

修复就绪检查HTTP响应状态码问题

变更概述
  • 问题修复

    • 修复了控制台健康检查控制器中就绪检查接口返回HTTP状态码不正确的问题
    • 当健康检查失败时,现在正确返回HTTP 500状态码而不是默认的200
    • 使用ResponseEntity明确控制HTTP响应状态,提升API的语义清晰度
    • 添加了相应的测试用例验证失败情况下的状态码返回
  • 测试更新

    • 新增了就绪检查失败情况的单元测试
    • 验证当健康检查返回失败时,HTTP状态码正确设置为500
    • 完善了就绪检查接口的测试覆盖
变更文件
文件路径 变更说明
console/​src/​main/​java/​com/​alibaba/​nacos/​console/​controller/​v3/​ConsoleHealthController.​java 修改了readiness方法的返回类型,使用ResponseEntity来明确控制HTTP状态码,当健康检查失败时返回500状态码。
console/​src/​test/​java/​com/​alibaba/​nacos/​console/​controller/​v3/​ConsoleHealthControllerTest.​java 添加了readiness检查失败情况的测试用例,验证HTTP 500状态码的正确返回。

💡 小贴士

与 lingma-agents 交流的方式

📜 直接回复评论
直接回复本条评论,lingma-agents 将自动处理您的请求。例如:

  • 在当前代码中添加详细的注释说明。

  • 请详细介绍一下你说的 LRU 改造方案,并使用伪代码加以说明。

📜 在代码行处标记
在文件的特定位置创建评论并 @lingma-agents。例如:

  • @lingma-agents 分析这个方法的性能瓶颈并提供优化建议。

  • @lingma-agents 对这个方法生成优化代码。

📜 在讨论中提问
在任何讨论中 @lingma-agents 来获取帮助。例如:

  • @lingma-agents 请总结上述讨论并提出解决方案。

  • @lingma-agents 请根据讨论内容生成优化代码。

@shalk shalk changed the title fix: readiness http response code 500 when not health [ISSUE 13437] fix: readiness http response code 500 when not health Jul 25, 2025
@shalk shalk changed the title [ISSUE 13437] fix: readiness http response code 500 when not health [ISSUE #13437] fix: readiness http response code 500 when not health Jul 25, 2025
@KomachiSion KomachiSion added this to the 3.0.3 milestone Jul 28, 2025
@KomachiSion KomachiSion added kind/enhancement Category issues or prs related to enhancement. area/Nacos Core labels Jul 28, 2025
@KomachiSion KomachiSion merged commit 09be634 into alibaba:develop Jul 28, 2025
5 checks passed
@wuyfee
Copy link

wuyfee commented Jul 28, 2025

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
❌ - deploy (standalone & cluster & standalone_auth): failure
❌ - e2e-java-test (standalone & cluster & standalone_auth): skipped
❌ - e2e-go-test (standalone & cluster): skipped
❌ - e2e-cpp-test (standalone & cluster): skipped
❌ - e2e-csharp-test (standalone & cluster): skipped
❌ - e2e-nodejs-test (standalone & cluster): skipped
❌ - e2e-python-test (standalone & cluster): skipped
✅ - clean (standalone & cluster & standalone_auth): success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Nacos Core kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The readiness API returns inconsistent results across multiple versions
3 participants