siddhantsangwan opened a new pull request, #4795:
URL: https://github.com/apache/ozone/pull/4795

   ## What changes were proposed in this pull request?
   
   Looks like we are writing the expected result into the actual result of 
`commandsSent` and comparing them:
   
   ```
         Set<Pair<DatanodeDetails, SCMCommand<?>>> expectedDelete =
             new HashSet<>();
         expectedDelete.add(Pair.of(overRepReplica.getDatanodeDetails(),
             createDeleteContainerCommand(container,
                 overRepReplica.getReplicaIndex())));
   
         Mockito.when(replicationManager.processOverReplicatedContainer(
             underRep)).thenAnswer(invocationOnMock -> {
               commandsSent.addAll(expectedDelete);
               return expectedDelete.size();
             });
         commandsSent.clear();
         assertThrows(SCMException.class,
             () -> ecURH.processAndSendCommands(availableReplicas,
                 Collections.emptyList(), underRep, 2));
         Mockito.verify(replicationManager, times(1))
             .processOverReplicatedContainer(underRep);
         Assertions.assertEquals(true, expectedDelete.equals(commandsSent));
   ```
   
   Ideally, `commandsSent` should be populated with the actual command that was 
sent. However, since this is a unit test, it's better to not run the code in 
`ECOverReplicationHandler` and simply verify that 
`replicationManager.processOverReplicatedContainer` was called once. So I've 
removed the assertion `Assertions.assertEquals(true, 
expectedDelete.equals(commandsSent))`.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-8675
   
   ## How was this patch tested?
   
   No new tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to