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

[2/3] mesos git commit: Fixed race in persistent volume tests.

Fixed race in persistent volume tests.

Fixed race in persistent volume tests. This race occurred because
`scheduelerDriver.reviveOffers` will trigger an offer immediately, while
the tests originally assumed that settling and advancing the clock after
reviving was necessary to produce an offer.

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


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

Branch: refs/heads/master
Commit: a6d4fdc2a41dba4f250a6924a7a64664c25aec96
Parents: 85ddad4
Author: Greg Mann <gr...@mesosphere.io>
Authored: Thu Jan 7 13:34:41 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Jan 7 13:34:41 2016 -0800

----------------------------------------------------------------------
 src/tests/persistent_volume_tests.cpp | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a6d4fdc2/src/tests/persistent_volume_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/persistent_volume_tests.cpp b/src/tests/persistent_volume_tests.cpp
index 2fb5781..0a9a2bb 100644
--- a/src/tests/persistent_volume_tests.cpp
+++ b/src/tests/persistent_volume_tests.cpp
@@ -1196,19 +1196,17 @@ TEST_F(PersistentVolumeTest, BadACLNoPrincipal)
   // Check that the persistent volume is contained in this offer.
   EXPECT_TRUE(Resources(offer.resources()).contains(volume));
 
-  // Decline, suppress, and revive offers appropriately so that `driver1` can
-  // receive an offer.
+  // Decline and suppress offers to `driver2` so that
+  // `driver1` can receive an offer.
   driver2.declineOffer(offer.id(), filters);
   driver2.suppressOffers();
-  driver1.reviveOffers();
 
-  // Expect an offer to the first framework.
   EXPECT_CALL(sched1, resourceOffers(&driver1, _))
     .WillOnce(FutureArg<1>(&offers));
 
-  // Advance the clock to generate an offer.
-  Clock::settle();
-  Clock::advance(masterFlags.allocation_interval);
+  // Revive offers to `driver1`. Settling and advancing the clock after this is
+  // unnecessary, since calling `reviveOffers` triggers an offer.
+  driver1.reviveOffers();
 
   AWAIT_READY(offers);
   EXPECT_FALSE(offers.get().empty());
@@ -1394,19 +1392,17 @@ TEST_F(PersistentVolumeTest, BadACLDropCreateAndDestroy)
   // Check that the persistent volume is contained in this offer.
   EXPECT_TRUE(Resources(offer.resources()).contains(volume));
 
-  // Decline, suppress, and revive offers appropriately so that `driver1` can
-  // receive an offer.
+  // Decline and suppress offers to `driver2` so that
+  // `driver1` can receive an offer.
   driver2.declineOffer(offer.id(), filters);
   driver2.suppressOffers();
-  driver1.reviveOffers();
 
-  // Expect an offer to the first framework.
   EXPECT_CALL(sched1, resourceOffers(&driver1, _))
     .WillOnce(FutureArg<1>(&offers));
 
-  // Advance the clock to generate an offer.
-  Clock::settle();
-  Clock::advance(masterFlags.allocation_interval);
+  // Revive offers to `driver1`. Settling and advancing the clock after this is
+  // unnecessary, since calling `reviveOffers` triggers an offer.
+  driver1.reviveOffers();
 
   AWAIT_READY(offers);
   EXPECT_FALSE(offers.get().empty());