From 7541cc6aef5794cf5d3757cac1d551e66e0f1043 Mon Sep 17 00:00:00 2001 From: Michael Behr Date: Wed, 22 Aug 2018 13:17:20 -0400 Subject: [PATCH 1/4] Replace stray AssertionResults with AssertionFailures. Constructing an AssertionResult out of a (non-empty) string gives a successful assertion, which wasn't intended. Signed-off-by: Michael Behr --- test/integration/fake_upstream.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/fake_upstream.cc b/test/integration/fake_upstream.cc index 29f2289a5ce9..03a474f8ee1b 100644 --- a/test/integration/fake_upstream.cc +++ b/test/integration/fake_upstream.cc @@ -245,7 +245,7 @@ AssertionResult FakeConnectionBase::waitForDisconnect(bool ignore_spurious_event Thread::LockGuard lock(lock_); while (shared_connection_.connected()) { if (std::chrono::steady_clock::now() >= end_time) { - return AssertionResult("Timed out waiting for disconnect."); + return AssertionFailure() << "Timed out waiting for disconnect."; } Thread::CondVar::WaitStatus status = connection_event_.waitFor(lock_, 5ms); // The default behavior of waitForDisconnect is to assume the test cleanly @@ -297,7 +297,7 @@ AssertionResult FakeHttpConnection::waitForNewStream(Event::Dispatcher& client_d Thread::LockGuard lock(lock_); while (new_streams_.empty()) { if (std::chrono::steady_clock::now() >= end_time) { - return AssertionResult("Timed out waiting for new stream."); + return AssertionFailure() << "Timed out waiting for new stream."; } Thread::CondVar::WaitStatus status = connection_event_.waitFor(lock_, 5ms); // As with waitForDisconnect, by default, waitForNewStream returns after the next event. From e3cc0039f4103feabe8398a601d04cd06e9b5323 Mon Sep 17 00:00:00 2001 From: Michael Behr Date: Wed, 29 Aug 2018 14:26:01 -0400 Subject: [PATCH 2/4] Skip testRouterDownstreamDisconnectBeforeResponseComplete on OS X. Signed-off-by: Michael Behr --- test/integration/http_integration.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/integration/http_integration.cc b/test/integration/http_integration.cc index 1761bfd00638..eb2fa6c6e18d 100644 --- a/test/integration/http_integration.cc +++ b/test/integration/http_integration.cc @@ -577,6 +577,13 @@ void HttpIntegrationTest::testRouterDownstreamDisconnectBeforeRequestComplete( void HttpIntegrationTest::testRouterDownstreamDisconnectBeforeResponseComplete( ConnectionCreationFunction* create_connection) { + #ifdef __APPLE__ + // Skip this test on OS X: we can't detect the early close on OS X, and we + // won't clean up the upstream connection until it times out. See #4294. + if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + return; + } + #endif initialize(); codec_client_ = makeHttpConnection( create_connection ? ((*create_connection)()) : makeClientConnection((lookupPort("http")))); From 5e97bc96af0ee6fe4ca1734545c852aed53e4797 Mon Sep 17 00:00:00 2001 From: Michael Behr Date: Wed, 29 Aug 2018 15:48:18 -0400 Subject: [PATCH 3/4] Skip SSL RouterDownstreamDisconnectBeforeRequestComplete on OS X Signed-off-by: Michael Behr --- test/integration/http_integration.cc | 4 ++-- test/integration/ssl_integration_test.cc | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/integration/http_integration.cc b/test/integration/http_integration.cc index eb2fa6c6e18d..8c859583fc2b 100644 --- a/test/integration/http_integration.cc +++ b/test/integration/http_integration.cc @@ -577,13 +577,13 @@ void HttpIntegrationTest::testRouterDownstreamDisconnectBeforeRequestComplete( void HttpIntegrationTest::testRouterDownstreamDisconnectBeforeResponseComplete( ConnectionCreationFunction* create_connection) { - #ifdef __APPLE__ +#ifdef __APPLE__ // Skip this test on OS X: we can't detect the early close on OS X, and we // won't clean up the upstream connection until it times out. See #4294. if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { return; } - #endif +#endif initialize(); codec_client_ = makeHttpConnection( create_connection ? ((*create_connection)()) : makeClientConnection((lookupPort("http")))); diff --git a/test/integration/ssl_integration_test.cc b/test/integration/ssl_integration_test.cc index 3ed603e9b37c..e37d5ad35928 100644 --- a/test/integration/ssl_integration_test.cc +++ b/test/integration/ssl_integration_test.cc @@ -150,6 +150,13 @@ TEST_P(SslIntegrationTest, RouterUpstreamDisconnectBeforeResponseComplete) { } TEST_P(SslIntegrationTest, RouterDownstreamDisconnectBeforeRequestComplete) { +#ifdef __APPLE__ + // Skip this test on OS X: we can't detect the early close on OS X, and we + // won't clean up the upstream connection until it times out. See #4294. + if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + return; + } +#endif ConnectionCreationFunction creator = [&]() -> Network::ClientConnectionPtr { return makeSslClientConnection(false, false); }; From 3069ea8d91c242b588ffd133a177df86baf1aeac Mon Sep 17 00:00:00 2001 From: Michael Behr Date: Thu, 30 Aug 2018 10:46:12 -0400 Subject: [PATCH 4/4] Skip SSL RouterDownstreamDisconnectBeforeResponseComplete on OS X instead of before /request/ complete Signed-off-by: Michael Behr --- test/integration/ssl_integration_test.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/integration/ssl_integration_test.cc b/test/integration/ssl_integration_test.cc index e37d5ad35928..bf32653bcd00 100644 --- a/test/integration/ssl_integration_test.cc +++ b/test/integration/ssl_integration_test.cc @@ -150,13 +150,6 @@ TEST_P(SslIntegrationTest, RouterUpstreamDisconnectBeforeResponseComplete) { } TEST_P(SslIntegrationTest, RouterDownstreamDisconnectBeforeRequestComplete) { -#ifdef __APPLE__ - // Skip this test on OS X: we can't detect the early close on OS X, and we - // won't clean up the upstream connection until it times out. See #4294. - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { - return; - } -#endif ConnectionCreationFunction creator = [&]() -> Network::ClientConnectionPtr { return makeSslClientConnection(false, false); }; @@ -165,6 +158,13 @@ TEST_P(SslIntegrationTest, RouterDownstreamDisconnectBeforeRequestComplete) { } TEST_P(SslIntegrationTest, RouterDownstreamDisconnectBeforeResponseComplete) { +#ifdef __APPLE__ + // Skip this test on OS X: we can't detect the early close on OS X, and we + // won't clean up the upstream connection until it times out. See #4294. + if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + return; + } +#endif ConnectionCreationFunction creator = [&]() -> Network::ClientConnectionPtr { return makeSslClientConnection(false, false); };