forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
quic: improve coverage (envoyproxy#16569)
Risk Level: n/a (test only) Testing: yes Docs Changes: n/a Release Notes: n/a Signed-off-by: Alyssa Wilk <[email protected]>
- Loading branch information
1 parent
4f346fc
commit 5eb8e88
Showing
6 changed files
with
159 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "common/quic/client_connection_factory_impl.h" | ||
#include "common/quic/quic_transport_socket_factory.h" | ||
|
||
#include "test/common/upstream/utility.h" | ||
#include "test/mocks/common.h" | ||
#include "test/mocks/event/mocks.h" | ||
#include "test/mocks/server/transport_socket_factory_context.h" | ||
#include "test/mocks/ssl/mocks.h" | ||
#include "test/mocks/upstream/cluster_info.h" | ||
#include "test/mocks/upstream/host.h" | ||
#include "test/test_common/simulated_time_system.h" | ||
|
||
namespace Envoy { | ||
namespace Quic { | ||
|
||
class QuicNetworkConnectionTest : public Event::TestUsingSimulatedTime, public testing::Test { | ||
protected: | ||
NiceMock<Event::MockDispatcher> dispatcher_; | ||
std::shared_ptr<Upstream::MockClusterInfo> cluster_{new NiceMock<Upstream::MockClusterInfo>()}; | ||
Upstream::HostSharedPtr host_{new NiceMock<Upstream::MockHost>}; | ||
NiceMock<Random::MockRandomGenerator> random_; | ||
Upstream::ClusterConnectivityState state_; | ||
Network::Address::InstanceConstSharedPtr test_address_ = | ||
Network::Utility::resolveUrl("tcp://127.0.0.1:3000"); | ||
NiceMock<Server::Configuration::MockTransportSocketFactoryContext> context_; | ||
Quic::QuicClientTransportSocketFactory factory_{ | ||
std::unique_ptr<Envoy::Ssl::ClientContextConfig>(new NiceMock<Ssl::MockClientContextConfig>), | ||
context_}; | ||
}; | ||
|
||
TEST_F(QuicNetworkConnectionTest, BufferLimits) { | ||
PersistentQuicInfoImpl info{dispatcher_, factory_, simTime(), test_address_}; | ||
|
||
std::unique_ptr<Network::ClientConnection> client_connection = | ||
createQuicNetworkConnection(info, dispatcher_, test_address_, test_address_); | ||
EnvoyQuicClientSession* session = static_cast<EnvoyQuicClientSession*>(client_connection.get()); | ||
session->Initialize(); | ||
client_connection->connect(); | ||
EXPECT_TRUE(client_connection->connecting()); | ||
ASSERT(session != nullptr); | ||
EXPECT_EQ(absl::nullopt, session->unixSocketPeerCredentials()); | ||
EXPECT_EQ(absl::nullopt, session->lastRoundTripTime()); | ||
client_connection->close(Network::ConnectionCloseType::NoFlush); | ||
} | ||
|
||
} // namespace Quic | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters