Improved SlaveTest.HealthCheckUnregisterRace.

Now that the MockRegistrar has been introduced, we can assert
that the master doesn't do a registry operation in certain
situations.

Review: https://reviews.apache.org/r/51845/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6172da93
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6172da93
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6172da93

Branch: refs/heads/master
Commit: 6172da93d883cf2bafb7cf195ad119d480434329
Parents: fac32e4
Author: Neil Conway <neil.con...@gmail.com>
Authored: Mon Sep 19 15:48:48 2016 -0700
Committer: Vinod Kone <vinodk...@gmail.com>
Committed: Mon Sep 19 15:48:48 2016 -0700

----------------------------------------------------------------------
 src/tests/slave_tests.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6172da93/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 8ad3547..552f3f8 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -2875,7 +2875,12 @@ TEST_F(SlaveTest, HealthCheckUnregisterRace)
   // We now want to arrange for the agent to fail health checks. We
   // can't do that directly, because the `SlaveObserver` for this
   // agent has already been removed. Instead, we dispatch to the
-  // master's `markUnreachable` method directly.
+  // master's `markUnreachable` method directly. We expect the master
+  // to ignore this message; in particular, the master should not
+  // attempt to update the registry to mark the slave unreachable.
+  EXPECT_CALL(*master.get()->registrar.get(), apply(_))
+    .Times(0);
+
   process::dispatch(master.get()->pid, &Master::markUnreachable, slaveId);
 
   Clock::settle();

Reply via email to