@Test
  public void testOrigDcUnavailability() throws Exception {
    router.close();
    Properties properties = getNonBlockingRouterProperties();
    VerifiableProperties vProps = new VerifiableProperties(properties);
    RouterConfig routerConfig = new RouterConfig(vProps);
    router = new NonBlockingRouter(routerConfig, new NonBlockingRouterMetrics(clusterMap, routerConfig),
        new MockNetworkClientFactory(vProps, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL,
            CHECKOUT_TIMEOUT_MS, serverLayout, mockTime), new LoggingNotificationSystem(), clusterMap, null, null, null,
        new InMemAccountService(false, true), mockTime, MockClusterMap.DEFAULT_PARTITION_CLASS, null);
    deleteManager =
        new DeleteManager(clusterMap, new ResponseHandler(clusterMap), accountService, notificationSystem, routerConfig,
            routerMetrics, new RouterCallback(null, new ArrayList<>()), mockTime, router);

    String originatingDcName = clusterMap.getDatacenterName(clusterMap.getLocalDatacenterId());
    MockPartitionId partitionId = (MockPartitionId) blobId.getPartition();
    List<MockServer> serversInLocalDc = new ArrayList<>();
    serverLayout.getMockServers().forEach(mockServer -> {
      if (mockServer.getDataCenter().equals(originatingDcName)) {
        serversInLocalDc.add(mockServer);
      }
    });

    // Default all replicas to return not found.
    int serverCount = serverLayout.getMockServers().size();
    List<ServerErrorCode> serverErrorCodes = Collections.nCopies(serverCount, ServerErrorCode.BlobNotFound);
    setServerErrorCodes(serverErrorCodes, serverLayout);

    // Set 1 not-found from bootstrap, 1 notFound from standby and 1 success from standby in originating dc
    ReplicaId boostrapReplica = partitionId.replicaIds.stream()
        .filter(replicaId -> replicaId.getDataNodeId().getDatacenterName().equals(originatingDcName))
        .filter(replicaId -> replicaId.getDataNodeId().getHostname().equals(serversInLocalDc.get(0).getHostName()))
        .findFirst()
        .get();
    partitionId.setReplicaState(boostrapReplica, ReplicaState.BOOTSTRAP);
    serversInLocalDc.get(0).setServerErrorForAllRequests(ServerErrorCode.BlobNotFound);
    serversInLocalDc.get(1).setServerErrorForAllRequests(ServerErrorCode.BlobNotFound);
    serversInLocalDc.get(2).setServerErrorForAllRequests(ServerErrorCode.NoError);

    // Verify that final error is Ambry unavailable since one of the replica is in bootstrap state.
    deleteErrorCodeChecker.testAndAssert(RouterErrorCode.AmbryUnavailable);
  }
Test the case when some of the replicas in originating DC are unavailable, we should return AmbryUnavailable.
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/DeleteManagerTest.java