Skip to content

Commit

Permalink
one more test, fixing EXPECT_DEATH macro for asan/tsan
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
  • Loading branch information
alyssawilk committed Aug 28, 2018
1 parent f39ec4c commit 8745ebd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion source/common/http/header_map_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ void HeaderString::append(const char* data, uint32_t size) {
type_ = Type::Dynamic;
const uint64_t new_capacity = newCapacity(string_length_, size);
if (new_capacity > MinDynamicCapacity) {
// TODO(alyssawilk) unit test.
validateCapacity(new_capacity);
dynamic_capacity_ = new_capacity;
} else {
Expand Down
6 changes: 6 additions & 0 deletions test/common/http/header_map_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,12 @@ TEST(HeaderMapImplTest, TestHeaderLengthChecks) {
value.setCopy("some;", 5);
EXPECT_DEATH(value.append(nullptr, std::numeric_limits<uint32_t>::max()),
"Trying to allocate overly large headers.");

std::string source("hello");
HeaderString reference;
reference.setReference(source);
EXPECT_DEATH(reference.append(nullptr, std::numeric_limits<uint32_t>::max()),
"Trying to allocate overly large headers.");
}

TEST(HeaderMapImplTest, PseudoHeaderOrder) {
Expand Down
4 changes: 2 additions & 2 deletions test/common/router/header_formatter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ TEST_F(RequestInfoHeaderFormatterTest, UserDefinedHeadersConsideredHarmful) {

Http::TestHeaderMapImpl header_map{{":method", "POST"}};
NiceMock<Envoy::RequestInfo::MockRequestInfo> request_info;
EXPECT_DEATH(req_header_parser->evaluateHeaders(header_map, request_info),
"Trying to allocate overly large headers.");
EXPECT_DEATH_LOG_TO_STDERR(req_header_parser->evaluateHeaders(header_map, request_info),
"Trying to allocate overly large headers.");
}

TEST_F(RequestInfoHeaderFormatterTest, TestFormatWithUpstreamMetadataVariableMissingHost) {
Expand Down

0 comments on commit 8745ebd

Please sign in to comment.