diff --git a/test/extensions/filters/http/dynamic_forward_proxy/proxy_filter_integration_test.cc b/test/extensions/filters/http/dynamic_forward_proxy/proxy_filter_integration_test.cc index b2750046922b6..ddef72bc47fa6 100644 --- a/test/extensions/filters/http/dynamic_forward_proxy/proxy_filter_integration_test.cc +++ b/test/extensions/filters/http/dynamic_forward_proxy/proxy_filter_integration_test.cc @@ -214,7 +214,10 @@ TEST_P(ProxyFilterIntegrationTest, UpstreamTlsInvalidSAN) { upstream_tls_ = true; upstream_cert_name_ = "upstream"; setup(); + // The upstream connection is going to fail handshake so make sure it can read and we expect + // it to disconnect. fake_upstreams_[0]->set_allow_unexpected_disconnects(true); + fake_upstreams_[0]->setReadDisableOnNewConnection(false); codec_client_ = makeHttpConnection(lookupPort("http")); const Http::TestHeaderMapImpl request_headers{ diff --git a/test/integration/fake_upstream.cc b/test/integration/fake_upstream.cc index 8cca9265525e3..e6f9ad9d4b7b9 100644 --- a/test/integration/fake_upstream.cc +++ b/test/integration/fake_upstream.cc @@ -397,7 +397,8 @@ FakeUpstream::FakeUpstream(Network::TransportSocketFactoryPtr&& transport_socket api_(Api::createApiForTest(stats_store_)), time_system_(time_system), dispatcher_(api_->allocateDispatcher()), handler_(new Server::ConnectionHandlerImpl(ENVOY_LOGGER(), *dispatcher_)), - allow_unexpected_disconnects_(false), enable_half_close_(enable_half_close), listener_(*this), + allow_unexpected_disconnects_(false), read_disable_on_new_connection_(true), + enable_half_close_(enable_half_close), listener_(*this), filter_chain_(Network::Test::createEmptyFilterChain(std::move(transport_socket_factory))) { thread_ = api_->threadFactory().createThread([this]() -> void { threadRoutine(); }); server_initialized_.waitReady(); @@ -416,7 +417,9 @@ void FakeUpstream::cleanUp() { bool FakeUpstream::createNetworkFilterChain(Network::Connection& connection, const std::vector&) { Thread::LockGuard lock(lock_); - connection.readDisable(true); + if (read_disable_on_new_connection_) { + connection.readDisable(true); + } auto connection_wrapper = std::make_unique(connection, allow_unexpected_disconnects_); connection_wrapper->moveIntoListBack(std::move(connection_wrapper), new_connections_); diff --git a/test/integration/fake_upstream.h b/test/integration/fake_upstream.h index 7ea255edf4f93..72b831ad4664b 100644 --- a/test/integration/fake_upstream.h +++ b/test/integration/fake_upstream.h @@ -568,8 +568,9 @@ class FakeUpstream : Logger::Loggable, bool createListenerFilterChain(Network::ListenerFilterManager& listener) override; bool createUdpListenerFilterChain(Network::UdpListenerFilterManager& udp_listener, Network::UdpReadFilterCallbacks& callbacks) override; - void set_allow_unexpected_disconnects(bool value) { allow_unexpected_disconnects_ = value; } + void set_allow_unexpected_disconnects(bool value) { allow_unexpected_disconnects_ = value; } + void setReadDisableOnNewConnection(bool value) { read_disable_on_new_connection_ = value; } Event::TestTimeSystem& timeSystem() { return time_system_; } // Stops the dispatcher loop and joins the listening thread. @@ -628,6 +629,7 @@ class FakeUpstream : Logger::Loggable, // deleted) on the same thread that allocated the connection. std::list consumed_connections_ GUARDED_BY(lock_); bool allow_unexpected_disconnects_; + bool read_disable_on_new_connection_; const bool enable_half_close_; FakeListener listener_; const Network::FilterChainSharedPtr filter_chain_;