Speeded up OversubscriptionTest.RemoveCapabilitiesOnSchedulerFailover.

Advance the clock to trigger a batch allocation instantly.

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


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

Branch: refs/heads/master
Commit: f350dbb61368947885989fdf955d45fe7770b381
Parents: 30483d9
Author: haosdent huang <haosd...@gmail.com>
Authored: Tue Apr 12 15:07:24 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Tue Apr 12 17:01:45 2016 +0200

----------------------------------------------------------------------
 src/tests/oversubscription_tests.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f350dbb6/src/tests/oversubscription_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/oversubscription_tests.cpp 
b/src/tests/oversubscription_tests.cpp
index aa623e8..07c6658 100644
--- a/src/tests/oversubscription_tests.cpp
+++ b/src/tests/oversubscription_tests.cpp
@@ -1034,7 +1034,8 @@ TEST_F(OversubscriptionTest, 
UpdateAllocatorOnSchedulerFailover)
 TEST_F(OversubscriptionTest, RemoveCapabilitiesOnSchedulerFailover)
 {
   // Start the master.
-  Try<Owned<cluster::Master>> master = StartMaster();
+  master::Flags masterFlags = MesosTest::CreateMasterFlags();
+  Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
   // Start the slave with mock executor and test resource estimator.
@@ -1124,6 +1125,12 @@ TEST_F(OversubscriptionTest, 
RemoveCapabilitiesOnSchedulerFailover)
 
   driver2.start();
 
+  // Ensure resources are be recovered before a batch allocation is triggered.
+  Clock::pause();
+  Clock::settle();
+  Clock::advance(masterFlags.allocation_interval);
+  Clock::resume();
+
   AWAIT_READY(offers3);
   EXPECT_NE(0u, offers3.get().size());
   EXPECT_TRUE(Resources(offers3.get()[0].resources()).revocable().empty());

Reply via email to