@Test
  public void testRetryOnSimpleOperationTrackerConstructorFail() throws Exception {
    int numChunks = routerConfig.routerMaxInMemPutChunks + 1;
    BlobProperties blobProperties =
        new BlobProperties(-1, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time,
            Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort(TestUtils.RANDOM), false, null, null, null);
    byte[] userMetadata = new byte[10];
    byte[] content = new byte[chunkSize * numChunks];
    random.nextBytes(content);
    ReadableStreamChannel channel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(content));
    FutureResult<String> future = new FutureResult<>();
    MockNetworkClient mockNetworkClient = new MockNetworkClient();
    MockClusterMap mockClusterMap = spy(new MockClusterMap());
    MockPartitionId mockPartitionIdFail = new MockPartitionId();

    doAnswer(invocation -> mockPartitionIdFail)
        .when(mockClusterMap).getRandomWritablePartition(any(), any());

    PutOperation op =
        PutOperation.forUpload(routerConfig, routerMetrics, mockClusterMap, new LoggingNotificationSystem(),
            new InMemAccountService(true, false), userMetadata, channel, PutBlobOptions.DEFAULT, future, null,
            new RouterCallback(mockNetworkClient, new ArrayList<>()), null, null, null, null, time, blobProperties,
            MockClusterMap.DEFAULT_PARTITION_CLASS, quotaChargeCallback, compressionService);
    op.startOperation();
    List<RequestInfo> requestInfos = new ArrayList<>();
    requestRegistrationCallback.setRequestsToSend(requestInfos);

    op.fillChunks();
    op.poll(requestRegistrationCallback);
    // if fail, then requests to send will be 0
    Assert.assertTrue(requestRegistrationCallback.getRequestsToSend().size() == 0);
  }
Tests that if we cannot find a partition with a valid number of replicas, we will retry rather
and eventually throw an exception if not found
This case ensures that both partitions fail.
ambry-router/src/test/java/com/github/ambry/router/PutOperationTest.java