From 269d783bb8319a76158ff193dc46fa7e68265201 Mon Sep 17 00:00:00 2001 From: Alyssa Wilk Date: Thu, 7 Jan 2021 14:39:44 -0500 Subject: [PATCH 1/3] test: dynamic_forward_proxy coverage Signed-off-by: Alyssa Wilk --- .../dynamic_forward_proxy/dns_cache_resource_manager_test.cc | 5 ++++- test/per_file_coverage.sh | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/extensions/common/dynamic_forward_proxy/dns_cache_resource_manager_test.cc b/test/extensions/common/dynamic_forward_proxy/dns_cache_resource_manager_test.cc index 04127f486fff..5ed57a7b4606 100644 --- a/test/extensions/common/dynamic_forward_proxy/dns_cache_resource_manager_test.cc +++ b/test/extensions/common/dynamic_forward_proxy/dns_cache_resource_manager_test.cc @@ -68,10 +68,13 @@ TEST_F(DnsCacheResourceManagerTest, CheckDnsResource) { EXPECT_EQ(2, pending_requests.count()); EXPECT_TRUE(pending_requests.canCreate()); + EXPECT_EQ(0, resource_manager_->stats().rq_pending_open_.value()); + EXPECT_EQ(0, resource_manager_->stats().rq_pending_remaining_.value()); + cleanup(); } } // namespace } // namespace DynamicForwardProxy } // namespace Common } // namespace Extensions -} // namespace Envoy \ No newline at end of file +} // namespace Envoy diff --git a/test/per_file_coverage.sh b/test/per_file_coverage.sh index 174c0cd14991..32f71e40fadf 100755 --- a/test/per_file_coverage.sh +++ b/test/per_file_coverage.sh @@ -35,7 +35,6 @@ declare -a KNOWN_LOW_COVERAGE=( "source/extensions/filters/common/rbac:87.5" "source/extensions/filters/http/cache:92.4" "source/extensions/filters/http/cache/simple_http_cache:95.2" -"source/extensions/filters/http/dynamic_forward_proxy:95.0" "source/extensions/filters/http/grpc_json_transcoder:94.8" "source/extensions/filters/http/ip_tagging:91.2" "source/extensions/filters/http/kill_request:95.0" # Death tests don't report LCOV From 1280e1fbf995b8bc519cd33aa19a14ad9f35e3cc Mon Sep 17 00:00:00 2001 From: Alyssa Wilk Date: Tue, 12 Jan 2021 14:51:48 -0500 Subject: [PATCH 2/3] more coverage Signed-off-by: Alyssa Wilk --- .../http/dynamic_forward_proxy/proxy_filter.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/source/extensions/filters/http/dynamic_forward_proxy/proxy_filter.cc b/source/extensions/filters/http/dynamic_forward_proxy/proxy_filter.cc index 84f57a535903..2b8d246129fe 100644 --- a/source/extensions/filters/http/dynamic_forward_proxy/proxy_filter.cc +++ b/source/extensions/filters/http/dynamic_forward_proxy/proxy_filter.cc @@ -132,17 +132,15 @@ Http::FilterHeadersStatus ProxyFilter::decodeHeaders(Http::RequestHeaderMap& hea } switch (result.status_) { - case LoadDnsCacheEntryStatus::InCache: { + case LoadDnsCacheEntryStatus::InCache: ASSERT(cache_load_handle_ == nullptr); ENVOY_STREAM_LOG(debug, "DNS cache entry already loaded, continuing", *decoder_callbacks_); return Http::FilterHeadersStatus::Continue; - } - case LoadDnsCacheEntryStatus::Loading: { + case LoadDnsCacheEntryStatus::Loading: ASSERT(cache_load_handle_ != nullptr); ENVOY_STREAM_LOG(debug, "waiting to load DNS cache entry", *decoder_callbacks_); return Http::FilterHeadersStatus::StopAllIterationAndWatermark; - } - case LoadDnsCacheEntryStatus::Overflow: { + case LoadDnsCacheEntryStatus::Overflow: ASSERT(cache_load_handle_ == nullptr); ENVOY_STREAM_LOG(debug, "DNS cache overflow", *decoder_callbacks_); decoder_callbacks_->sendLocalReply(Http::Code::ServiceUnavailable, @@ -150,9 +148,6 @@ Http::FilterHeadersStatus ProxyFilter::decodeHeaders(Http::RequestHeaderMap& hea absl::nullopt, ResponseStrings::get().DnsCacheOverflow); return Http::FilterHeadersStatus::StopIteration; } - } - - NOT_REACHED_GCOVR_EXCL_LINE; } void ProxyFilter::onLoadDnsCacheComplete() { From 11cc9b104b8291a48814779efb00d9e464411e43 Mon Sep 17 00:00:00 2001 From: Alyssa Wilk Date: Tue, 12 Jan 2021 16:30:47 -0500 Subject: [PATCH 3/3] backoff Signed-off-by: Alyssa Wilk --- .../filters/http/dynamic_forward_proxy/proxy_filter.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/source/extensions/filters/http/dynamic_forward_proxy/proxy_filter.cc b/source/extensions/filters/http/dynamic_forward_proxy/proxy_filter.cc index 2b8d246129fe..3aaa47ac2c34 100644 --- a/source/extensions/filters/http/dynamic_forward_proxy/proxy_filter.cc +++ b/source/extensions/filters/http/dynamic_forward_proxy/proxy_filter.cc @@ -148,6 +148,7 @@ Http::FilterHeadersStatus ProxyFilter::decodeHeaders(Http::RequestHeaderMap& hea absl::nullopt, ResponseStrings::get().DnsCacheOverflow); return Http::FilterHeadersStatus::StopIteration; } + NOT_REACHED_GCOVR_EXCL_LINE; } void ProxyFilter::onLoadDnsCacheComplete() {