You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/07/19 22:50:47 UTC

[1/2] mesos git commit: Speed up reservation test by lowering allocation interval.

Repository: mesos
Updated Branches:
  refs/heads/master b43bb4fea -> dc4a4ae9b


Speed up reservation test by lowering allocation interval.

ReserveResource test (and UnreserveResource test) in v1 operator
API is very slow, taking more than 1000 ms. If we set allocation
interval in master flag to 50ms and use that flag to start up a
master to use in the test, we can reduce the duration of that test
to as low as 120 ms. So, in this patch we made that change.

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


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

Branch: refs/heads/master
Commit: 716108d76b0741dede2167165927a183db548640
Parents: b43bb4f
Author: Abhishek Dasgupta <a1...@linux.vnet.ibm.com>
Authored: Tue Jul 19 15:47:23 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Jul 19 15:50:36 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/mesos/blob/716108d7/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index b4bee76..0a3623a 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -92,6 +92,14 @@ class MasterAPITest
     public WithParamInterface<ContentType>
 {
 public:
+  virtual master::Flags CreateMasterFlags()
+  {
+    // Set a low allocation interval to speed up tests.
+    master::Flags flags = MesosTest::CreateMasterFlags();
+    flags.allocation_interval = Milliseconds(50);
+    return flags;
+  }
+
   // Helper function to post a request to "/api/v1" master endpoint and return
   // the response.
   Future<v1::master::Response> post(


[2/2] mesos git commit: Improved the speed of 'MasterAPITest.UnreserveResources'.

Posted by vi...@apache.org.
Improved the speed of 'MasterAPITest.UnreserveResources'.

In this patch, speed of 'MasterAPITest.UnreserveResources'
is increased by removing the unnecessary check for unreserved
resources which is already verified in
'MasterAPITest.ReserveResources'. This removes the
delay for waiting for the resource offers to be declined.

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


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

Branch: refs/heads/master
Commit: dc4a4ae9b264e66ff891c6b00181d8d501514642
Parents: 716108d
Author: Abhishek Dasgupta <a1...@linux.vnet.ibm.com>
Authored: Tue Jul 19 15:48:17 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Jul 19 15:50:38 2016 -0700

----------------------------------------------------------------------
 src/tests/api_tests.cpp | 43 +++++++++++++++----------------------------
 1 file changed, 15 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dc4a4ae9/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index 0a3623a..d20b999 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -1047,32 +1047,6 @@ TEST_P(MasterAPITest, UnreserveResources)
       frameworkInfo.role(),
       createReservationInfo(DEFAULT_CREDENTIAL.principal()));
 
-  MockScheduler sched;
-  MesosSchedulerDriver driver(
-      &sched, frameworkInfo, master.get()->pid, DEFAULT_CREDENTIAL);
-
-  Future<vector<Offer>> offers;
-
-  EXPECT_CALL(sched, registered(&driver, _, _));
-
-  EXPECT_CALL(sched, resourceOffers(&driver, _))
-    .WillOnce(FutureArg<1>(&offers));
-
-  driver.start();
-
-  AWAIT_READY(offers);
-
-  ASSERT_EQ(1u, offers->size());
-  Offer offer = offers.get()[0];
-
-  EXPECT_TRUE(Resources(offer.resources()).contains(unreserved));
-
-  EXPECT_CALL(sched, resourceOffers(&driver, _))
-    .WillOnce(FutureArg<1>(&offers));
-
-  // Expect an offer to be rescinded!
-  EXPECT_CALL(sched, offerRescinded(_, _));
-
   v1::master::Call v1Call;
   v1Call.set_type(v1::master::Call::RESERVE_RESOURCES);
 
@@ -1097,10 +1071,23 @@ TEST_P(MasterAPITest, UnreserveResources)
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(Accepted().status, reserveResponse);
 
+  MockScheduler sched;
+  MesosSchedulerDriver driver(
+      &sched, frameworkInfo, master.get()->pid, DEFAULT_CREDENTIAL);
+
+  Future<vector<Offer>> offers;
+
+  EXPECT_CALL(sched, registered(&driver, _, _));
+
+  EXPECT_CALL(sched, resourceOffers(&driver, _))
+    .WillOnce(FutureArg<1>(&offers));
+
+  driver.start();
+
   AWAIT_READY(offers);
 
   ASSERT_EQ(1u, offers->size());
-  offer = offers.get()[0];
+  Offer offer = offers.get()[0];
 
   EXPECT_TRUE(Resources(offer.resources()).contains(dynamicallyReserved));
 
@@ -1110,7 +1097,6 @@ TEST_P(MasterAPITest, UnreserveResources)
   // Expect an offer to be rescinded!
   EXPECT_CALL(sched, offerRescinded(_, _));
 
-  // Unreserve the resources.
   v1Call.set_type(v1::master::Call::UNRESERVE_RESOURCES);
 
   v1::master::Call::UnreserveResources* unreserveResources =
@@ -1137,6 +1123,7 @@ TEST_P(MasterAPITest, UnreserveResources)
   ASSERT_EQ(1u, offers->size());
   offer = offers.get()[0];
 
+  // Verifies if the resources are unreserved.
   EXPECT_TRUE(Resources(offer.resources()).contains(unreserved));
 
   driver.stop();