Speeded up SchedulerTest.Decline. Advance the clock to trigger a batch allocation instantly.
Review: https://reviews.apache.org/r/43321/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a326e71b Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a326e71b Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a326e71b Branch: refs/heads/master Commit: a326e71b77bac3e243ec341addf71c984da57301 Parents: 29b4267 Author: Shuai Lin <linshuai2...@gmail.com> Authored: Tue Apr 12 16:13:19 2016 +0200 Committer: Alexander Rukletsov <al...@apache.org> Committed: Tue Apr 12 17:01:45 2016 +0200 ---------------------------------------------------------------------- src/tests/scheduler_tests.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/a326e71b/src/tests/scheduler_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/scheduler_tests.cpp b/src/tests/scheduler_tests.cpp index 7956da3..b630944 100644 --- a/src/tests/scheduler_tests.cpp +++ b/src/tests/scheduler_tests.cpp @@ -1041,6 +1041,9 @@ TEST_P(SchedulerTest, Decline) EXPECT_CALL(*scheduler, offers(_, _)) .WillOnce(FutureArg<1>(&offers2)); + Future<Nothing> recoverResources = + FUTURE_DISPATCH(_, &MesosAllocatorProcess::recoverResources); + { Call call; call.mutable_framework_id()->CopyFrom(frameworkId); @@ -1057,6 +1060,13 @@ TEST_P(SchedulerTest, Decline) mesos.send(call); } + // Make sure the dispatch event for `recoverResources` has been enqueued. + AWAIT_READY(recoverResources); + + Clock::pause(); + Clock::advance(flags.allocation_interval); + Clock::resume(); + // If the resources were properly declined, the scheduler should // get another offer with same amount of resources. AWAIT_READY(offers2);