  void expectSuccessStartFailedFailFirst(
      const absl::optional<std::string>& health_checked_cluster = absl::optional<std::string>()) {
    cluster_->prioritySet().getMockHostSet(0)->hosts_ = {
        makeTestHost(cluster_->info_, "tcp://127.0.0.1:80", simTime())};
    cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->healthFlagSet(
        Host::HealthFlag::FAILED_ACTIVE_HC);
    expectSessionCreate();
    expectStreamCreate(0);
    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, enableTimer(_, _));
    health_checker_->start();

    // Test that failing first disables fast success.
    EXPECT_CALL(*this, onHostStatus(_, HealthTransition::Unchanged));
    EXPECT_CALL(*test_sessions_[0]->interval_timer_, enableTimer(_, _));
    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, disableTimer());
    EXPECT_CALL(event_logger_, logUnhealthy(_, _, _, true));
    respond(0, "503", false, false, false, false, health_checked_cluster);
    EXPECT_TRUE(cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->healthFlagGet(
        Host::HealthFlag::FAILED_ACTIVE_HC));
    EXPECT_EQ(Host::Health::Unhealthy,
              cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->health());

    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, enableTimer(_, _));
    expectStreamCreate(0);
    test_sessions_[0]->interval_timer_->invokeCallback();

    EXPECT_CALL(*this, onHostStatus(_, HealthTransition::ChangePending));
    EXPECT_CALL(*test_sessions_[0]->interval_timer_, enableTimer(_, _));
    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, disableTimer());
    respond(0, "200", false, false, false, false, health_checked_cluster);
    EXPECT_TRUE(cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->healthFlagGet(
        Host::HealthFlag::FAILED_ACTIVE_HC));
    EXPECT_EQ(Host::Health::Unhealthy,
              cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->health());

    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, enableTimer(_, _));
    expectStreamCreate(0);
    test_sessions_[0]->interval_timer_->invokeCallback();

    EXPECT_CALL(*this, onHostStatus(_, HealthTransition::Changed));
    EXPECT_CALL(event_logger_, logAddHealthy(_, _, false));
    EXPECT_CALL(*test_sessions_[0]->interval_timer_, enableTimer(_, _));
    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, disableTimer());
    respond(0, "200", false, false, false, false, health_checked_cluster);
    EXPECT_EQ(Host::Health::Healthy,
              cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->health());
  }
  void expectSuccessStartFailedFailFirst(
      const absl::optional<std::string>& health_checked_cluster = absl::optional<std::string>()) {
    cluster_->prioritySet().getMockHostSet(0)->hosts_ = {
        makeTestHost(cluster_->info_, "tcp://127.0.0.1:80", simTime())};
    cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->healthFlagSet(
        Host::HealthFlag::FAILED_ACTIVE_HC);
    expectSessionCreate();
    expectStreamCreate(0);
    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, enableTimer(_, _));
    health_checker_->start();

     
    EXPECT_CALL(*this, onHostStatus(_, HealthTransition::Unchanged));
    EXPECT_CALL(*test_sessions_[0]->interval_timer_, enableTimer(_, _));
    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, disableTimer());
    EXPECT_CALL(event_logger_, logUnhealthy(_, _, _, true));
    respond(0, "503", false, false, false, false, health_checked_cluster);
    EXPECT_TRUE(cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->healthFlagGet(
        Host::HealthFlag::FAILED_ACTIVE_HC));
    EXPECT_EQ(Host::Health::Unhealthy,
              cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->health());

    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, enableTimer(_, _));
    expectStreamCreate(0);
    test_sessions_[0]->interval_timer_->invokeCallback();

    EXPECT_CALL(*this, onHostStatus(_, HealthTransition::ChangePending));
    EXPECT_CALL(*test_sessions_[0]->interval_timer_, enableTimer(_, _));
    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, disableTimer());
    respond(0, "200", false, false, false, false, health_checked_cluster);
    EXPECT_TRUE(cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->healthFlagGet(
        Host::HealthFlag::FAILED_ACTIVE_HC));
    EXPECT_EQ(Host::Health::Unhealthy,
              cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->health());

    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, enableTimer(_, _));
    expectStreamCreate(0);
    test_sessions_[0]->interval_timer_->invokeCallback();

    EXPECT_CALL(*this, onHostStatus(_, HealthTransition::Changed));
    EXPECT_CALL(event_logger_, logAddHealthy(_, _, false));
    EXPECT_CALL(*test_sessions_[0]->interval_timer_, enableTimer(_, _));
    EXPECT_CALL(*test_sessions_[0]->timeout_timer_, disableTimer());
    respond(0, "200", false, false, false, false, health_checked_cluster);
    EXPECT_EQ(Host::Health::Healthy,
              cluster_->prioritySet().getMockHostSet(0)->hosts_[0]->health());
  }