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 2015/12/11 20:45:35 UTC
mesos git commit: Fixed the flaky HttpConnection.ClosingResponse test.
Repository: mesos
Updated Branches:
refs/heads/master 7e54d3df7 -> 6bf85dcfd
Fixed the flaky HttpConnection.ClosingResponse test.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6bf85dcf
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6bf85dcf
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6bf85dcf
Branch: refs/heads/master
Commit: 6bf85dcfd3353941164a38374677cf95dfddd918
Parents: 7e54d3d
Author: Benjamin Mahler <be...@gmail.com>
Authored: Fri Dec 11 11:44:19 2015 -0800
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Fri Dec 11 11:45:10 2015 -0800
----------------------------------------------------------------------
3rdparty/libprocess/src/tests/http_tests.cpp | 24 +++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6bf85dcf/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index 2de75ca..d284361 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -910,15 +910,17 @@ TEST(HTTPConnectionTest, ClosingResponse)
http::Connection connection = connect.get();
- // Issue two pipelined requests, the server will respond
+ // Issue two pipelined requests; the server will respond
// with a 'Connection: close' for the first response, which
- // will lead to a disconnection.
- Promise<http::Response> promise1, promise2;
- Future<http::Request> get1, get2;
+ // will trigger a disconnection and break the pipeline. This
+ // means that the second request arrives at the server but
+ // the response cannot be received due to the disconnection.
+ Promise<http::Response> promise1;
+ Future<Nothing> get2;
EXPECT_CALL(*http.process, get(_))
- .WillOnce(DoAll(FutureArg<0>(&get1), Return(promise1.future())))
- .WillOnce(DoAll(FutureArg<0>(&get2), Return(promise2.future())));
+ .WillOnce(Return(promise1.future()))
+ .WillOnce(DoAll(FutureSatisfy(&get2), Return(http::OK())));
http::Request request1, request2;
@@ -934,12 +936,14 @@ TEST(HTTPConnectionTest, ClosingResponse)
Future<http::Response> response1 = connection.send(request1);
Future<http::Response> response2 = connection.send(request2);
- // The first response will close the connection.
- http::Response ok = http::OK("body");
- ok.headers["Connection"] = "close";
+ http::Response close = http::OK("body");
+ close.headers["Connection"] = "close";
- promise1.set(ok);
+ // Wait for both requests to arrive, then issue the closing response.
+ AWAIT_READY(get2);
+ promise1.set(close);
+ // The second response will fail because of 'Connection: close'.
AWAIT_READY(response1);
AWAIT_FAILED(response2);