Skip to content

Commit

Permalink
not dump empty config
Browse files Browse the repository at this point in the history
Signed-off-by: Lizan Zhou <zlizan@google.com>
  • Loading branch information
lizan committed Jul 31, 2018
1 parent 564373c commit b3ca933
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions source/common/router/rds_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,13 @@ RouteConfigProviderManagerImpl::dumpRouteConfigs() const {
ASSERT(subscription);
ASSERT(subscription->route_config_providers_.size() > 0);

auto* dynamic_config = config_dump->mutable_dynamic_route_configs()->Add();
if (subscription->config_info_) {
auto* dynamic_config = config_dump->mutable_dynamic_route_configs()->Add();
dynamic_config->set_version_info(subscription->config_info_.value().last_config_version_);
dynamic_config->mutable_route_config()->MergeFrom(subscription->route_config_proto_);
TimestampUtil::systemClockToTimestamp(subscription->last_updated_,
*dynamic_config->mutable_last_updated());
}
TimestampUtil::systemClockToTimestamp(subscription->last_updated_,
*dynamic_config->mutable_last_updated());
}

for (const auto& provider : static_route_config_providers_) {
Expand Down
5 changes: 3 additions & 2 deletions test/common/router/rds_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ name: foo_route_config
RouteConfigProviderPtr provider3 = route_config_provider_manager_->createRdsRouteConfigProvider(
rds2, factory_context_, "foo_prefix");
EXPECT_NE(provider3, provider_);
dynamic_cast<RdsRouteConfigProviderImpl&>(*provider3).subscription().onConfigUpdate(route_configs, "provider3");

EXPECT_EQ(2UL,
route_config_provider_manager_->dumpRouteConfigs()->dynamic_route_configs().size());
Expand All @@ -573,8 +574,8 @@ name: foo_route_config
route_config_provider_manager_->dumpRouteConfigs()->dynamic_route_configs();
EXPECT_EQ(1UL, dynamic_route_configs.size());

// Make sure the left one is provider3, which hasn't received route config yet.
EXPECT_FALSE(dynamic_route_configs[0].has_route_config());
// Make sure the left one is provider3
EXPECT_EQ("provider3", dynamic_route_configs[0].version_info());

provider3.reset();

Expand Down

0 comments on commit b3ca933

Please sign in to comment.