You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2015/12/09 07:10:05 UTC

[1/2] mesos git commit: Fixed flakiness in `ReservationTest.ACLMultipleOperations`.

Repository: mesos
Updated Branches:
  refs/heads/master 01a5ebef6 -> c08bd5d7e


Fixed flakiness in `ReservationTest.ACLMultipleOperations`.

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


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

Branch: refs/heads/master
Commit: 48f18e64d4c4a1c220cb8ca78179bddeeebe4dec
Parents: 01a5ebe
Author: Greg Mann <gr...@mesosphere.io>
Authored: Wed Dec 9 01:04:04 2015 -0500
Committer: Michael Park <mp...@apache.org>
Committed: Wed Dec 9 01:04:04 2015 -0500

----------------------------------------------------------------------
 src/tests/reservation_tests.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/48f18e64/src/tests/reservation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_tests.cpp b/src/tests/reservation_tests.cpp
index eccbb8f..f455790 100644
--- a/src/tests/reservation_tests.cpp
+++ b/src/tests/reservation_tests.cpp
@@ -1534,6 +1534,10 @@ TEST_F(ReservationTest, BadACLDropUnreserve)
 // `LAUNCH` offer operations to verify that they work with authorization.
 TEST_F(ReservationTest, ACLMultipleOperations)
 {
+  // Pause the clock and control it manually in order to
+  // control the timing of the offer cycle.
+  process::Clock::pause();
+
   ACLs acls;
 
   // This principal can reserve any resources.
@@ -1596,6 +1600,10 @@ TEST_F(ReservationTest, ACLMultipleOperations)
 
   driver.start();
 
+  // Advance the clock to generate an offer.
+  process::Clock::settle();
+  process::Clock::advance(masterFlags.allocation_interval);
+
   // In the first offer, expect an offer with unreserved resources.
   AWAIT_READY(offers);
 
@@ -1612,6 +1620,9 @@ TEST_F(ReservationTest, ACLMultipleOperations)
   // Reserve the first set of resources.
   driver.acceptOffers({offer.id()}, {RESERVE(dynamicallyReserved1)}, filters);
 
+  process::Clock::settle();
+  process::Clock::advance(masterFlags.allocation_interval);
+
   // In the next offer, expect an offer with reserved resources.
   AWAIT_READY(offers);
 
@@ -1655,6 +1666,9 @@ TEST_F(ReservationTest, ACLMultipleOperations)
   AWAIT_READY(statusUpdateAcknowledgement);
   EXPECT_EQ(TASK_FINISHED, statusUpdateAcknowledgement.get().state());
 
+  process::Clock::settle();
+  process::Clock::advance(masterFlags.allocation_interval);
+
   // In the next offer, expect to find both sets of reserved
   // resources, since the Unreserve operation should fail.
   AWAIT_READY(offers);
@@ -1688,6 +1702,9 @@ TEST_F(ReservationTest, ACLMultipleOperations)
        LAUNCH({taskInfo})},
       filters);
 
+  process::Clock::settle();
+  process::Clock::advance(masterFlags.allocation_interval);
+
   // In the next offer, expect to find no reserved resources.
   AWAIT_READY(offers);
 


[2/2] mesos git commit: Shortened `allocation_interval` from 50ms to 5ms in `ReservationTest`s to help expose potential race conditions.

Posted by mp...@apache.org.
Shortened `allocation_interval` from 50ms to 5ms in `ReservationTest`s
to help expose potential race conditions.

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


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

Branch: refs/heads/master
Commit: c08bd5d7edf10078cd22d29fd9fd46d8e1b21b13
Parents: 48f18e6
Author: Greg Mann <gr...@mesosphere.io>
Authored: Wed Dec 9 01:04:15 2015 -0500
Committer: Michael Park <mp...@apache.org>
Committed: Wed Dec 9 01:04:16 2015 -0500

----------------------------------------------------------------------
 src/tests/reservation_tests.cpp | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c08bd5d7/src/tests/reservation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_tests.cpp b/src/tests/reservation_tests.cpp
index f455790..3405b47 100644
--- a/src/tests/reservation_tests.cpp
+++ b/src/tests/reservation_tests.cpp
@@ -82,7 +82,7 @@ TEST_F(ReservationTest, ReserveThenUnreserve)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -177,7 +177,7 @@ TEST_F(ReservationTest, ReserveAndLaunchThenUnreserve)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -294,7 +294,7 @@ TEST_F(ReservationTest, ReserveShareWithinRole)
   frameworkInfo2.set_role(role);
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = role;
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -403,7 +403,7 @@ TEST_F(ReservationTest, DropReserveTooLarge)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   EXPECT_CALL(allocator, initialize(_, _, _, _));
@@ -494,7 +494,7 @@ TEST_F(ReservationTest, DropReserveStaticReservation)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   EXPECT_CALL(allocator, initialize(_, _, _, _));
@@ -583,7 +583,7 @@ TEST_F(ReservationTest, SendingCheckpointResourcesMessage)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -683,7 +683,7 @@ TEST_F(ReservationTest, ResourcesCheckpointing)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -774,7 +774,7 @@ TEST_F(ReservationTest, MasterFailover)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master1 = StartMaster(masterFlags);
@@ -889,7 +889,7 @@ TEST_F(ReservationTest, CompatibleCheckpointedResources)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -995,7 +995,7 @@ TEST_F(ReservationTest, CompatibleCheckpointedResourcesWithPersistentVolumes)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -1120,7 +1120,7 @@ TEST_F(ReservationTest, IncompatibleCheckpointedResources)
   frameworkInfo.set_role("role");
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -1238,7 +1238,7 @@ TEST_F(ReservationTest, GoodACLReserveThenUnreserve)
   // Create a master.
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -1338,7 +1338,7 @@ TEST_F(ReservationTest, BadACLDropReserve)
   // Create a master.
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -1429,7 +1429,7 @@ TEST_F(ReservationTest, BadACLDropUnreserve)
   // Create a master.
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);
@@ -1556,7 +1556,7 @@ TEST_F(ReservationTest, ACLMultipleOperations)
   // Create a master.
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
-  masterFlags.allocation_interval = Milliseconds(50);
+  masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
   Try<PID<Master>> master = StartMaster(masterFlags);