Skip to content

Commit 9a648ac

Browse files
alyssawilkravenblackx
authored andcommitted
test: moving the tls inspector test to the extension directory (envoyproxy#20588)
Part of envoyproxy#9953 Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
1 parent ab59895 commit 9a648ac

File tree

3 files changed

+45
-45
lines changed

3 files changed

+45
-45
lines changed

test/extensions/filters/listener/tls_inspector/BUILD

+31
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,34 @@ envoy_cc_library(
8888
"//source/common/common:assert_lib",
8989
],
9090
)
91+
92+
envoy_cc_test(
93+
name = "tls_inspector_integration_test",
94+
srcs = [
95+
"tls_inspector_integration_test.cc",
96+
],
97+
data = [
98+
"//test/config/integration/certs",
99+
],
100+
deps = [
101+
"//source/common/config:api_version_lib",
102+
"//source/common/event:dispatcher_includes",
103+
"//source/common/event:dispatcher_lib",
104+
"//source/common/network:utility_lib",
105+
"//source/extensions/access_loggers/file:config",
106+
"//source/extensions/filters/listener/tls_inspector:config",
107+
"//source/extensions/filters/listener/tls_inspector:tls_inspector_lib",
108+
"//source/extensions/filters/network/echo:config",
109+
"//source/extensions/transport_sockets/tls:config",
110+
"//source/extensions/transport_sockets/tls:context_config_lib",
111+
"//source/extensions/transport_sockets/tls:context_lib",
112+
"//test/integration:integration_lib",
113+
"//test/mocks/runtime:runtime_mocks",
114+
"//test/mocks/secret:secret_mocks",
115+
"//test/test_common:utility_lib",
116+
"@envoy_api//envoy/config/bootstrap/v3:pkg_cc_proto",
117+
"@envoy_api//envoy/config/cluster/v3:pkg_cc_proto",
118+
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
119+
"@envoy_api//envoy/extensions/access_loggers/file/v3:pkg_cc_proto",
120+
],
121+
)

test/integration/listener_filter_integration_test.cc test/extensions/filters/listener/tls_inspector/tls_inspector_integration_test.cc

