You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ne...@apache.org on 2017/05/08 16:40:40 UTC

mesos git commit: Fixed flakiness in HierarchicalAllocatorTest.NestedRoleDRF.

Repository: mesos
Updated Branches:
  refs/heads/master 18220a50d -> 3c8b7afa9


Fixed flakiness in HierarchicalAllocatorTest.NestedRoleDRF.

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


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

Branch: refs/heads/master
Commit: 3c8b7afa99834086834e5614f7077fcc0d0159e3
Parents: 18220a5
Author: Neil Conway <ne...@gmail.com>
Authored: Fri May 5 17:47:00 2017 -0700
Committer: Neil Conway <ne...@gmail.com>
Committed: Mon May 8 09:40:22 2017 -0700

----------------------------------------------------------------------
 src/tests/hierarchical_allocator_tests.cpp | 35 +++++++++++++------------
 1 file changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3c8b7afa/src/tests/hierarchical_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp
index 33d5c0e..08180b9 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -742,11 +742,18 @@ TEST_F(HierarchicalAllocatorTest, NestedRoleDRF)
   //   a/b share = 1 (cpus=2, mem=1024)
   //     framework1 share = 1
 
-  // Add a new slave, along with two new frameworks in roles "a/c" and
-  // "d/e". We expect the new slave's resources to be offered to "d/e"
-  // rather than "a/c", since the role subtree under "a" has more
-  // resources than the "d" subtree.
+  // Add two new frameworks in roles "a/c" and "d/e".
+  FrameworkInfo framework2 = createFrameworkInfo({"a/c"});
+  allocator->addFramework(framework2.id(), framework2, {}, true);
+
+  FrameworkInfo framework3 = createFrameworkInfo({"d/e"});
+  allocator->addFramework(framework3.id(), framework3, {}, true);
 
+  // Add a new slave. The new slave's resources should be offered to
+  // the framework in role "d/e" rather than the framework in role
+  // "a/c", since the role subtree under "a" has more resources than
+  // the "d" subtree.
+  //
   // Total cluster resources will become cpus=3, mem=1536.
   SlaveInfo slave2 = createSlaveInfo("cpus:1;mem:512;disk:0");
   allocator->addSlave(
@@ -757,12 +764,6 @@ TEST_F(HierarchicalAllocatorTest, NestedRoleDRF)
       slave2.resources(),
       {});
 
-  FrameworkInfo framework2 = createFrameworkInfo({"a/c"});
-  allocator->addFramework(framework2.id(), framework2, {}, true);
-
-  FrameworkInfo framework3 = createFrameworkInfo({"d/e"});
-  allocator->addFramework(framework3.id(), framework3, {}, true);
-
   {
     Allocation expected = Allocation(
         framework3.id(),
@@ -780,11 +781,14 @@ TEST_F(HierarchicalAllocatorTest, NestedRoleDRF)
   //   d/e share = 0.333333 (cpus=1, mem=512)
   //     framework3 share = 1
 
-  // Add a new slave and a new framework in the role "d/f". The new
-  // slave's resources should be allocated to the new framework (and
-  // not the framework in "a/c"), because the "d" subtree has fewer
-  // allocated resources than the "a" subtree.
+  // Add a new framework in the role "d/f".
+  FrameworkInfo framework4 = createFrameworkInfo({"d/f"});
+  allocator->addFramework(framework4.id(), framework4, {}, true);
 
+  // Add a new slave. The new slave's resources should be allocated to
+  // the framework in "d/f" (and not the framework in "a/c"), because the
+  // "d" subtree has fewer allocated resources than the "a" subtree.
+  //
   // Total cluster resources will become cpus=5, mem=2560.
   SlaveInfo slave3 = createSlaveInfo("cpus:2;mem:1024;disk:0");
   allocator->addSlave(
@@ -795,9 +799,6 @@ TEST_F(HierarchicalAllocatorTest, NestedRoleDRF)
       slave3.resources(),
       {});
 
-  FrameworkInfo framework4 = createFrameworkInfo({"d/f"});
-  allocator->addFramework(framework4.id(), framework4, {}, true);
-
   {
     Allocation expected = Allocation(
         framework4.id(),