Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-7759 Improve Ozone Replication Manager
  3. HDDS-8675

Fix expectation in testUnderRepSentToOverRepHandlerIfNoNewNodes

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.4.0
    • SCM

    Description

      Looks like we're writing the expected result into the actual result 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));
      

      commandsSent should be populated with the actual command that was sent.

      Attachments

        Issue Links

          Activity

            People

              siddhant Siddhant Sangwan
              siddhant Siddhant Sangwan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: