Speeded up OversubscriptionTest.UpdateAllocatorOnSchedulerFailover. Advance the clock to trigger a batch allocation instantly.
Review: https://reviews.apache.org/r/43521/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/30483d90 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/30483d90 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/30483d90 Branch: refs/heads/master Commit: 30483d9011fc0a8e9a94a20beb994266e1fcd90a Parents: 424b105 Author: haosdent huang <haosd...@gmail.com> Authored: Tue Apr 12 15:02:27 2016 +0200 Committer: Alexander Rukletsov <al...@apache.org> Committed: Tue Apr 12 15:06:19 2016 +0200 ---------------------------------------------------------------------- src/tests/oversubscription_tests.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/30483d90/src/tests/oversubscription_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/oversubscription_tests.cpp b/src/tests/oversubscription_tests.cpp index 2367174..aa623e8 100644 --- a/src/tests/oversubscription_tests.cpp +++ b/src/tests/oversubscription_tests.cpp @@ -912,7 +912,8 @@ TEST_F(OversubscriptionTest, QoSCorrectionKill) // 5. Check if revocable offers are being sent to the framework. TEST_F(OversubscriptionTest, UpdateAllocatorOnSchedulerFailover) { - Try<Owned<cluster::Master>> master = StartMaster(); + master::Flags masterFlags = MesosTest::CreateMasterFlags(); + Try<Owned<cluster::Master>> master = StartMaster(masterFlags); ASSERT_SOME(master); MockExecutor exec(DEFAULT_EXECUTOR_ID); @@ -996,14 +997,19 @@ TEST_F(OversubscriptionTest, UpdateAllocatorOnSchedulerFailover) driver2.start(); - AWAIT_READY(offers1); - EXPECT_NE(0u, offers1.get().size()); - EXPECT_TRUE(Resources(offers1.get()[0].resources()).revocable().empty()); - AWAIT_READY(sched2Registered); AWAIT_READY(sched1Error); + // Advance the clock and trigger a batch allocation. + Clock::pause(); + Clock::advance(masterFlags.allocation_interval); + Clock::resume(); + + AWAIT_READY(offers1); + EXPECT_NE(0u, offers1.get().size()); + EXPECT_TRUE(Resources(offers1.get()[0].resources()).revocable().empty()); + // Check if framework receives revocable offers. Future<vector<Offer>> offers2; EXPECT_CALL(sched2, resourceOffers(&driver2, _))