You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/04/12 17:10:26 UTC
[03/10] mesos git commit: Speeded up
MasterTest.LaunchCombinedOfferTest.
Speeded up MasterTest.LaunchCombinedOfferTest.
Advance the clock to trigger a batch allocation instantly.
Review: https://reviews.apache.org/r/43516/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b7770c6e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b7770c6e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b7770c6e
Branch: refs/heads/master
Commit: b7770c6e161fa013fb321e4b054c7250f83c8456
Parents: f9a068d
Author: haosdent huang <ha...@gmail.com>
Authored: Tue Apr 12 14:53:07 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Tue Apr 12 14:58:26 2016 +0200
----------------------------------------------------------------------
src/tests/master_tests.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/b7770c6e/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 09fb9ff..ff9fa0e 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -1212,7 +1212,8 @@ TEST_F(MasterTest, MasterLost)
// all slave resources and a single task should be able to run on these.
TEST_F(MasterTest, LaunchCombinedOfferTest)
{
- Try<Owned<cluster::Master>> master = StartMaster();
+ master::Flags masterFlags = CreateMasterFlags();
+ Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
MockExecutor exec(DEFAULT_EXECUTOR_ID);
@@ -1280,6 +1281,11 @@ TEST_F(MasterTest, LaunchCombinedOfferTest)
AWAIT_READY(status1);
EXPECT_EQ(TASK_RUNNING, status1.get().state());
+ // Advance the clock and trigger a batch allocation.
+ Clock::pause();
+ Clock::advance(masterFlags.allocation_interval);
+ Clock::resume();
+
// Await 2nd offer.
AWAIT_READY(offers2);
EXPECT_NE(0u, offers2.get().size());
@@ -1307,6 +1313,11 @@ TEST_F(MasterTest, LaunchCombinedOfferTest)
AWAIT_READY(status2);
EXPECT_EQ(TASK_KILLED, status2.get().state());
+ // Advance the clock and trigger a batch allocation.
+ Clock::pause();
+ Clock::advance(masterFlags.allocation_interval);
+ Clock::resume();
+
// Await 3rd offer - 2nd and 3rd offer to same slave are now ready.
AWAIT_READY(offers3);
EXPECT_NE(0u, offers3.get().size());