Skip to content

[ISSUE #11337] test(controller): cover ControllerClosure response propagation - #11346

Open
chennaji9 wants to merge 1 commit into
apache:developfrom
chennaji9:cnj/test-controller-closure
Open

chennaji9 wants to merge 1 commit into
apache:developfrom
chennaji9:cnj/test-controller-closure

Conversation

@chennaji9

@chennaji9 chennaji9 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #11337

Brief Description

Adds ControllerClosureTest, direct coverage of how every JRaft-driven controller request completes (currently untested):

  • run(Status.OK) completes the future with the configured response code, body and remark — and leaves body/remark unset when the ControllerResult carries none;
  • run(Status<error>) maps any JRaft failure to ResponseCode.CONTROLLER_JRAFT_INTERNAL_ERROR with the status message;
  • taskWithThisClosure() returns the same cached Task instance on repeated calls, bound to this closure as done, carrying the encoded request as data.

Test-only change; no production code touched.

How Did You Test This Change?

mvn -pl controller -Dtest=ControllerClosureTest -Dsurefire.failIfNoSpecifiedTests=false test (JDK 11, PR base commit): Tests run: 4, Failures: 0, Errors: 0.

…se propagation

Add ControllerClosureTest: OK status completes the future with the
configured code/body/remark, missing body/remark stay unset, Raft
failures map to CONTROLLER_JRAFT_INTERNAL_ERROR with the status message,
and taskWithThisClosure caches one Task bound to the closure with the
encoded request as data.
@codecov-commenter

codecov-commenter commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.74%. Comparing base (9ea2ccd) to head (1b45a9d).
⚠️ Report is 9 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11346      +/-   ##
=============================================
- Coverage      49.75%   49.74%   -0.02%     
- Complexity     14354    14375      +21     
=============================================
  Files           1390     1390              
  Lines         103246   103262      +16     
  Branches       13502    13504       +2     
=============================================
- Hits           51375    51372       -3     
- Misses         45679    45689      +10     
- Partials        6192     6201       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review by github-manager-bot

Summary

Adds ControllerClosureTest covering direct coverage of JRaft-driven controller request completion paths.

Findings

  • [Info] ControllerClosureTest.java — Four tests: OK status with body/remark, OK status without body/remark, failed status mapping to CONTROLLER_JRAFT_INTERNAL_ERROR, and taskWithThisClosure caching. All paths are covered.
  • [Info] The Task serialization test correctly verifies that the task data matches the encoded request.

Suggestions

  • None. Good coverage of a previously untested component.

Automated review by github-manager-bot

@RockteMQ-AI

Copy link
Copy Markdown
Contributor

Issue Evaluation

Category: type/enhancement | Status: Confirmed

The gap in ControllerClosure test coverage is valid. JRaft-driven controller request completion semantics currently lack direct tests for:

  • run(Status.OK) response propagation with and without body/remark
  • run(Status<error>) mapping to ResponseCode.CONTROLLER_JRAFT_INTERNAL_ERROR
  • taskWithThisClosure() caching and binding behavior

Impact: Untested controller closure logic could mask regressions in controller request handling.
Severity: Medium (test gap in controller layer)

The proposed ControllerClosureTest with 4 test methods provides targeted coverage. Test-only change with no production code impact.


Automated evaluation by github-manager-bot

@chennaji9
chennaji9 force-pushed the cnj/test-controller-closure branch from 8ccd7ca to 1b45a9d Compare October 18, 2026 08:11
@chennaji9

Copy link
Copy Markdown
Contributor Author

Hi @RongtongJin, gentle follow-up on this one — it has been sitting for quite a while now. Everything (local tests + CI) is green, and the change is deliberately minimal (cover ControllerClosure response propagation). A review would be really appreciated whenever you have time, and merging would be great if it looks reasonable. Thank you!

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.

[Enhancement] ControllerClosure request-completion semantics lack direct tests

3 participants