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
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
7 changes: 5 additions & 2 deletions test/integration/fake_upstream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -416,7 +417,9 @@ void FakeUpstream::cleanUp() {
bool FakeUpstream::createNetworkFilterChain(Network::Connection& connection,
const std::vector<Network::FilterFactoryCb>&) {
Thread::LockGuard lock(lock_);
connection.readDisable(true);
if (read_disable_on_new_connection_) {
connection.readDisable(true);
}
auto connection_wrapper =
std::make_unique<QueuedConnectionWrapper>(connection, allow_unexpected_disconnects_);
connection_wrapper->moveIntoListBack(std::move(connection_wrapper), new_connections_);
Expand Down
4 changes: 3 additions & 1 deletion test/integration/fake_upstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,9 @@ class FakeUpstream : Logger::Loggable<Logger::Id::testing>,
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.
Expand Down Expand Up @@ -628,6 +629,7 @@ class FakeUpstream : Logger::Loggable<Logger::Id::testing>,
// deleted) on the same thread that allocated the connection.
std::list<QueuedConnectionWrapperPtr> 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_;
Expand Down