Wei-Chiu Chuang created HDDS-16097:
--------------------------------------

             Summary: Add unit tests for 
OzoneManagerRatisServer.checkRetryCache (HDDS-13621)
                 Key: HDDS-16097
                 URL: https://issues.apache.org/jira/browse/HDDS-16097
             Project: Apache Ozone
          Issue Type: Task
          Components: Ozone Manager
            Reporter: Wei-Chiu Chuang
            Assignee: Wei-Chiu Chuang


Follow-up test coverage for 
[HDDS-13621|https://issues.apache.org/jira/browse/HDDS-13621] (fixed in [PR 
#9711|https://github.com/apache/ozone/pull/9711]).

*Problem*

When Ratis RetryCache hits a *failed* {{RaftClientReply}} 
({{!reply.isSuccess()}}), the old {{checkRetryCache()}} path called 
{{getOMResponse(reply)}} and could NPE because failed replies often have no 
usable response message. The fix returns {{null}} so the normal submit path can 
retry.

The PR was validated manually (freon ommg under JVM pauses) but has no 
automated unit test.

*Scope*

Add two unit tests in {{TestOzoneManagerRatisServer}} (or a small dedicated 
test class), using mocked {{RetryCache}} / {{RetryCache.Entry}} and 
{{Server.getCurCall()}} setup (same pattern as {{testRetryCacheWithDownedOM}}):

# *Failed cached reply* — mock cache entry whose {{getReplyFuture()}} completes 
with {{setSuccess(false)}} / {{Message.EMPTY}} (e.g. {{NotLeaderException}}). 
Assert {{checkRetryCache()}} returns {{null}} and does not NPE.
# *Successful cached reply* — mock cache entry with {{setSuccess(true)}} and a 
serialized {{OMResponse}} in the reply message. Assert {{checkRetryCache()}} 
returns the expected {{OMResponse}} (regression guard).

*References*

* Parent fix: HDDS-13621 / PR #9711
* Related idempotent retry work: HDDS-11558
* Existing integration coverage (success path only): 
{{TestOzoneManagerHAWithAllRunning#testOMRetryCache}}, 
{{TestOzoneManagerHAWithStoppedNodes#testRetryCacheWithDownedOM}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to