Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ build:clang-asan --linkopt -fuse-ld=lld

# macOS ASAN/UBSAN
build:macos --cxxopt=-std=c++17
build:macos --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a
build:macos --action_env=BAZEL_LINKOPTS=-lm

build:macos-asan --config=asan
# Workaround, see https://github.com/bazelbuild/bazel/issues/6932
Expand Down Expand Up @@ -260,7 +258,7 @@ build:remote-clang-cl --config=rbe-toolchain-clang-cl

# Docker sandbox
# NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/main/toolchains/rbe_toolchains_config.bzl#L8
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:e33c93e6d79804bf95ff80426d10bdcc9096c785
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:3d0491e2034287959a292806e3891fd0b7dd2703
build:docker-sandbox --spawn_strategy=docker
build:docker-sandbox --strategy=Javac=docker
build:docker-sandbox --strategy=Closure=docker
Expand Down
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
references:
envoy-build-image: &envoy-build-image # March 8th, 2021
envoyproxy/envoy-build-ubuntu:e33c93e6d79804bf95ff80426d10bdcc9096c785
envoyproxy/envoy-build-ubuntu:3d0491e2034287959a292806e3891fd0b7dd2703
version: 2
jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

ENVOY_COMMIT = "27f67d18277648affef80e659ccc68cdfaaa418c" # April 12, 2021
ENVOY_SHA = "82be18e5647fba9df97bf46a4ec2ccc7753e57addcde1e068b6f98a61d9f113f"
ENVOY_COMMIT = "751be72c2eb967ff03759b6e50dde106c8cf5c84" # April 19, 2021
ENVOY_SHA = "43a538a299f0169cd6b15d3a8d757b51870487bb7e50766108f0917e5974f412"

HDR_HISTOGRAM_C_VERSION = "0.11.2" # October 12th, 2020
HDR_HISTOGRAM_C_SHA = "637f28b5f64de2e268131e4e34e6eef0b91cf5ff99167db447d9b2825eae6bad"
Expand Down
16 changes: 8 additions & 8 deletions test/server/http_dynamic_delay_filter_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ name: dynamic-delay
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
)");
// Don't send any config request header ...
getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
// ... we shouldn't observe any delay being requested via the upstream request headers.
EXPECT_TRUE(upstream_request_->headers().get(kDelayHeaderString).empty());

// Send a config request header with an empty / default configuration ....
setRequestLevelConfiguration("{}");
getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
// ... we shouldn't observe any delay being requested via the upstream request headers.
EXPECT_TRUE(upstream_request_->headers().get(kDelayHeaderString).empty());

