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 4cfe8cc  Made the MaintenanceInverseOffers test use only one framework.
4cfe8cc is described below

commit 4cfe8ccbc2a6807f5c4ca3cc5030c35c15bb147f
Author: Andrei Sekretenko <asekrete...@mesosphere.io>
AuthorDate: Wed Oct 2 10:23:25 2019 -0400

    Made the MaintenanceInverseOffers test use only one framework.
    
    This patch simplifies the test and attepmts to fix MESOS-9980 by
    removing the (potential) flakiness caused by agent2's resources
    being re-offered to framework2.
    
    Review: https://reviews.apache.org/r/71560/
---
 src/tests/hierarchical_allocator_tests.cpp | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/tests/hierarchical_allocator_tests.cpp 
b/src/tests/hierarchical_allocator_tests.cpp
index a13eb01..da7489b 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -1077,22 +1077,17 @@ TEST_F(HierarchicalAllocatorTest, 
MaintenanceInverseOffers)
       {});
 
   // This framework will be offered all of the resources.
-  FrameworkInfo framework1 = createFrameworkInfo({"*"});
-  allocator->addFramework(framework1.id(), framework1, {}, true, {});
+  FrameworkInfo framework = createFrameworkInfo({"*"});
+  allocator->addFramework(framework.id(), framework, {}, true, {});
 
   // Check that the resources go to the framework.
   Allocation expected = Allocation(
-      framework1.id(),
+      framework.id(),
       {{"*", {{agent1.id(), agent1.resources()}}}});
 
   AWAIT_EXPECT_EQ(expected, allocations.get());
 
-  // Create another agent and framework.
-  //
-  // This framework will be offered all of 2nd agent resources.
-  FrameworkInfo framework2 = createFrameworkInfo({"*"});
-  allocator->addFramework(framework2.id(), framework2, {}, true, {});
-
+  // Create another agent.
   SlaveInfo agent2 = createSlaveInfo("cpus:2;mem:1024;disk:0");
   allocator->addSlave(
       agent2.id(),
@@ -1102,36 +1097,38 @@ TEST_F(HierarchicalAllocatorTest, 
MaintenanceInverseOffers)
       agent2.resources(),
       {});
 
-  // Check that the resources go to the framework.
+  // Check that resources of agent2 go to the framework too.
   expected =
-    Allocation(framework2.id(), {{"*", {{agent2.id(), agent2.resources()}}}});
+    Allocation(framework.id(), {{"*", {{agent2.id(), agent2.resources()}}}});
 
   AWAIT_EXPECT_EQ(expected, allocations.get());
 
-  // Recover the offer allocated to framework2.
+  // Recover resources of the offer for agent2.
   Filters filter1day;
   filter1day.set_refuse_seconds(Days(1).secs());
 
   allocator->recoverResources(
-      framework2.id(),
+      framework.id(),
       agent2.id(),
       allocatedResources(agent2.resources(), "*"),
       filter1day);
 
   const process::Time start = Clock::now() + Seconds(60);
-
   // Give both agents some unavailability.
   allocator->updateUnavailability(
       agent1.id(), protobuf::maintenance::createUnavailability(start));
   allocator->updateUnavailability(
       agent2.id(), protobuf::maintenance::createUnavailability(start));
 
-  // Check the resources get inverse offered.
+  // Check the resources of agent1 get inverse offered.
   Future<Deallocation> deallocation = deallocations.get();
   AWAIT_READY(deallocation);
-  EXPECT_EQ(framework1.id(), deallocation->frameworkId);
+  EXPECT_EQ(framework.id(), deallocation->frameworkId);
   EXPECT_TRUE(deallocation->resources.contains(agent1.id()));
 
+  // Resources of agent2 should not be inverse offered.
+  EXPECT_FALSE(deallocation->resources.contains(agent2.id()));
+
   foreachvalue (
       const UnavailableResources& unavailableResources,
       deallocation->resources) {

Reply via email to