diff --git a/source/common/router/rds_impl.cc b/source/common/router/rds_impl.cc index ebe3de14808b..6a3e8c545cae 100644 --- a/source/common/router/rds_impl.cc +++ b/source/common/router/rds_impl.cc @@ -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_) { diff --git a/test/common/router/rds_impl_test.cc b/test/common/router/rds_impl_test.cc index 9a5ad5d0d2bb..f32674889fb5 100644 --- a/test/common/router/rds_impl_test.cc +++ b/test/common/router/rds_impl_test.cc @@ -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(*provider3).subscription().onConfigUpdate(route_configs, "provider3"); EXPECT_EQ(2UL, route_config_provider_manager_->dumpRouteConfigs()->dynamic_route_configs().size()); @@ -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();