TEST_F(GrpcHealthCheckerImplTest, SuccessResponseSplitBetweenChunks) {
  setupServiceNameHC(absl::nullopt);
  expectSingleHealthcheck(HealthTransition::Unchanged);

  auto response_headers = std::make_unique<Http::TestResponseHeaderMapImpl>(
      std::initializer_list<std::pair<std::string, std::string>>{
          {":status", "200"},
          {"content-type", "application/grpc"},
      });
  test_sessions_[0]->stream_response_callbacks_->decodeHeaders(std::move(response_headers), false);

  grpc::health::v1::HealthCheckResponse response;
  response.set_status(grpc::health::v1::HealthCheckResponse::SERVING);
  auto data = Grpc::Common::serializeToGrpcFrame(response);

  const char* raw_data = static_cast<char*>(data->linearize(data->length()));
  const uint64_t chunk_size = data->length() / 5;
  for (uint64_t offset = 0; offset < data->length(); offset += chunk_size) {
    const uint64_t effective_size = std::min(chunk_size, data->length() - offset);
    const auto chunk = std::make_unique<Buffer::OwnedImpl>(raw_data + offset, effective_size);
    test_sessions_[0]->stream_response_callbacks_->decodeData(*chunk, false);
  }

  auto trailers = std::make_unique<Http::TestResponseTrailerMapImpl>(
      std::initializer_list<std::pair<std::string, std::string>>{{"grpc-status", "0"}});
  test_sessions_[0]->stream_response_callbacks_->decodeTrailers(std::move(trailers));

  expectHostHealthy(true);
}
TEST_F(GrpcHealthCheckerImplTest, SuccessResponseSplitBetweenChunks) {
  setupServiceNameHC(absl::nullopt);
  expectSingleHealthcheck(HealthTransition::Unchanged);

  auto response_headers = std::make_unique<Http::TestResponseHeaderMapImpl>(
      std::initializer_list<std::pair<std::string, std::string>>{
          {":status", "200"},
          {"content-type", "application/grpc"},
      });
  test_sessions_[0]->stream_response_callbacks_->decodeHeaders(std::move(response_headers), false);

  grpc::health::v1::HealthCheckResponse response;
  response.set_status(grpc::health::v1::HealthCheckResponse::SERVING);
  auto data = Grpc::Common::serializeToGrpcFrame(response);

  const char* raw_data = static_cast<char*>(data->linearize(data->length()));
  const uint64_t chunk_size = data->length() / 5;
  for (uint64_t offset = 0; offset < data->length(); offset += chunk_size) {
    const uint64_t effective_size = std::min(chunk_size, data->length() - offset);
    const auto chunk = std::make_unique<Buffer::OwnedImpl>(raw_data + offset, effective_size);
    test_sessions_[0]->stream_response_callbacks_->decodeData(*chunk, false);
  }

  auto trailers = std::make_unique<Http::TestResponseTrailerMapImpl>(
      std::initializer_list<std::pair<std::string, std::string>>{{"grpc-status", "0"}});
  test_sessions_[0]->stream_response_callbacks_->decodeTrailers(std::move(trailers));

  expectHostHealthy(true);
}