// Send a config request header requesting a 1.6s delay...
setRequestLevelConfiguration("{static_delay: \"1.6s\"}");
getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
// ...we should observe a delay of 1.6s in the upstream request.
ASSERT_EQ(upstream_request_->headers().get(kDelayHeaderString).size(), 1);
EXPECT_EQ(upstream_request_->headers().get(kDelayHeaderString)[0]->value().getStringView(),
Expand All @@ -95,23 +95,23 @@ name: dynamic-delay

// Without any request-level configuration, we expect the statically configured static delay to
// apply.
getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
ASSERT_EQ(upstream_request_->headers().get(kDelayHeaderString).size(), 1);
EXPECT_EQ(upstream_request_->headers().get(kDelayHeaderString)[0]->value().getStringView(),
"1330");

// With an empty request-level configuration, we expect the statically configured static delay to
// apply.
setRequestLevelConfiguration("{}");
getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
ASSERT_EQ(upstream_request_->headers().get(kDelayHeaderString).size(), 1);
EXPECT_EQ(upstream_request_->headers().get(kDelayHeaderString)[0]->value().getStringView(),
"1330");

// Overriding the statically configured static delay via request-level configuration should be
// reflected in the output.
setRequestLevelConfiguration("{static_delay: \"0.2s\"}");
getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
// TODO(#392): This fails, because the duration is a two-field message: it would make here to see
// both the number of seconds and nanoseconds to be overridden.
// However, the seconds part is set to '0', which equates to the default of the underlying int
Expand All @@ -123,7 +123,7 @@ name: dynamic-delay
// Overriding the statically configured static delay via request-level configuration should be
// reflected in the output.
setRequestLevelConfiguration("{static_delay: \"2.2s\"}");
getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
// 2.2 seconds -> 2200 ms.
ASSERT_EQ(upstream_request_->headers().get(kDelayHeaderString).size(), 1);
EXPECT_EQ(upstream_request_->headers().get(kDelayHeaderString)[0]->value().getStringView(),
Expand All @@ -140,7 +140,7 @@ name: dynamic-delay
minimal_delay: 0.05s
concurrency_delay_factor: 0.01s
)EOF");
getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
// Based on the algorithm of concurrency_based_linear_delay, for the first request we expect to
// observe the configured minimal_delay + concurrency_delay_factor = 0.06s -> 60ms.
ASSERT_EQ(upstream_request_->headers().get(kDelayHeaderString).size(), 1);
Expand Down
8 changes: 7 additions & 1 deletion test/server/http_filter_base_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ name: dynamic-delay

TEST_P(HttpFilterBaseIntegrationTest, NoRequestLevelConfigurationShouldSucceed) {
Envoy::IntegrationStreamDecoderPtr response = getResponse(getHappyFlowResponseOrigin());
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
EXPECT_TRUE(response->body().empty());
Expand All @@ -69,6 +70,7 @@ TEST_P(HttpFilterBaseIntegrationTest, NoRequestLevelConfigurationShouldSucceed)
TEST_P(HttpFilterBaseIntegrationTest, EmptyJsonRequestLevelConfigurationShouldSucceed) {
setRequestLevelConfiguration("{}");
Envoy::IntegrationStreamDecoderPtr response = getResponse(getHappyFlowResponseOrigin());
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
EXPECT_TRUE(response->body().empty());
Expand All @@ -78,6 +80,7 @@ TEST_P(HttpFilterBaseIntegrationTest, BadJsonAsRequestLevelConfigurationShouldFa
// When sending bad request-level configuration, the extension ought to reply directly.
setRequestLevelConfiguration("bad_json");
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
EXPECT_EQ(Envoy::Http::Utility::getResponseStatus(response->headers()), 500);
EXPECT_THAT(response->body(), HasSubstr(kBadConfigErrorSentinel));
}
Expand All @@ -86,6 +89,7 @@ TEST_P(HttpFilterBaseIntegrationTest, EmptyRequestLevelConfigurationShouldFail)
// When sending empty request-level configuration, the extension ought to reply directly.
setRequestLevelConfiguration("");
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
EXPECT_EQ(Envoy::Http::Utility::getResponseStatus(response->headers()), 500);
EXPECT_THAT(response->body(), HasSubstr(kBadConfigErrorSentinel));
}
Expand All @@ -95,6 +99,7 @@ TEST_P(HttpFilterBaseIntegrationTest, MultipleValidConfigurationHeadersFails) {
setRequestLevelConfiguration("{}");
appendRequestLevelConfiguration("{}");
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_THAT(response->body(),
HasSubstr("Received multiple configuration headers in the request"));
Expand All @@ -105,10 +110,11 @@ TEST_P(HttpFilterBaseIntegrationTest, SingleValidPlusEmptyConfigurationHeadersFa
setRequestLevelConfiguration("{}");
appendRequestLevelConfiguration("");
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_THAT(response->body(),
HasSubstr("Received multiple configuration headers in the request"));
}

} // namespace
} // namespace Nighthawk
} // namespace Nighthawk
1 change: 0 additions & 1 deletion test/server/http_filter_integration_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ HttpFilterIntegrationTestBase::getResponse(ResponseOrigin expected_origin) {
} else {
response = codec_client_->makeHeaderOnlyRequest(request_headers_);
}
response->waitForEndStream();
}
return response;
}
Expand Down
10 changes: 9 additions & 1 deletion test/server/http_test_server_filter_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class HttpTestServerIntegrationTest : public HttpFilterIntegrationTestBase,
void testWithResponseSize(int response_body_size, bool expect_header = true) {
setRequestLevelConfiguration(fmt::format("{{response_body_size:{}}}", response_body_size));
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
if (expect_header) {
Expand All @@ -54,6 +55,7 @@ class HttpTestServerIntegrationTest : public HttpFilterIntegrationTestBase,
void testBadResponseSize(int response_body_size) {
setRequestLevelConfiguration(fmt::format("{{response_body_size:{}}}", response_body_size));
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("500", response->headers().Status()->value().getStringView());
}
Expand All @@ -65,6 +67,7 @@ INSTANTIATE_TEST_SUITE_P(IpVersions, HttpTestServerIntegrationTest,
TEST_P(HttpTestServerIntegrationTest, TestNoHeaderConfig) {
initializeFilterConfiguration(kDefaultProto);
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
EXPECT_EQ(std::string(10, 'a'), response->body());
Expand Down Expand Up @@ -107,6 +110,7 @@ TEST_P(HttpTestServerIntegrationTest, TestHeaderConfigUsingEnvoyApiV2) {
setRequestLevelConfiguration(
R"({response_headers: [ { header: { key: "foo", value: "bar2"}, append: true } ]})");
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
ASSERT_EQ(1, response->headers().get(Envoy::Http::LowerCaseString("foo")).size());
Expand All @@ -128,6 +132,7 @@ TEST_P(HttpTestServerIntegrationTest, TestHeaderConfigUsingEnvoyApiV3) {

initializeFilterConfiguration(v3_configuration);
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
ASSERT_EQ(1, response->headers().get(Envoy::Http::LowerCaseString("foo")).size());
Expand All @@ -143,7 +148,7 @@ TEST_P(HttpTestServerIntegrationTest,
setRequestLevelConfiguration(
R"({v3_response_headers: [ { header: { key: "foo", value: "bar2"}, append: true } ]})");

ASSERT_DEATH(getResponse(ResponseOrigin::EXTENSION),
ASSERT_DEATH(ASSERT_TRUE(getResponse(ResponseOrigin::EXTENSION)->waitForEndStream()),
HasSubstr("cannot specify both response_headers and v3_response_headers"));
}

Expand Down Expand Up @@ -173,6 +178,7 @@ TEST_P(HttpTestServerIntegrationTest, TestEchoHeaders) {
for (auto unique_header : {"one", "two", "three"}) {
setRequestHeader(Envoy::Http::LowerCaseString("unique_header"), unique_header);
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
EXPECT_THAT(response->body(), HasSubstr(R"(':authority', 'foo.com')"));
Expand All @@ -187,6 +193,7 @@ TEST_P(HttpTestServerIntegrationTest, TestEchoHeaders) {
TEST_P(HttpTestServerIntegrationTest, NoNoStaticConfigHeaderConfig) {
initializeFilterConfiguration(kNoConfigProto);
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
EXPECT_EQ("", response->body());
Expand Down Expand Up @@ -229,6 +236,7 @@ TEST_P(HttpTestServerIntegrationTest, TestNoStaticConfigHeaderConfig) {
R"({response_headers: [ { header: { key: "foo", value: "bar2"}, append: true } ]})");
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::EXTENSION);

ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
ASSERT_EQ(1, response->headers().get(Envoy::Http::LowerCaseString("foo")).size());
Expand Down
4 changes: 4 additions & 0 deletions test/server/http_time_tracking_filter_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ TEST_P(HttpTimeTrackingIntegrationTest, ReturnsPositiveLatencyForStaticConfigura

// As the first request doesn't have a prior one, we should not observe a delta.
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(response->waitForEndStream());
int64_t latency;
EXPECT_EQ(
response->headers().get(Envoy::Http::LowerCaseString(kLatencyResponseHeaderName)).size(), 0);

// On the second request we should observe a delta.
response = getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(response->waitForEndStream());
const Envoy::Http::HeaderMap::GetResult& latency_header =
response->headers().get(Envoy::Http::LowerCaseString(kLatencyResponseHeaderName));
ASSERT_EQ(latency_header.size(), 1);
Expand All @@ -80,13 +82,15 @@ TEST_P(HttpTimeTrackingIntegrationTest, ReturnsPositiveLatencyForPerRequestConfi
// As the first request doesn't have a prior one, we should not observe a delta.
setRequestLevelConfiguration("{}");
Envoy::IntegrationStreamDecoderPtr response = getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(response->waitForEndStream());
EXPECT_TRUE(
response->headers().get(Envoy::Http::LowerCaseString(kLatencyResponseHeaderName)).empty());

// With request level configuration indicating that the timing header should be emitted,
// we should be able to observe it.
setRequestLevelConfiguration(fmt::format("{{{}}}", kDefaultProtoFragment));
response = getResponse(ResponseOrigin::UPSTREAM);
ASSERT_TRUE(response->waitForEndStream());
const Envoy::Http::HeaderMap::GetResult& latency_header =
response->headers().get(Envoy::Http::LowerCaseString(kLatencyResponseHeaderName));
ASSERT_EQ(latency_header.size(), 1);
Expand Down