Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverting override to override_request_timeout_by_gateway_timeout #2296

Merged
merged 5 commits into from
May 25, 2022
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
1 change: 0 additions & 1 deletion library/common/config/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ stats_sinks: *stats_sinks
envoy:
reloadable_features:
allow_multiple_dns_addresses: *dns_multiple_addresses
override_request_timeout_by_gateway_timeout: false
http2_delay_keepalive_timeout: *h2_delay_keepalive_timeout
)"
// Needed due to warning in
Expand Down
51 changes: 50 additions & 1 deletion test/common/integration/client_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ class ClientIntegrationTest : public BaseIntegrationTest,
}

void TearDown() override {
// Right now each test does one request - if this changes, make the 1
// configurable.
ASSERT_EQ(cc_.on_complete_calls + cc_.on_cancel_calls + cc_.on_error_calls, 1);
test_server_.reset();
fake_upstreams_.clear();
}
Expand Down Expand Up @@ -466,7 +469,7 @@ TEST_P(ClientIntegrationTest, CaseSensitive) {
test_server_->waitForCounterEq("http.client.stream_success", 1);
}

TEST_P(ClientIntegrationTest, Timeout) {
TEST_P(ClientIntegrationTest, TimeoutOnRequestPath) {
config_helper_.addConfigModifier([](envoy::config::bootstrap::v3::Bootstrap& bootstrap) {
auto* listener = bootstrap.mutable_static_resources()->mutable_listeners(0);
auto* em_hcm = listener->mutable_api_listener()->mutable_api_listener();
Expand Down Expand Up @@ -501,6 +504,52 @@ TEST_P(ClientIntegrationTest, Timeout) {
Envoy::FakeRawConnectionPtr upstream_connection;
ASSERT_TRUE(fake_upstreams_[0]->waitForRawConnection(upstream_connection));

std::string upstream_request;
EXPECT_TRUE(upstream_connection->waitForData(FakeRawConnection::waitForInexactMatch("GET /"),
&upstream_request));
terminal_callback_.waitReady();

ASSERT_EQ(cc_.on_headers_calls, 0);
ASSERT_EQ(cc_.on_data_calls, 0);
ASSERT_EQ(cc_.on_complete_calls, 0);
ASSERT_EQ(cc_.on_error_calls, 1);
}

TEST_P(ClientIntegrationTest, TimeoutOnResponsePath) {
config_helper_.addConfigModifier([](envoy::config::bootstrap::v3::Bootstrap& bootstrap) {
auto* listener = bootstrap.mutable_static_resources()->mutable_listeners(0);
auto* em_hcm = listener->mutable_api_listener()->mutable_api_listener();
auto hcm =
MessageUtil::anyConvert<envoy::extensions::filters::network::http_connection_manager::v3::
EnvoyMobileHttpConnectionManager>(*em_hcm);
hcm.mutable_config()->mutable_stream_idle_timeout()->set_seconds(1);
em_hcm->PackFrom(hcm);
});

autonomous_upstream_ = false;
initialize();

bridge_callbacks_.on_headers = [](envoy_headers c_headers, bool, envoy_stream_intel,
void* context) -> void* {
Http::ResponseHeaderMapPtr response_headers = toResponseHeaders(c_headers);
callbacks_called* cc_ = static_cast<callbacks_called*>(context);
cc_->on_headers_calls++;
cc_->status = response_headers->Status()->value().getStringView();
return nullptr;
};

// Build a set of request headers.
envoy_headers c_headers = Http::Utility::toBridgeHeaders(default_request_headers_);

// Create a stream.
dispatcher_->post([&]() -> void {
http_client_->startStream(stream_, bridge_callbacks_, false);
http_client_->sendHeaders(stream_, c_headers, true);
});

Envoy::FakeRawConnectionPtr upstream_connection;
ASSERT_TRUE(fake_upstreams_[0]->waitForRawConnection(upstream_connection));

std::string upstream_request;
EXPECT_TRUE(upstream_connection->waitForData(FakeRawConnection::waitForInexactMatch("GET /"),
&upstream_request));
Expand Down