This is an automated email from the ASF dual-hosted git repository.
mzhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new 46c7349 Fixed test `QuotaRoleAllocateNonQuotaResource`.
46c7349 is described below
commit 46c7349c9f8acc387edc8c9737eee02385fcee04
Author: Meng Zhu <[email protected]>
AuthorDate: Mon Jun 10 17:07:50 2019 -0700
Fixed test `QuotaRoleAllocateNonQuotaResource`.
The test was failing because:
After `agent3` is added, it misses a settle call where the allocation
of `agent3` is racy.
In addition, after MESOS-8456, the allocator now offers non-quota
resources on an agent (even that means "chopping") on top of a role's
satisfied guarantees instead of skipping the agent all-together.
This patch fixes the test by expecting the right amount of resources
to be allocated from `agent3`.
Review: https://reviews.apache.org/r/70824
---
src/tests/hierarchical_allocator_tests.cpp | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/tests/hierarchical_allocator_tests.cpp
b/src/tests/hierarchical_allocator_tests.cpp
index bfea34e..7dc3dc1 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -4090,8 +4090,22 @@ TEST_F(HierarchicalAllocatorTest,
QuotaRoleAllocateNonQuotaResource)
agent3.resources(),
{});
- // No allocation will happen because QUOTA_ROLE_1's quota has been met.
- EXPECT_TRUE(allocations.get().isPending());
+ Clock::settle();
+
+ // `QUOTA_ROLE_1` quota has been reached. Only resources with the default
+ // quota (i.e. no limits) are allocated.
+
+ Resources nonQuotaResources =
+ Resources(agent3.resources()).filter([&](const Resource& resource) {
+ return ResourceQuantities::fromScalarResources(
+ Resources(quota1.info.guarantee()))
+ .get(resource.name()) == Value::Scalar();
+ });
+
+ expected = Allocation(
+ framework.id(), {{QUOTA_ROLE_1, {{agent3.id(), nonQuotaResources}}}});
+
+ AWAIT_EXPECT_EQ(expected, allocations.get());
}