Skip to content

Commit

Permalink
test: improving dynamic_forward_proxy coverage (#14672)
Browse files Browse the repository at this point in the history
Risk Level: n/a (test only)

Signed-off-by: Alyssa Wilk <[email protected]>
  • Loading branch information
alyssawilk authored Jan 13, 2021
1 parent efe73e8 commit c5718c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,22 @@ 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,
ResponseStrings::get().DnsCacheOverflow, nullptr,
absl::nullopt, ResponseStrings::get().DnsCacheOverflow);
return Http::FilterHeadersStatus::StopIteration;
}
}

NOT_REACHED_GCOVR_EXCL_LINE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
} // namespace Envoy
1 change: 0 additions & 1 deletion test/per_file_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c5718c3

Please sign in to comment.