Repository: mesos Updated Branches: refs/heads/master 3b4f7de7e -> 89b43e003
Renamed agent used resources to `allocation` in benchmark tests. Review: https://reviews.apache.org/r/50695/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/89b43e00 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/89b43e00 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/89b43e00 Branch: refs/heads/master Commit: 89b43e003d75cdd28c55ea228d8dabec3ceb7000 Parents: 3b4f7de Author: Guangya Liu <gyliu...@gmail.com> Authored: Thu Sep 8 22:26:34 2016 -0700 Committer: Jiang Yan Xu <xuj...@apple.com> Committed: Thu Sep 8 22:34:39 2016 -0700 ---------------------------------------------------------------------- src/tests/hierarchical_allocator_tests.cpp | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/89b43e00/src/tests/hierarchical_allocator_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp index b217921..a2c0360 100644 --- a/src/tests/hierarchical_allocator_tests.cpp +++ b/src/tests/hierarchical_allocator_tests.cpp @@ -3534,7 +3534,9 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, AddAndUpdateSlave) cout << "Added " << frameworkCount << " frameworks" << " in " << watch.elapsed() << endl; - const Resources slaveResources = Resources::parse( + // Each agent has a portion of it's resources allocated to a single + // framework. We round-robin through the frameworks when allocating. + const Resources allocation = Resources::parse( "cpus:1;mem:128;disk:1024;" "ports:[31126-31510,31512-31623,31810-31852,31854-31964]").get(); @@ -3545,7 +3547,7 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, AddAndUpdateSlave) for (size_t i = 0; i < slaves.size(); i++) { hashmap<FrameworkID, Resources> used; - used[frameworks[i % frameworkCount].id()] = slaveResources; + used[frameworks[i % frameworkCount].id()] = allocation; allocator->addSlave( slaves[i].id(), @@ -3645,14 +3647,15 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, DeclineOffers) const Resources agentResources = Resources::parse( "cpus:24;mem:4096;disk:4096;ports:[31000-32000]").get(); - Resources resources = Resources::parse( - "cpus:16;mem:2014;disk:1024").get(); + // Each agent has a portion of it's resources allocated to a single + // framework. We round-robin through the frameworks when allocating. + Resources allocation = Resources::parse("cpus:16;mem:2014;disk:1024").get(); Try<::mesos::Value::Ranges> ranges = fragment(createRange(31000, 32000), 16); ASSERT_SOME(ranges); ASSERT_EQ(16, ranges->range_size()); - resources += createPorts(ranges.get()); + allocation += createPorts(ranges.get()); watch.start(); @@ -3662,7 +3665,7 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, DeclineOffers) // Add some used resources on each slave. Let's say there are 16 tasks, each // is allocated 1 cpu and a random port from the port range. hashmap<FrameworkID, Resources> used; - used[frameworks[i % frameworkCount].id()] = resources; + used[frameworks[i % frameworkCount].id()] = allocation; allocator->addSlave( slaves[i].id(), slaves[i], None(), slaves[i].resources(), used); } @@ -3794,21 +3797,19 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, ResourceLabels) // worst-case for the equality operator. We also ensure that the // labels at any two nodes are distinct, which means they can't be // aggregated easily by the master/allocator. - Resources resources = Resources::parse("mem:2014;disk:1024").get(); + Resources allocation = Resources::parse("mem:2014;disk:1024").get(); Try<::mesos::Value::Ranges> ranges = fragment(createRange(31000, 32000), 16); ASSERT_SOME(ranges); ASSERT_EQ(16, ranges->range_size()); - resources += createPorts(ranges.get()); + allocation += createPorts(ranges.get()); watch.start(); for (size_t i = 0; i < slaveCount; i++) { slaves.push_back(createSlaveInfo(agentResources)); - Resources agentResources = resources; - // We create reservations with 12 labels as we expect this is // more than most frameworks use. Note that only the 12th // label differs between the two sets of labels as this triggers @@ -3836,13 +3837,12 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, ResourceLabels) createReservedResource("cpus", "8", "role1", createReservationInfo("principal1", labels2)); - agentResources += reserved1; - agentResources += reserved2; + Resources _allocation = allocation + reserved1 + reserved2; // Add some used resources on each slave. Let's say there are 16 tasks, each // is allocated 1 cpu and a random port from the port range. hashmap<FrameworkID, Resources> used; - used[frameworks[i % frameworkCount].id()] = agentResources; + used[frameworks[i % frameworkCount].id()] = _allocation; allocator->addSlave( slaves[i].id(), slaves[i], None(), slaves[i].resources(), used); }