This is an automated email from the ASF dual-hosted git repository. bmahler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 92f465c00b700e20df7d9ece423dffe57551983c Author: Andrei Sekretenko <[email protected]> AuthorDate: Fri Jun 21 14:52:59 2019 -0400 Enhanced a test to ensure that the MESOS-9856 REVIVE bug is fixed. This patch exposes a bug, due to which reviveOffers() called for a specific role clears offer filters for all the roles of a framework. Review: https://reviews.apache.org/r/70925/ --- 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 7dc3dc1..20b7fd7 100644 --- a/src/tests/hierarchical_allocator_tests.cpp +++ b/src/tests/hierarchical_allocator_tests.cpp @@ -5850,8 +5850,7 @@ TEST_F(HierarchicalAllocatorTest, SuppressAndReviveOffersWithMultiRole) Future<Allocation> allocation = allocations.get(); EXPECT_TRUE(allocation.isPending()); - // Revive offers for role1, after which the agent's resources - // should be offered to it. + // Revive offers for role1. This should NOT affect offer filters of role2. allocator->reviveOffers(framework.id(), {"role1"}); expected = Allocation( @@ -5859,6 +5858,21 @@ TEST_F(HierarchicalAllocatorTest, SuppressAndReviveOffersWithMultiRole) {{"role1", {{agent.id(), agent.resources()}}}}); AWAIT_EXPECT_EQ(expected, allocation); + + // Recover offered resources and set a filter for role1 too. + allocator->recoverResources( + framework.id(), + agent.id(), + allocatedResources(agent.resources(), "role1"), + filter1day); + + // Advance the clock to trigger a batch allocation. + Clock::advance(flags.allocation_interval); + Clock::settle(); + + // As both roles should have the filters set now, nothing should be allocated. + allocation = allocations.get(); + EXPECT_TRUE(allocation.isPending()); }
