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/13 12:13:49 UTC
[1/2] mesos git commit: Moved variable declarations closer to where
they are used.
Repository: mesos
Updated Branches:
refs/heads/master 656702960 -> c23932d57
Moved variable declarations closer to where they are used.
We usually declare related variables closer
to each other to increase code readability.
Review: https://reviews.apache.org/r/44335/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/69ab7520
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/69ab7520
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/69ab7520
Branch: refs/heads/master
Commit: 69ab7520bb6a89596ef7bd5afcfc7b7c619f5386
Parents: 6567029
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Wed Apr 13 12:08:42 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Wed Apr 13 12:08:42 2016 +0200
----------------------------------------------------------------------
src/tests/hierarchical_allocator_tests.cpp | 67 ++++++++-----------------
1 file changed, 21 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/69ab7520/src/tests/hierarchical_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp
index 03064da..2e56e85 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -490,11 +490,9 @@ TEST_F(HierarchicalAllocatorTest, OfferFilter)
initialize();
FrameworkInfo framework1 = createFrameworkInfo(ROLE);
-
- SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
-
allocator->addFramework(framework1.id(), framework1, {});
+ SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
allocator->addSlave(agent1.id(), agent1, None(), agent1.resources(), {});
// `framework1` will be offered all of `agent1` resources
@@ -575,14 +573,12 @@ TEST_F(HierarchicalAllocatorTest, SmallOfferFilterTimeout)
initialize(flags_);
FrameworkInfo framework1 = createFrameworkInfo(ROLE);
- FrameworkInfo framework2 = createFrameworkInfo(ROLE);
-
- SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
-
allocator->addFramework(framework1.id(), framework1, {});
+ FrameworkInfo framework2 = createFrameworkInfo(ROLE);
allocator->addFramework(framework2.id(), framework2, {});
+ SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
allocator->addSlave(
agent1.id(),
agent1,
@@ -1199,7 +1195,6 @@ TEST_F(HierarchicalAllocatorTest, UpdateSlave)
FrameworkInfo framework = createFrameworkInfo("role1");
framework.add_capabilities()->set_type(
FrameworkInfo::Capability::REVOCABLE_RESOURCES);
-
allocator->addFramework(framework.id(), framework, {});
// Initially, all the resources are allocated.
@@ -1287,7 +1282,6 @@ TEST_F(HierarchicalAllocatorTest, RecoverOversubscribedResources)
FrameworkInfo framework = createFrameworkInfo("role1");
framework.add_capabilities()->set_type(
FrameworkInfo::Capability::REVOCABLE_RESOURCES);
-
allocator->addFramework(framework.id(), framework, {});
// Initially, all the resources are allocated.
@@ -1511,22 +1505,16 @@ TEST_F(HierarchicalAllocatorTest, RemoveQuota)
initialize();
- // Create framework and agent descriptions.
- FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
- FrameworkInfo framework2 = createFrameworkInfo(NO_QUOTA_ROLE);
-
- SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
- SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:512;disk:0");
-
const Quota quota1 = createQuota(QUOTA_ROLE, "cpus:2;mem:1024");
-
- // Notify allocator of agents, frameworks, quota and current allocations.
allocator->setQuota(QUOTA_ROLE, quota1);
+ FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
allocator->addFramework(framework1.id(), framework1, {});
+ FrameworkInfo framework2 = createFrameworkInfo(NO_QUOTA_ROLE);
allocator->addFramework(framework2.id(), framework2, {});
+ SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
allocator->addSlave(
agent1.id(),
agent1,
@@ -1534,6 +1522,7 @@ TEST_F(HierarchicalAllocatorTest, RemoveQuota)
agent1.resources(),
{std::make_pair(framework1.id(), agent1.resources())});
+ SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:512;disk:0");
allocator->addSlave(
agent2.id(),
agent2,
@@ -1782,19 +1771,13 @@ TEST_F(HierarchicalAllocatorTest, DRFWithQuota)
initialize();
- // Create framework and agent descriptions.
- FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
- FrameworkInfo framework2 = createFrameworkInfo(NO_QUOTA_ROLE);
-
- SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
-
const Quota quota1 = createQuota(QUOTA_ROLE, "cpus:0.25;mem:128");
-
- // Notify allocator of agents, frameworks, quota and current allocations.
allocator->setQuota(QUOTA_ROLE, quota1);
+ FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
allocator->addFramework(framework1.id(), framework1, {});
+ FrameworkInfo framework2 = createFrameworkInfo(NO_QUOTA_ROLE);
allocator->addFramework(framework2.id(), framework2, {});
// Process all triggered allocation events.
@@ -1818,6 +1801,8 @@ TEST_F(HierarchicalAllocatorTest, DRFWithQuota)
"/guarantee";
EXPECT_EQ(128, metrics.values[metric]);
+ // Add an agent with some allocated resources.
+ SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
allocator->addSlave(
agent1.id(),
agent1,
@@ -1907,18 +1892,13 @@ TEST_F(HierarchicalAllocatorTest, QuotaAgainstStarvation)
initialize();
- // Create framework and agent descriptions.
FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
- FrameworkInfo framework2 = createFrameworkInfo(NO_QUOTA_ROLE);
-
- SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
- SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:512;disk:0");
-
- // Notify allocator of agents, frameworks, and current allocations.
allocator->addFramework(framework1.id(), framework1, {});
+ FrameworkInfo framework2 = createFrameworkInfo(NO_QUOTA_ROLE);
allocator->addFramework(framework2.id(), framework2, {});
+ SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
allocator->addSlave(
agent1.id(),
agent1,
@@ -1937,6 +1917,7 @@ TEST_F(HierarchicalAllocatorTest, QuotaAgainstStarvation)
// NO_QUOTA_ROLE share = 0
// framework2 share = 0
+ SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:512;disk:0");
allocator->addSlave(agent2.id(), agent2, None(), agent2.resources(), {});
// Free cluster resources on `agent2` will be allocated to `framework2`
@@ -2036,9 +2017,6 @@ TEST_F(HierarchicalAllocatorTest, QuotaAbsentFramework)
// NOTE: No allocations happen because there are no resources to allocate.
Clock::settle();
- SlaveInfo agent1 = createSlaveInfo("cpus:2;mem:1024;disk:0");
- SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:512;disk:0");
-
// Total cluster resources (0 agents): 0.
// QUOTA_ROLE share = 0 [quota: cpus=2, mem=1024]
// no frameworks
@@ -2050,7 +2028,10 @@ TEST_F(HierarchicalAllocatorTest, QuotaAbsentFramework)
// NOTE: The second event-based allocation for `agent2` takes into account
// that `agent1`'s resources are laid away for `QUOTA_ROLE`'s quota and
// hence freely allocates for the non-quota'ed `NO_QUOTA_ROLE` role.
+ SlaveInfo agent1 = createSlaveInfo("cpus:2;mem:1024;disk:0");
allocator->addSlave(agent1.id(), agent1, None(), agent1.resources(), {});
+
+ SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:512;disk:0");
allocator->addSlave(agent2.id(), agent2, None(), agent2.resources(), {});
// `framework` can only be allocated resources on `agent2`. This
@@ -2098,7 +2079,6 @@ TEST_F(HierarchicalAllocatorTest, MultiQuotaAbsentFrameworks)
initialize();
SlaveInfo agent = createSlaveInfo("cpus:2;mem:2048;disk:0");
-
allocator->addSlave(agent.id(), agent, None(), agent.resources(), {});
// Set quota for both roles.
@@ -2139,9 +2119,6 @@ TEST_F(HierarchicalAllocatorTest, MultiQuotaWithFrameworks)
initialize();
- SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:1024;disk:0");
- SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:1024;disk:0");
-
// Mem Quota for `QUOTA_ROLE1` is 10 times smaller than for `QUOTA_ROLE2`.
const Quota quota1 = createQuota(QUOTA_ROLE1, "cpus:1;mem:200");
allocator->setQuota(QUOTA_ROLE1, quota1);
@@ -2162,6 +2139,7 @@ TEST_F(HierarchicalAllocatorTest, MultiQuotaWithFrameworks)
// NOTE: No allocations happen because there are no resources to allocate.
Clock::settle();
+ SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:1024;disk:0");
allocator->addSlave(
agent1.id(),
agent1,
@@ -2169,6 +2147,7 @@ TEST_F(HierarchicalAllocatorTest, MultiQuotaWithFrameworks)
agent1.resources(),
{std::make_pair(framework1.id(), agent1.resources())});
+ SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:1024;disk:0");
allocator->addSlave(
agent2.id(),
agent2,
@@ -2187,7 +2166,6 @@ TEST_F(HierarchicalAllocatorTest, MultiQuotaWithFrameworks)
// to the framework in `QUOTA_ROLE2`.
SlaveInfo agent3 = createSlaveInfo("cpus:2;mem:2048");
-
allocator->addSlave(agent3.id(), agent3, None(), agent3.resources(), {});
// `framework2` will get all agent3's resources because its role is under
@@ -2218,16 +2196,13 @@ TEST_F(HierarchicalAllocatorTest, ReservationWithinQuota)
initialize();
- FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
- FrameworkInfo framework2 = createFrameworkInfo(NON_QUOTA_ROLE);
-
const Quota quota = createQuota(QUOTA_ROLE, "cpus:2;mem:256");
-
- // Notify allocator of agents, frameworks, quota and current allocations.
allocator->setQuota(QUOTA_ROLE, quota);
+ FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
allocator->addFramework(framework1.id(), framework1, {});
+ FrameworkInfo framework2 = createFrameworkInfo(NON_QUOTA_ROLE);
allocator->addFramework(framework2.id(), framework2, {});
// Process all triggered allocation events.
[2/2] mesos git commit: Removed numeric suffixes where appropriate in
allocator tests.
Posted by al...@apache.org.
Removed numeric suffixes where appropriate in allocator tests.
We should not enumerate variables if the corresponding
instance is the only one of such type in the test.
Review: https://reviews.apache.org/r/44336/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c23932d5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c23932d5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c23932d5
Branch: refs/heads/master
Commit: c23932d57b98da9c20d95898f3d7d313b5ad3931
Parents: 69ab752
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Wed Apr 13 12:08:54 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Wed Apr 13 12:08:54 2016 +0200
----------------------------------------------------------------------
src/tests/hierarchical_allocator_tests.cpp | 86 ++++++++++++-------------
1 file changed, 43 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c23932d5/src/tests/hierarchical_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp
index 2e56e85..8ed0df4 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -489,29 +489,29 @@ TEST_F(HierarchicalAllocatorTest, OfferFilter)
initialize();
- FrameworkInfo framework1 = createFrameworkInfo(ROLE);
- allocator->addFramework(framework1.id(), framework1, {});
+ FrameworkInfo framework = createFrameworkInfo(ROLE);
+ allocator->addFramework(framework.id(), framework, {});
- SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
- allocator->addSlave(agent1.id(), agent1, None(), agent1.resources(), {});
+ SlaveInfo agent = createSlaveInfo("cpus:1;mem:512;disk:0");
+ allocator->addSlave(agent.id(), agent, None(), agent.resources(), {});
- // `framework1` will be offered all of `agent1` resources
+ // `framework` will be offered all of `agent` resources
// because it is the only framework in the cluster.
Future<Allocation> allocation = allocations.get();
AWAIT_READY(allocation);
- EXPECT_EQ(framework1.id(), allocation.get().frameworkId);
- EXPECT_EQ(agent1.resources(), Resources::sum(allocation.get().resources));
+ EXPECT_EQ(framework.id(), allocation.get().frameworkId);
+ EXPECT_EQ(agent.resources(), Resources::sum(allocation.get().resources));
- // Now `framework1` declines the offer and sets a filter
+ // Now `framework` declines the offer and sets a filter
// with the duration greater than the allocation interval.
Duration filterTimeout = flags.allocation_interval * 2;
Filters offerFilter;
offerFilter.set_refuse_seconds(filterTimeout.secs());
allocator->recoverResources(
- framework1.id(),
- agent1.id(),
- allocation.get().resources.get(agent1.id()).get(),
+ framework.id(),
+ agent.id(),
+ allocation.get().resources.get(agent.id()).get(),
offerFilter);
// Ensure the offer filter timeout is set before advancing the clock.
@@ -538,8 +538,8 @@ TEST_F(HierarchicalAllocatorTest, OfferFilter)
// The next batch allocation should offer resources to `framework1`.
AWAIT_READY(allocation);
- EXPECT_EQ(framework1.id(), allocation.get().frameworkId);
- EXPECT_EQ(agent1.resources(), Resources::sum(allocation.get().resources));
+ EXPECT_EQ(framework.id(), allocation.get().frameworkId);
+ EXPECT_EQ(agent.resources(), Resources::sum(allocation.get().resources));
metrics = Metrics();
@@ -706,13 +706,13 @@ TEST_F(HierarchicalAllocatorTest, MaintenanceInverseOffers)
allocator->addSlave(agent.id(), agent, None(), agent.resources(), {});
// This framework will be offered all of the resources.
- FrameworkInfo framework1 = createFrameworkInfo("*");
- allocator->addFramework(framework1.id(), framework1, {});
+ FrameworkInfo framework = createFrameworkInfo("*");
+ allocator->addFramework(framework.id(), framework, {});
// Check that the resources go to the framework.
Future<Allocation> allocation = allocations.get();
AWAIT_READY(allocation);
- EXPECT_EQ(framework1.id(), allocation.get().frameworkId);
+ EXPECT_EQ(framework.id(), allocation.get().frameworkId);
EXPECT_EQ(agent.resources(), Resources::sum(allocation.get().resources));
const process::Time start = Clock::now() + Seconds(60);
@@ -726,7 +726,7 @@ TEST_F(HierarchicalAllocatorTest, MaintenanceInverseOffers)
// Check the resources get inverse offered.
Future<Deallocation> deallocation = deallocations.get();
AWAIT_READY(deallocation);
- EXPECT_EQ(framework1.id(), deallocation.get().frameworkId);
+ EXPECT_EQ(framework.id(), deallocation.get().frameworkId);
EXPECT_TRUE(deallocation.get().resources.contains(agent.id()));
foreachvalue (
@@ -920,12 +920,12 @@ TEST_F(HierarchicalAllocatorTest, RecoverResources)
allocator->addSlave(slave.id(), slave, None(), slave.resources(), {});
// Initially, all the resources are allocated.
- FrameworkInfo framework1 = createFrameworkInfo("role1");
- allocator->addFramework(framework1.id(), framework1, {});
+ FrameworkInfo framework = createFrameworkInfo("role1");
+ allocator->addFramework(framework.id(), framework, {});
Future<Allocation> allocation = allocations.get();
AWAIT_READY(allocation);
- EXPECT_EQ(framework1.id(), allocation.get().frameworkId);
+ EXPECT_EQ(framework.id(), allocation.get().frameworkId);
EXPECT_EQ(1u, allocation.get().resources.size());
EXPECT_TRUE(allocation.get().resources.contains(slave.id()));
EXPECT_EQ(slave.resources(), Resources::sum(allocation.get().resources));
@@ -943,7 +943,7 @@ TEST_F(HierarchicalAllocatorTest, RecoverResources)
allocation = allocations.get();
AWAIT_READY(allocation);
- EXPECT_EQ(framework1.id(), allocation.get().frameworkId);
+ EXPECT_EQ(framework.id(), allocation.get().frameworkId);
EXPECT_EQ(1u, allocation.get().resources.size());
EXPECT_TRUE(allocation.get().resources.contains(slave.id()));
EXPECT_EQ(reserved, Resources::sum(allocation.get().resources));
@@ -961,7 +961,7 @@ TEST_F(HierarchicalAllocatorTest, RecoverResources)
allocation = allocations.get();
AWAIT_READY(allocation);
- EXPECT_EQ(framework1.id(), allocation.get().frameworkId);
+ EXPECT_EQ(framework.id(), allocation.get().frameworkId);
EXPECT_EQ(1u, allocation.get().resources.size());
EXPECT_TRUE(allocation.get().resources.contains(slave.id()));
EXPECT_EQ(unreserved, Resources::sum(allocation.get().resources));
@@ -1397,8 +1397,8 @@ TEST_F(HierarchicalAllocatorTest, QuotaProvidesGuarantee)
FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
allocator->addFramework(framework1.id(), framework1, {});
- const Quota quota1 = createQuota(QUOTA_ROLE, "cpus:2;mem:1024");
- allocator->setQuota(QUOTA_ROLE, quota1);
+ const Quota quota = createQuota(QUOTA_ROLE, "cpus:2;mem:1024");
+ allocator->setQuota(QUOTA_ROLE, quota);
// Create `framework2` in a non-quota'ed role.
FrameworkInfo framework2 = createFrameworkInfo(NO_QUOTA_ROLE);
@@ -1505,8 +1505,8 @@ TEST_F(HierarchicalAllocatorTest, RemoveQuota)
initialize();
- const Quota quota1 = createQuota(QUOTA_ROLE, "cpus:2;mem:1024");
- allocator->setQuota(QUOTA_ROLE, quota1);
+ const Quota quota = createQuota(QUOTA_ROLE, "cpus:2;mem:1024");
+ allocator->setQuota(QUOTA_ROLE, quota);
FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
allocator->addFramework(framework1.id(), framework1, {});
@@ -1607,8 +1607,8 @@ TEST_F(HierarchicalAllocatorTest, MultipleFrameworksInRoleWithQuota)
FrameworkInfo framework1a = createFrameworkInfo(QUOTA_ROLE);
allocator->addFramework(framework1a.id(), framework1a, {});
- const Quota quota1 = createQuota(QUOTA_ROLE, "cpus:4;mem:2048");
- allocator->setQuota(QUOTA_ROLE, quota1);
+ const Quota quota = createQuota(QUOTA_ROLE, "cpus:4;mem:2048");
+ allocator->setQuota(QUOTA_ROLE, quota);
// Create `framework2` in a non-quota'ed role.
FrameworkInfo framework2 = createFrameworkInfo(NO_QUOTA_ROLE);
@@ -1724,8 +1724,8 @@ TEST_F(HierarchicalAllocatorTest, QuotaAllocationGranularity)
allocator->addFramework(framework1.id(), framework1, {});
// Set quota to be less than the agent resources.
- const Quota quota1 = createQuota(QUOTA_ROLE, "cpus:0.5;mem:200");
- allocator->setQuota(QUOTA_ROLE, quota1);
+ const Quota quota = createQuota(QUOTA_ROLE, "cpus:0.5;mem:200");
+ allocator->setQuota(QUOTA_ROLE, quota);
// Create `framework2` in a non-quota'ed role.
FrameworkInfo framework2 = createFrameworkInfo(NO_QUOTA_ROLE);
@@ -1736,17 +1736,17 @@ TEST_F(HierarchicalAllocatorTest, QuotaAllocationGranularity)
// NOTE: No allocations happen because there are no resources to allocate.
Clock::settle();
- SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:512;disk:0");
- allocator->addSlave(agent1.id(), agent1, None(), agent1.resources(), {});
+ SlaveInfo agent = createSlaveInfo("cpus:1;mem:512;disk:0");
+ allocator->addSlave(agent.id(), agent, None(), agent.resources(), {});
- // `framework1` will be offered all of `agent1`'s resources because
+ // `framework1` will be offered all of `agent`'s resources because
// it is the only framework in the only role with unsatisfied quota
// and the allocator performs coarse-grained allocation.
Future<Allocation> allocation = allocations.get();
AWAIT_READY(allocation);
EXPECT_EQ(framework1.id(), allocation.get().frameworkId);
- EXPECT_EQ(agent1.resources(), Resources::sum(allocation.get().resources));
- EXPECT_TRUE(Resources(agent1.resources()).contains(quota1.info.guarantee()));
+ EXPECT_EQ(agent.resources(), Resources::sum(allocation.get().resources));
+ EXPECT_TRUE(Resources(agent.resources()).contains(quota.info.guarantee()));
// Total cluster resources: cpus=1, mem=512.
// QUOTA_ROLE share = 1 (cpus=1, mem=512) [quota: cpus=0.5, mem=200]
@@ -1771,8 +1771,8 @@ TEST_F(HierarchicalAllocatorTest, DRFWithQuota)
initialize();
- const Quota quota1 = createQuota(QUOTA_ROLE, "cpus:0.25;mem:128");
- allocator->setQuota(QUOTA_ROLE, quota1);
+ const Quota quota = createQuota(QUOTA_ROLE, "cpus:0.25;mem:128");
+ allocator->setQuota(QUOTA_ROLE, quota);
FrameworkInfo framework1 = createFrameworkInfo(QUOTA_ROLE);
allocator->addFramework(framework1.id(), framework1, {});
@@ -1808,7 +1808,7 @@ TEST_F(HierarchicalAllocatorTest, DRFWithQuota)
agent1,
None(),
agent1.resources(),
- {std::make_pair(framework1.id(), Resources(quota1.info.guarantee()))});
+ {std::make_pair(framework1.id(), Resources(quota.info.guarantee()))});
// Total cluster resources (1 agent): cpus=1, mem=512.
// QUOTA_ROLE share = 0.25 (cpus=0.25, mem=128) [quota: cpus=0.25, mem=128]
@@ -1825,7 +1825,7 @@ TEST_F(HierarchicalAllocatorTest, DRFWithQuota)
Future<Allocation> allocation = allocations.get();
AWAIT_READY(allocation);
EXPECT_EQ(framework2.id(), allocation.get().frameworkId);
- EXPECT_EQ(agent1.resources() - Resources(quota1.info.guarantee()),
+ EXPECT_EQ(agent1.resources() - Resources(quota.info.guarantee()),
Resources::sum(allocation.get().resources));
metrics = Metrics();
@@ -1968,8 +1968,8 @@ TEST_F(HierarchicalAllocatorTest, QuotaAgainstStarvation)
filter0s);
// We set quota for the "starving" `QUOTA_ROLE` role.
- Quota quota1 = createQuota(QUOTA_ROLE, "cpus:2;mem:1024");
- allocator->setQuota(QUOTA_ROLE, quota1);
+ const Quota quota = createQuota(QUOTA_ROLE, "cpus:2;mem:1024");
+ allocator->setQuota(QUOTA_ROLE, quota);
// Since `QUOTA_ROLE` is under quota, `agent2`'s resources will
// be allocated to `framework1`.
@@ -2005,8 +2005,8 @@ TEST_F(HierarchicalAllocatorTest, QuotaAbsentFramework)
// Set quota for the quota'ed role. This role isn't registered with
// the allocator yet.
- const Quota quota1 = createQuota(QUOTA_ROLE, "cpus:2;mem:1024");
- allocator->setQuota(QUOTA_ROLE, quota1);
+ const Quota quota = createQuota(QUOTA_ROLE, "cpus:2;mem:1024");
+ allocator->setQuota(QUOTA_ROLE, quota);
// Add `framework` in the non-quota'ed role.
FrameworkInfo framework = createFrameworkInfo(NO_QUOTA_ROLE);