@Test
  public void successWithSomeRequestFailureTest() {
    initialize();
    originatingDcName = datanodes.get(datanodes.size() - 1).getDatacenterName();
    UndeleteOperationTracker tracker = getOperationTracker(3);
    assertFalse("Operation should not have been done", tracker.isDone());

    // First 3 requests should target at local datacenter, fail one of them
    sendRequests(tracker, 3);
    tracker.onResponse(inflightReplicas.poll(), TrackedRequestFinalState.FAILURE);
    tracker.onResponse(inflightReplicas.poll(), TrackedRequestFinalState.SUCCESS);
    tracker.onResponse(inflightReplicas.poll(), TrackedRequestFinalState.SUCCESS);
    assertFalse("Operation should not have been done", tracker.isDone());
    assertFalse("Operation should not have succeeded", tracker.hasSucceeded());

    // Following 3 requests should target at originating datacenter, fail one of them
    sendRequests(tracker, 3);
    tracker.onResponse(inflightReplicas.poll(), TrackedRequestFinalState.FAILURE);
    tracker.onResponse(inflightReplicas.poll(), TrackedRequestFinalState.SUCCESS);
    tracker.onResponse(inflightReplicas.poll(), TrackedRequestFinalState.SUCCESS);
    assertFalse("Operation should not have been done", tracker.isDone());
    assertFalse("Operation should not have succeeded", tracker.hasSucceeded());

    for (int counter = 0; counter < 2; counter++) {
      sendRequests(tracker, 3);
      for (int i = 0; i < 3; i++) {
        tracker.onResponse(inflightReplicas.poll(), TrackedRequestFinalState.SUCCESS);
      }
    }
    assertTrue("Operation should have be done", tracker.isDone());
    assertFalse("Operation should not failed", tracker.hasFailed());
    assertTrue("Operation should have succeeded", tracker.hasSucceeded());
  }
Test when two responses from different datacenter are failure, but the rest are success.
ambry-router/src/test/java/com/github/ambry/router/UndeleteOperationTrackerTest.java