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

test: Stop fake_upstream methods from accidentally succeeding #4232

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
4 changes: 2 additions & 2 deletions test/integration/fake_upstream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions test/integration/http_integration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"))));
Expand Down
7 changes: 7 additions & 0 deletions test/integration/ssl_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ TEST_P(SslIntegrationTest, RouterUpstreamDisconnectBeforeResponseComplete) {
}

TEST_P(SslIntegrationTest, RouterDownstreamDisconnectBeforeRequestComplete) {
#ifdef __APPLE__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the request version of the test, which works. Conditional needs to be on the next one "RouterDownstreamDisconnectBeforeResponseComplete"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, right.

// 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);
};
Expand Down