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/04/09 03:08:43 UTC
mesos git commit: Made `Delegate` and `Handlers` libprocess tests
less fragile.
Repository: mesos
Updated Branches:
refs/heads/master b900abff1 -> ed93745e1
Made `Delegate` and `Handlers` libprocess tests less fragile.
As previously written, these tests depended on the fact that `post`
will synchronously deliver a message to a local PID. That is an
implementation detail that seems unwise to rely upon. Instead, it is
quite easy to arrange for both tests to block until the effect of
the `post` has occurred.
Review: https://reviews.apache.org/r/45590/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ed93745e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ed93745e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ed93745e
Branch: refs/heads/master
Commit: ed93745e136e862928f4251a173756e78f49c7ef
Parents: b900abf
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Apr 8 18:08:33 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Apr 8 18:08:33 2016 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/tests/process_tests.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ed93745e/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index 6b3aa1b..e8ee8ee 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -357,8 +357,9 @@ TEST(ProcessTest, Handlers)
HandlersProcess process;
+ Future<Nothing> func;
EXPECT_CALL(process, func(_, _))
- .Times(1);
+ .WillOnce(FutureSatisfy(&func));
PID<HandlersProcess> pid = spawn(&process);
@@ -366,6 +367,8 @@ TEST(ProcessTest, Handlers)
post(pid, "func");
+ AWAIT_READY(func);
+
terminate(pid, false);
wait(pid);
}
@@ -534,14 +537,17 @@ TEST(ProcessTest, Delegate)
DelegateeProcess delegatee;
DelegatorProcess delegator(delegatee.self());
+ Future<Nothing> func;
EXPECT_CALL(delegatee, func(_, _))
- .Times(1);
+ .WillOnce(FutureSatisfy(&func));
spawn(&delegator);
spawn(&delegatee);
post(delegator.self(), "func");
+ AWAIT_READY(func);
+
terminate(delegator, false);
wait(delegator);