You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "siddhantsangwan (via GitHub)" <gi...@apache.org> on 2023/05/30 08:00:49 UTC

[GitHub] [ozone] siddhantsangwan opened a new pull request, #4795: HDDS-8675. Fix expectation in testUnderRepSentToOverRepHandlerIfNoNewNodes

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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] adoroszlai merged pull request #4795: HDDS-8675. Fix expectation in testUnderRepSentToOverRepHandlerIfNoNewNodes

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #4795:
URL: https://github.com/apache/ozone/pull/4795


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] adoroszlai commented on pull request #4795: HDDS-8675. Fix expectation in testUnderRepSentToOverRepHandlerIfNoNewNodes

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #4795:
URL: https://github.com/apache/ozone/pull/4795#issuecomment-1569695700

   Thanks @siddhantsangwan for the patch, @sodonnel for the review.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org