@Test
  public void testFailureOnServerErrors() throws Exception {
    doPut();
    // set the status to various server level errors (remove all partition level errors or non errors)
    EnumSet<ServerErrorCode> serverErrors = EnumSet.complementOf(
        EnumSet.of(ServerErrorCode.BlobDeleted, ServerErrorCode.BlobExpired, ServerErrorCode.NoError,
            ServerErrorCode.BlobAuthorizationFailure, ServerErrorCode.BlobNotFound));
    for (ServerErrorCode serverErrorCode : serverErrors) {
      mockServerLayout.getMockServers().forEach(server -> server.setServerErrorForAllRequests(serverErrorCode));
      GetBlobOperation op = createOperationAndComplete(null);
      RouterErrorCode expectedRouterError;
      switch (serverErrorCode) {
        case ReplicaUnavailable:
        case DiskUnavailable:
          // Even if all the disks are unavailable (which should be extremely rare), we will return AmbryUnavailable.
          // Once the disks are back up, we will return BlobNotFound.
          expectedRouterError = RouterErrorCode.AmbryUnavailable;
          break;
        default:
          expectedRouterError = RouterErrorCode.UnexpectedInternalError;
      }
      assertFailureAndCheckErrorCode(op, expectedRouterError);
    }
  }
Tests the case where all servers return the same server level error code
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/GetBlobOperationTest.java