-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
quic: improve coverage #16569
quic: improve coverage #16569
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,7 @@ class QuicFilterManagerConnectionImpl : public Network::ConnectionImplBase, | |
absl::optional<Network::Connection::UnixDomainSocketPeerCredentials> | ||
unixSocketPeerCredentials() const override { | ||
// Unix domain socket is not supported. | ||
NOT_REACHED_GCOVR_EXCL_LINE; | ||
return absl::nullopt; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm having trouble finding non-test uses of unixSocketPeerCredentials(). What am I missing? Who depends on this API? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure. I'd be happy to remove as a follow-up if we think it's doable. |
||
} | ||
void setConnectionStats(const Network::Connection::ConnectionStats& stats) override { | ||
// TODO(danzh): populate stats. | ||
|
@@ -113,6 +113,7 @@ class QuicFilterManagerConnectionImpl : public Network::ConnectionImplBase, | |
const StreamInfo::StreamInfo& streamInfo() const override { return stream_info_; } | ||
absl::string_view transportFailureReason() const override { return transport_failure_reason_; } | ||
bool startSecureTransport() override { return false; } | ||
// TODO(#2557) Implement this. | ||
absl::optional<std::chrono::milliseconds> lastRoundTripTime() const override { return {}; } | ||
|
||
// Network::FilterManagerConnection | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "common/quic/client_connection_factory_impl.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for adding these tests! |
||
#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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this ASSERT were to fail the following code would crash. If we remove the ASSERT, we should also fix this code so it doesn't crash.
envoy/source/common/quic/envoy_quic_proof_verifier.cc
Line 35 in 1ea2aa6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already removed over here #16462
just hadn't merged it in.
That PR came with tests and error handling for SDS lazy loading of secrets :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could we add ASSERT(context_ != nullptr) to the EnvoyQuicProofVerifier constructor as a sanity check? I'm fine with it being in this PR or a followup.
https://github.com/envoyproxy/envoy/blob/main/source/common/quic/envoy_quic_proof_verifier.h#L15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in #16466 thanks