@Test
  public void successWithSufficientEligibleHostsTest() {
    assumeTrue(replicasStateEnabled);
    List<Port> portList = Collections.singletonList(new Port(PORT, PortType.PLAINTEXT));
    List<String> mountPaths = Collections.singletonList("mockMountPath");
    datanodes = new ArrayList<>(Arrays.asList(new MockDataNodeId(portList, mountPaths, "dc-0"),
        new MockDataNodeId(portList, mountPaths, "dc-1"), new MockDataNodeId(portList, mountPaths, "dc-2"),
        new MockDataNodeId(portList, mountPaths, "dc-3")));
    mockPartition = new MockPartitionId();
    populateReplicaList(8, ReplicaState.STANDBY);
    populateReplicaList(4, ReplicaState.INACTIVE);
    localDcName = datanodes.get(0).getDatacenterName();
    mockClusterMap = new MockClusterMap(false, datanodes, 1, Collections.singletonList(mockPartition), localDcName);

    UndeleteOperationTracker tracker = getOperationTracker(2);
    // Now we need to set all the response to be success
    for (int i = 0; i < 4; i++) {
      sendRequests(tracker, 2);
      assertFalse("Operation should not have failed", tracker.hasFailed());
      assertFalse("Operation should not have succeeded", tracker.hasSucceeded());
      assertFalse("Operation should not be done", tracker.isDone());
      for (int j = 0; j < 2; j++) {
        tracker.onResponse(inflightReplicas.poll(), TrackedRequestFinalState.SUCCESS);
      }
    }
    assertFalse("Operation should not have failed", tracker.hasFailed());
    assertTrue("Operation should have succeeded", tracker.hasSucceeded());
    assertTrue("Operation should be done", tracker.isDone());
  }
Tests when not all hosts are eligible not enough hosts are.
ambry-router/src/test/java/com/github/ambry/router/UndeleteOperationTrackerTest.java