Removed redundant expectations for `connected`/`disconnected` callback.

This is a follow up patch to `625b08` with the same reasoning i.e.,
the `master` object is now destroyed _after_ the scheduler
library thereby ensuring that there cannot be any pending callbacks
that can be triggered. Hence, we can get rid of these redundant
expectations.

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


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

Branch: refs/heads/master
Commit: 7d27e3acebe5a23b93a0eea3739107838804be8a
Parents: 04a3fbf
Author: Anand Mazumdar <an...@apache.org>
Authored: Sun Jun 19 17:54:28 2016 -0700
Committer: Anand Mazumdar <an...@apache.org>
Committed: Sun Jun 19 17:54:28 2016 -0700

----------------------------------------------------------------------
 src/tests/http_fault_tolerance_tests.cpp | 30 +++-------------------
 src/tests/scheduler_tests.cpp            | 36 +++++++++------------------
 2 files changed, 16 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7d27e3ac/src/tests/http_fault_tolerance_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/http_fault_tolerance_tests.cpp 
b/src/tests/http_fault_tolerance_tests.cpp
index 6cba0c6..4dfe9b3 100644
--- a/src/tests/http_fault_tolerance_tests.cpp
+++ b/src/tests/http_fault_tolerance_tests.cpp
@@ -109,8 +109,7 @@ TEST_F(HttpFaultToleranceTest, 
SchedulerSubscribeAfterFailoverTimeout)
 
     Future<Nothing> connected;
     EXPECT_CALL(*scheduler, connected(_))
-      .WillOnce(FutureSatisfy(&connected))
-      .WillRepeatedly(Return()); // Ignore future invocations.
+      .WillOnce(FutureSatisfy(&connected));
 
     scheduler::TestV1Mesos schedulerLibrary(
         master.get()->pid, contentType, scheduler);
@@ -430,8 +429,7 @@ TEST_F(HttpFaultToleranceTest, 
SchedulerFailoverStatusUpdate)
 
   Future<Nothing> connected2;
   EXPECT_CALL(*scheduler2, connected(_))
-    .WillOnce(FutureSatisfy(&connected2))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected2));
 
   // Failover to another scheduler instance.
   scheduler::TestV1Mesos schedulerLibrary2(
@@ -492,12 +490,6 @@ TEST_F(HttpFaultToleranceTest, 
SchedulerFailoverStatusUpdate)
 
   EXPECT_CALL(*executor, disconnected(_))
     .Times(AtMost(1));
-
-  EXPECT_CALL(*scheduler, disconnected(_))
-    .Times(AtMost(1));
-
-  EXPECT_CALL(*scheduler2, disconnected(_))
-    .Times(AtMost(1));
 }
 
 
@@ -599,8 +591,7 @@ TEST_F(HttpFaultToleranceTest, 
SchedulerFailoverExecutorToFrameworkMessage)
 
   Future<Nothing> connected2;
   EXPECT_CALL(*scheduler2, connected(_))
-    .WillOnce(FutureSatisfy(&connected2))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected2));
 
   // Failover to another scheduler instance.
   scheduler::TestV1Mesos schedulerLibrary2(
@@ -667,12 +658,6 @@ TEST_F(HttpFaultToleranceTest, 
SchedulerFailoverExecutorToFrameworkMessage)
 
   EXPECT_CALL(*executor, disconnected(_))
     .Times(AtMost(1));
-
-  EXPECT_CALL(*scheduler, disconnected(_))
-    .Times(AtMost(1));
-
-  EXPECT_CALL(*scheduler2, disconnected(_))
-    .Times(AtMost(1));
 }
 
 
@@ -772,8 +757,7 @@ TEST_F(HttpFaultToleranceTest, 
SchedulerFailoverFrameworkToExecutorMessage)
 
   Future<Nothing> connected2;
   EXPECT_CALL(*scheduler2, connected(_))
-    .WillOnce(FutureSatisfy(&connected2))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected2));
 
   // Failover to another scheduler instance.
   scheduler::TestV1Mesos schedulerLibrary2(
@@ -840,12 +824,6 @@ TEST_F(HttpFaultToleranceTest, 
SchedulerFailoverFrameworkToExecutorMessage)
 
   EXPECT_CALL(*executor, disconnected(_))
     .Times(AtMost(1));
-
-  EXPECT_CALL(*scheduler, disconnected(_))
-    .Times(AtMost(1));
-
-  EXPECT_CALL(*scheduler2, disconnected(_))
-    .Times(AtMost(1));
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/7d27e3ac/src/tests/scheduler_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/scheduler_tests.cpp b/src/tests/scheduler_tests.cpp
index e890c21..ccd0f2f 100644
--- a/src/tests/scheduler_tests.cpp
+++ b/src/tests/scheduler_tests.cpp
@@ -110,8 +110,7 @@ TEST_P(SchedulerTest, Subscribe)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 
@@ -187,8 +186,7 @@ TEST_P(SchedulerTest, SchedulerFailover)
 
   Future<Nothing> connected2;
   EXPECT_CALL(*scheduler2, connected(_))
-    .WillOnce(FutureSatisfy(&connected2))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected2));
 
   // Failover to another scheduler instance.
   scheduler::TestV1Mesos mesos2(master.get()->pid, contentType, scheduler2);
@@ -287,8 +285,7 @@ TEST_P(SchedulerTest, MasterFailover)
 
   Future<Nothing> connected2;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected2))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected2));
 
   detector->appoint(master.get()->pid);
 
@@ -332,8 +329,7 @@ TEST_P(SchedulerTest, TaskRunning)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 
@@ -453,8 +449,7 @@ TEST_P(SchedulerTest, ReconcileTask)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 
@@ -579,8 +574,7 @@ TEST_P(SchedulerTest, KillTask)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 
@@ -722,8 +716,7 @@ TEST_P(SchedulerTest, ShutdownExecutor)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 
@@ -963,8 +956,7 @@ TEST_P(SchedulerTest, Decline)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 
@@ -1053,8 +1045,7 @@ TEST_P(SchedulerTest, Revive)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 
@@ -1149,8 +1140,7 @@ TEST_P(SchedulerTest, Suppress)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 
@@ -1266,8 +1256,7 @@ TEST_P(SchedulerTest, Message)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 
@@ -1382,8 +1371,7 @@ TEST_P(SchedulerTest, Request)
 
   Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
+    .WillOnce(FutureSatisfy(&connected));
 
   ContentType contentType = GetParam();
 

Reply via email to