Skip to content

Commit

Permalink
HDDS-8675. Fix expectation in testUnderRepSentToOverRepHandlerIfNoNew…
Browse files Browse the repository at this point in the history
…Nodes (#4795)
  • Loading branch information
siddhantsangwan committed May 31, 2023
1 parent d00332d commit 7285519
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,29 +466,16 @@ public void testUnderRepSentToOverRepHandlerIfNoNewNodes()
() -> ecURH.processAndSendCommands(availableReplicas,
Collections.emptyList(), underRep, 2));

// Now adjust replicas so it is also over replicated. This time rather
// than throwing it should call the OverRepHandler and return whatever it
// Now adjust replicas so it is also over replicated. This time before
// throwing it should call the OverRepHandler and return whatever it
// returns, which in this case is a delete command for replica index 4.
availableReplicas.add(overRepReplica);

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));
}
}

Expand Down

0 comments on commit 7285519

Please sign in to comment.