Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/common/upstream/cluster_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ void ClusterManagerImpl::postThreadLocalClusterUpdate(const Cluster& cluster, ui
// TODO(htuch): Can we skip these copies by exporting out const shared_ptr from HostSet?
HostVectorConstSharedPtr hosts_copy(new HostVector(host_set->hosts()));
HostVectorConstSharedPtr healthy_hosts_copy(new HostVector(host_set->healthyHosts()));
HostVectorConstSharedPtr degraded_hosts_copy(new HostVector(host_set->healthyHosts()));
HostVectorConstSharedPtr degraded_hosts_copy(new HostVector(host_set->degradedHosts()));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a good place to add a test for this - any ideas?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should be able to add a test in cluster_manager_impl_test that does a sequence of updates and then verifies that the thread local host sets have the hosts they should?

HostsPerLocalityConstSharedPtr hosts_per_locality_copy = host_set->hostsPerLocality().clone();
HostsPerLocalityConstSharedPtr healthy_hosts_per_locality_copy =
host_set->healthyHostsPerLocality().clone();
Expand Down
3 changes: 2 additions & 1 deletion source/common/upstream/health_checker_base_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,9 @@ void HealthCheckerImplBase::ActiveHealthCheckSession::handleSuccess(bool degrade

// This check ensures that we honor the decision made about Changed vs ChangePending in the
// above block.
// TODO(snowp): should there be degraded_threshhold?
if (changed_state == HealthTransition::Unchanged) {
changed_state = HealthTransition::ChangePending;
changed_state = HealthTransition::Changed;
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/common/upstream/health_checker_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ TEST_F(HttpHealthCheckerImplTest, Success) {

TEST_F(HttpHealthCheckerImplTest, Degraded) {
setupNoServiceValidationHC();
EXPECT_CALL(*this, onHostStatus(_, HealthTransition::ChangePending)).Times(2);
EXPECT_CALL(*this, onHostStatus(_, HealthTransition::Changed)).Times(2);

cluster_->prioritySet().getMockHostSet(0)->hosts_ = {
makeTestHost(cluster_->info_, "tcp://127.0.0.1:80")};
Expand Down