From af1183c287e66a9ae26dad5d920716749239f131 Mon Sep 17 00:00:00 2001 From: Greg Greenway Date: Fri, 31 Aug 2018 13:40:01 -0700 Subject: [PATCH] Re-enable TcpProxySslIntegrationTest and make the tests pass again. (#4318) Signed-off-by: Greg Greenway --- test/integration/BUILD | 4 ++++ test/integration/tcp_proxy_integration_test.cc | 5 +++++ test/integration/tcp_proxy_integration_test.h | 11 ++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/test/integration/BUILD b/test/integration/BUILD index 4872987cdd53..795c0e5bfec5 100644 --- a/test/integration/BUILD +++ b/test/integration/BUILD @@ -527,6 +527,9 @@ envoy_cc_test( "tcp_proxy_integration_test.cc", "tcp_proxy_integration_test.h", ], + data = [ + "//test/config/integration/certs", + ], deps = [ ":integration_lib", "//source/common/event:dispatcher_includes", @@ -536,6 +539,7 @@ envoy_cc_test( "//source/common/ssl:context_lib", "//source/extensions/access_loggers/file:config", "//source/extensions/filters/network/tcp_proxy:config", + "//source/extensions/transport_sockets/ssl:config", "//test/mocks/runtime:runtime_mocks", "//test/mocks/secret:secret_mocks", "//test/test_common:utility_lib", diff --git a/test/integration/tcp_proxy_integration_test.cc b/test/integration/tcp_proxy_integration_test.cc index c8ebe3c43921..c1d2305eb65c 100644 --- a/test/integration/tcp_proxy_integration_test.cc +++ b/test/integration/tcp_proxy_integration_test.cc @@ -355,6 +355,10 @@ TEST_P(TcpProxyIntegrationTest, TestIdletimeoutWithLargeOutstandingData) { ASSERT_TRUE(fake_upstream_connection->waitForDisconnect(true)); } +INSTANTIATE_TEST_CASE_P(IpVersions, TcpProxySslIntegrationTest, + testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), + TestUtility::ipTestParamsToString); + void TcpProxySslIntegrationTest::initialize() { config_helper_.addSslConfig(); TcpProxyIntegrationTest::initialize(); @@ -450,6 +454,7 @@ TEST_P(TcpProxySslIntegrationTest, DownstreamHalfClose) { Buffer::OwnedImpl empty_buffer; ssl_client_->write(empty_buffer, true); + dispatcher_->run(Event::Dispatcher::RunType::NonBlock); ASSERT_TRUE(fake_upstream_connection_->waitForHalfClose()); const std::string data("data"); diff --git a/test/integration/tcp_proxy_integration_test.h b/test/integration/tcp_proxy_integration_test.h index b136c51c8bc5..0c50ed6f3ae9 100644 --- a/test/integration/tcp_proxy_integration_test.h +++ b/test/integration/tcp_proxy_integration_test.h @@ -18,12 +18,12 @@ class TcpProxyIntegrationTest : public BaseIntegrationTest, enable_half_close_ = true; } - void initialize() override; - - void TearDown() override { + ~TcpProxyIntegrationTest() { test_server_.reset(); fake_upstreams_.clear(); } + + void initialize() override; }; class TcpProxySslIntegrationTest : public TcpProxyIntegrationTest { @@ -33,14 +33,15 @@ class TcpProxySslIntegrationTest : public TcpProxyIntegrationTest { void sendAndReceiveTlsData(const std::string& data_to_send_upstream, const std::string& data_to_send_downstream); - Network::ClientConnectionPtr ssl_client_; - FakeRawConnectionPtr fake_upstream_connection_; testing::NiceMock runtime_; std::unique_ptr context_manager_; Network::TransportSocketFactoryPtr context_; ConnectionStatusCallbacks connect_callbacks_; MockWatermarkBuffer* client_write_buffer_; std::shared_ptr payload_reader_; + testing::NiceMock secret_manager_; + Network::ClientConnectionPtr ssl_client_; + FakeRawConnectionPtr fake_upstream_connection_; }; } // namespace