You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/06/09 17:20:15 UTC
[2/2] mesos git commit: Added a test for the SSL head-of-line
blocking issue in MESOS-5340.
Added a test for the SSL head-of-line blocking issue in MESOS-5340.
Review: https://reviews.apache.org/r/47362
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/771ecf45
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/771ecf45
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/771ecf45
Branch: refs/heads/master
Commit: 771ecf45382c09eee91539adb406657f71d84abb
Parents: 22bc2d6
Author: Benjamin Mahler <bm...@apache.org>
Authored: Fri May 13 14:39:46 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu Jun 9 10:19:40 2016 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/tests/ssl_tests.cpp | 61 ++++++++++++++++++++++++
1 file changed, 61 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/771ecf45/3rdparty/libprocess/src/tests/ssl_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/ssl_tests.cpp b/3rdparty/libprocess/src/tests/ssl_tests.cpp
index 4d23781..a7c50af 100644
--- a/3rdparty/libprocess/src/tests/ssl_tests.cpp
+++ b/3rdparty/libprocess/src/tests/ssl_tests.cpp
@@ -12,6 +12,7 @@
#include <stdio.h>
+#include <process/clock.hpp>
#include <process/future.hpp>
#include <process/gtest.hpp>
#include <process/io.hpp>
@@ -41,6 +42,7 @@ namespace openssl = network::openssl;
using network::Address;
using network::Socket;
+using process::Clock;
using process::Failure;
using process::Future;
using process::Subprocess;
@@ -706,4 +708,63 @@ TEST_F(SSLTest, HTTPSPost)
ASSERT_EQ(data, response.get().body);
}
+
+// This test ensures that if an SSL connection never sends any
+// data (i.e. no handshake or downgrade completes), it will not
+// impact our ability to accept additional connections.
+// This test was added due to MESOS-5340.
+TEST_F(SSLTest, SilentSocket)
+{
+ Try<Socket> server = setup_server({
+ {"SSL_ENABLED", "true"},
+ {"SSL_KEY_FILE", key_path().value},
+ {"SSL_CERT_FILE", certificate_path().value}});
+
+ ASSERT_SOME(server);
+ ASSERT_SOME(server->address());
+ ASSERT_SOME(server->address()->hostname());
+
+ Future<Socket> socket = server->accept();
+
+ // We initiate a connection on which we will not send
+ // any data. This means the socket on the server will
+ // not complete the SSL handshake, nor be downgraded.
+ // As a result, we expect that the server will not see
+ // an accepted socket for this connection.
+ Try<Socket> connection = Socket::create(Socket::POLL);
+ ASSERT_SOME(connection);
+ connection->connect(server->address().get());
+
+ // Note that settling libprocess is not sufficient
+ // for ensuring socket events are processed.
+ Clock::pause();
+ Clock::settle();
+ Clock::resume();
+
+ ASSERT_TRUE(socket.isPending());
+
+ // Now send an HTTP GET request, it should complete
+ // without getting blocked by the socket above
+ // undergoing the SSL handshake.
+ const http::URL url(
+ "https",
+ server->address()->hostname().get(),
+ server->address()->port);
+
+ Future<http::Response> response = http::get(url);
+
+ AWAIT_READY(socket);
+
+ // Send the response from the server.
+ const string buffer = string() +
+ "HTTP/1.1 200 OK\r\n" +
+ "Content-Length: " + stringify(data.length()) + "\r\n" +
+ "\r\n" +
+ data;
+ AWAIT_READY(Socket(socket.get()).send(buffer));
+
+ AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
+ EXPECT_EQ(data, response->body);
+}
+
#endif // USE_SSL_SOCKET