You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/07/29 11:05:37 UTC

mesos git commit: Avoided a GMock warning in a reservation test case.

Repository: mesos
Updated Branches:
  refs/heads/master 5cd68da38 -> 743005c89


Avoided a GMock warning in a reservation test case.

Depending on timing, the master might rescind an offer, which causes a
GMock warning. It is better to wait for the offer and then wait for it
to be rescinded.

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


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

Branch: refs/heads/master
Commit: 743005c89ce25a5f4ef35a5e154895c5f1de4d08
Parents: 5cd68da
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Jul 29 12:42:07 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Fri Jul 29 12:45:43 2016 +0200

----------------------------------------------------------------------
 src/tests/reservation_tests.cpp | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/743005c8/src/tests/reservation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_tests.cpp b/src/tests/reservation_tests.cpp
index 26bd762..6181c6f 100644
--- a/src/tests/reservation_tests.cpp
+++ b/src/tests/reservation_tests.cpp
@@ -1146,8 +1146,7 @@ TEST_F(ReservationTest, CompatibleCheckpointedResourcesWithPersistentVolumes)
   EXPECT_CALL(sched, registered(&driver, _, _));
 
   EXPECT_CALL(sched, resourceOffers(&driver, _))
-    .WillOnce(FutureArg<1>(&offers))
-    .WillRepeatedly(Return()); // Ignore subsequent offers.
+    .WillOnce(FutureArg<1>(&offers));
 
   driver.start();
 
@@ -1170,6 +1169,10 @@ TEST_F(ReservationTest, CompatibleCheckpointedResourcesWithPersistentVolumes)
   Filters filters;
   filters.set_refuse_seconds(0);
 
+  EXPECT_CALL(sched, resourceOffers(&driver, _))
+    .WillOnce(FutureArg<1>(&offers))
+    .WillRepeatedly(Return()); // Ignore subsequent offers.
+
   // Reserve the resources and create the volume.
   driver.acceptOffers(
       {offer.id()},
@@ -1184,9 +1187,25 @@ TEST_F(ReservationTest, CompatibleCheckpointedResourcesWithPersistentVolumes)
   AWAIT_READY(message2);
   EXPECT_EQ(Resources(message2.get().resources()), reserved + volume);
 
+  // Expect an offer containing the volume.
+  AWAIT_READY(offers);
+
+  ASSERT_EQ(1u, offers.get().size());
+  offer = offers.get()[0];
+
+  EXPECT_TRUE(Resources(offer.resources()).contains(reserved + volume));
+
+  Future<OfferID> rescindedOfferId;
+
+  EXPECT_CALL(sched, offerRescinded(&driver, _))
+    .WillOnce(FutureArg<1>(&rescindedOfferId));
+
   terminate(slave1);
   wait(slave1);
 
+  AWAIT_READY(rescindedOfferId);
+  EXPECT_EQ(rescindedOfferId.get(), offer.id());
+
   // Simulate a reboot of the slave machine by modifying the boot ID.
   ASSERT_SOME(os::write(slave::paths::getBootIdPath(
       slave::paths::getMetaRootDir(slaveFlags.work_dir)),