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

generic conn pool: directly use thread local cluster #14423

Merged
merged 4 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 18 additions & 0 deletions test/extensions/upstreams/tcp/generic/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load(
"//bazel:envoy_build_system.bzl",
"envoy_cc_test",
"envoy_package",
)

licenses(["notice"]) # Apache 2

envoy_package()

envoy_cc_test(
name = "config_test",
srcs = ["config_test.cc"],
deps = [
"//source/extensions/upstreams/tcp/generic:config",
"//test/mocks/upstream:upstream_mocks",
],
)
38 changes: 38 additions & 0 deletions test/extensions/upstreams/tcp/generic/config_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "extensions/upstreams/tcp/generic/config.h"

#include "test/mocks/tcp/mocks.h"
#include "test/mocks/upstream/cluster_manager.h"

#include "gmock/gmock.h"
#include "gtest/gtest.h"

using testing::_;
using testing::NiceMock;
using testing::Return;

namespace Envoy {
namespace Extensions {
namespace Upstreams {
namespace Tcp {
namespace Generic {

class TcpConnPoolTest : public ::testing::Test {
public:
NiceMock<Upstream::MockThreadLocalCluster> thread_local_cluster_;
GenericConnPoolFactory factory_;
NiceMock<Envoy::Tcp::ConnectionPool::MockUpstreamCallbacks> callbacks_;
};

TEST_F(TcpConnPoolTest, TestNoHost) {
envoy::extensions::filters::network::tcp_proxy::v3::TcpProxy_TunnelingConfig config;
mattklein123 marked this conversation as resolved.
Show resolved Hide resolved
config.set_hostname("host");
EXPECT_CALL(thread_local_cluster_, httpConnPool(_, _, _)).WillOnce(Return(nullptr));
EXPECT_EQ(nullptr,
factory_.createGenericConnPool(thread_local_cluster_, config, nullptr, callbacks_));
}

} // namespace Generic
} // namespace Tcp
} // namespace Upstreams
} // namespace Extensions
} // namespace Envoy