Chi-Hsuan Huang created HDDS-16942:
--------------------------------------
Summary: Fix negative Mockito checks in
TestCreatePipelineCommandHandler and TestECUnderReplicationHandler that cannot
fail
Key: HDDS-16942
URL: https://issues.apache.org/jira/browse/HDDS-16942
Project: Apache Ozone
Issue Type: Bug
Components: SCM, Ozone Datanode
Reporter: Chi-Hsuan Huang
Follow-up to HDDS-16885, which fixes the same pattern in {{TestMoveManager}}.
Two more negative Mockito checks cannot fail today, so they would miss the
regression they were added for.
*{{TestCreatePipelineCommandHandler#testCommandIdempotency}}*
* It verifies {{times(0)}} on the 2 argument {{XceiverServerSpi.addGroup}}.
Since HDDS-2922, {{CreatePipelineCommandHandler}} only calls the 3 argument
overload with {{priorityList}}.
* The test also builds the handler with the {{conf}} constructor, so the real
Raft client is used. The {{raftClientGroupManager}} {{times(0)}} check is never
reached either.
*{{TestECUnderReplicationHandler#testMaintenanceDoesNotRequestZeroNodes}}*
* It verifies {{times(0)}} on the 5 argument {{chooseDatanodes(..., eq(0),
...)}}. Since HDDS-8504, the EC handler always passes {{usedNodes}}, so only
the 6 argument overload is called.
* Moving to the 6 argument overload is not enough. {{getTargetDatanodes}} never
asks for 0 nodes, so {{eq(0)}} can never match.
Checked with local mutations on master:
* Making {{CreatePipelineCommandHandler}} skip the {{isExist}} check: the
current test passes. With the 3 argument verify, it fails.
* Removing the {{additionalMaintenanceCopiesNeeded == 0}} guard from HDDS-7683:
the current test passes, and so does a 6 argument {{eq(0)}} verify. Verifying
{{chooseDatanodes}} is called exactly once fails as expected.
Proposed changes (test only):
* {{testCommandIdempotency}}: verify the 3 argument {{addGroup}}, and inject
the mocked Raft client like {{testPipelineCreation}} does.
* {{testMaintenanceDoesNotRequestZeroNodes}}: verify the 6 argument
{{chooseDatanodes}} is called {{times(1)}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]