+14-14
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
namespace Envoy {
2222
namespace {
2323

24-
class ListenerFilterIntegrationTest : public testing::TestWithParam<Network::Address::IpVersion>,
25-
public BaseIntegrationTest {
24+
class TlsInspectorIntegrationTest : public testing::TestWithParam<Network::Address::IpVersion>,
25+
public BaseIntegrationTest {
2626
public:
27-
ListenerFilterIntegrationTest()
27+
TlsInspectorIntegrationTest()
2828
: BaseIntegrationTest(GetParam(), ConfigHelper::baseConfig() + R"EOF(
2929
filter_chains:
3030
filters:
3131
- name: envoy.filters.network.echo
3232
)EOF") {}
3333

34-
~ListenerFilterIntegrationTest() override = default;
34+
~TlsInspectorIntegrationTest() override = default;
3535
std::string appendMatcher(const std::string& listener_filter, bool disabled) {
3636
if (disabled) {
3737
return listener_filter +
@@ -49,9 +49,9 @@ class ListenerFilterIntegrationTest : public testing::TestWithParam<Network::Add
4949
}
5050
}
5151

52-
void initializeWithListenerFilter(bool ssl_client, const std::string& log_format,
53-
absl::optional<bool> listener_filter_disabled = absl::nullopt,
54-
bool enable_ja3_fingerprinting = false) {
52+
void initializeWithTlsInspector(bool ssl_client, const std::string& log_format,
53+
absl::optional<bool> listener_filter_disabled = absl::nullopt,
54+
bool enable_ja3_fingerprinting = false) {
5555
config_helper_.renameListener("echo");
5656
std::string tls_inspector_config = ConfigHelper::tlsInspectorFilter(enable_ja3_fingerprinting);
5757
if (listener_filter_disabled.has_value()) {
@@ -91,8 +91,8 @@ class ListenerFilterIntegrationTest : public testing::TestWithParam<Network::Add
9191
const Ssl::ClientSslTransportOptions& ssl_options = {},
9292
const std::string& curves_list = "",
9393
bool enable_ja3_fingerprinting = false) {
94-
initializeWithListenerFilter(ssl_client, log_format, listener_filter_disabled,
95-
enable_ja3_fingerprinting);
94+
initializeWithTlsInspector(ssl_client, log_format, listener_filter_disabled,
95+
enable_ja3_fingerprinting);
9696

9797
// Set up the SSL client.
9898
Network::Address::InstanceConstSharedPtr address =
@@ -140,23 +140,23 @@ class ListenerFilterIntegrationTest : public testing::TestWithParam<Network::Add
140140
};
141141

142142
// Each listener filter is enabled by default.
143-
TEST_P(ListenerFilterIntegrationTest, AllListenerFiltersAreEnabledByDefault) {
143+
TEST_P(TlsInspectorIntegrationTest, AllListenerFiltersAreEnabledByDefault) {
144144
setupConnections(/*listener_filter_disabled=*/false, /*expect_connection_open=*/true,
145145
/*ssl_client=*/true);
146146
client_->close(Network::ConnectionCloseType::NoFlush);
147147
EXPECT_THAT(waitForAccessLog(listener_access_log_name_), testing::Eq("-"));
148148
}
149149

150150
// The tls_inspector is disabled. The ALPN won't be sniffed out and no filter chain is matched.
151-
TEST_P(ListenerFilterIntegrationTest, DisabledTlsInspectorFailsFilterChainFind) {
151+
TEST_P(TlsInspectorIntegrationTest, DisabledTlsInspectorFailsFilterChainFind) {
152152
setupConnections(/*listener_filter_disabled=*/true, /*expect_connection_open=*/false,
153153
/*ssl_client=*/true);
154154
EXPECT_THAT(waitForAccessLog(listener_access_log_name_),
155155
testing::Eq(StreamInfo::ResponseCodeDetails::get().FilterChainNotFound));
156156
}
157157

158158
// trigger the tls inspect filter timeout, and continue create new connection after timeout
159-
TEST_P(ListenerFilterIntegrationTest, ContinueOnListenerTimeout) {
159+
TEST_P(TlsInspectorIntegrationTest, ContinueOnListenerTimeout) {
160160
setupConnections(/*listener_filter_disabled=*/false, /*expect_connection_open=*/true,
161161
/*ssl_client=*/false);
162162
// The length of tls hello message is defined as `TLS_MAX_CLIENT_HELLO = 64 * 1024`
@@ -171,7 +171,7 @@ TEST_P(ListenerFilterIntegrationTest, ContinueOnListenerTimeout) {
171171
}
172172

173173
// The `JA3` fingerprint is correct in the access log.
174-
TEST_P(ListenerFilterIntegrationTest, JA3FingerprintIsSet) {
174+
TEST_P(TlsInspectorIntegrationTest, JA3FingerprintIsSet) {
175175
// These TLS options will create a client hello message with
176176
// `JA3` fingerprint:
177177
// `771,49199,23-65281-10-11-35-16-13,23,0`
@@ -189,7 +189,7 @@ TEST_P(ListenerFilterIntegrationTest, JA3FingerprintIsSet) {
189189
testing::Eq("71d1f47d1125ac53c3c6a4863c087cfe"));
190190
}
191191

192-
INSTANTIATE_TEST_SUITE_P(IpVersions, ListenerFilterIntegrationTest,
192+
INSTANTIATE_TEST_SUITE_P(IpVersions, TlsInspectorIntegrationTest,
193193
testing::ValuesIn(TestEnvironment::getIpVersionsForTest()),
194194
TestUtility::ipTestParamsToString);
195195
} // namespace

test/integration/BUILD

-31
Original file line numberDiff line numberDiff line change
@@ -1702,37 +1702,6 @@ envoy_cc_test(
17021702
],
17031703
)
17041704

1705-
envoy_cc_test(
1706-
name = "listener_filter_integration_test",
1707-
srcs = [
1708-
"listener_filter_integration_test.cc",
1709-
],
1710-
data = [
1711-
"//test/config/integration/certs",
1712-
],
1713-
deps = [
1714-
":integration_lib",
1715-
"//source/common/config:api_version_lib",
1716-
"//source/common/event:dispatcher_includes",
1717-
"//source/common/event:dispatcher_lib",
1718-
"//source/common/network:utility_lib",
1719-
"//source/extensions/access_loggers/file:config",
1720-
"//source/extensions/filters/listener/tls_inspector:config",
1721-
"//source/extensions/filters/listener/tls_inspector:tls_inspector_lib",
1722-
"//source/extensions/filters/network/echo:config",
1723-
"//source/extensions/transport_sockets/tls:config",
1724-
"//source/extensions/transport_sockets/tls:context_config_lib",
1725-
"//source/extensions/transport_sockets/tls:context_lib",
1726-
"//test/mocks/runtime:runtime_mocks",
1727-
"//test/mocks/secret:secret_mocks",
1728-
"//test/test_common:utility_lib",
1729-
"@envoy_api//envoy/config/bootstrap/v3:pkg_cc_proto",
1730-
"@envoy_api//envoy/config/cluster/v3:pkg_cc_proto",
1731-
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
1732-
"@envoy_api//envoy/extensions/access_loggers/file/v3:pkg_cc_proto",
1733-
],
1734-
)
1735-
17361705
envoy_cc_test(
17371706
name = "cx_limit_integration_test",
17381707
srcs = ["cx_limit_integration_test.cc"],

0 commit comments

Comments
 (0)