You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/04/12 21:15:59 UTC
mesos git commit: Added a new test cases for revive offer.
Repository: mesos
Updated Branches:
refs/heads/master 378e28ea3 -> 5c04712d9
Added a new test cases for revive offer.
Review: https://reviews.apache.org/r/42342/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5c04712d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5c04712d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5c04712d
Branch: refs/heads/master
Commit: 5c04712d9ffa9f31b6e1a874b2935b3b1359efa6
Parents: 378e28e
Author: Guangya Liu <gy...@gmail.com>
Authored: Tue Apr 12 12:12:53 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Apr 12 12:12:53 2016 -0700
----------------------------------------------------------------------
src/tests/hierarchical_allocator_tests.cpp | 57 +++++++++++++++++++++++++
1 file changed, 57 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/5c04712d/src/tests/hierarchical_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp
index a5dd57a..5e60cb6 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -3037,6 +3037,63 @@ TEST_F(HierarchicalAllocatorTest, UpdateWeight)
}
+// This test checks that if a framework recovered resources with a
+// long filter, it will start receiving resource offers again after
+// reviving offer.
+TEST_F(HierarchicalAllocatorTest, ReviveOffers)
+{
+ // Pausing the clock is not necessary, but ensures that the test
+ // doesn't rely on the periodic allocation in the allocator, which
+ // would slow down the test.
+ Clock::pause();
+
+ initialize();
+
+ hashmap<FrameworkID, Resources> EMPTY;
+
+ // Total cluster resources will become cpus=2, mem=1024.
+ SlaveInfo agent = createSlaveInfo("cpus:2;mem:1024;disk:0");
+ allocator->addSlave(agent.id(), agent, None(), agent.resources(), EMPTY);
+
+ // Framework will be offered all of agent's resources since it is
+ // the only framework running so far.
+ FrameworkInfo framework = createFrameworkInfo("role1");
+ allocator->addFramework(
+ framework.id(), framework, hashmap<SlaveID, Resources>());
+
+ Future<Allocation> allocation = allocations.get();
+ AWAIT_READY(allocation);
+ EXPECT_EQ(framework.id(), allocation.get().frameworkId);
+ EXPECT_EQ(agent.resources(), Resources::sum(allocation.get().resources));
+
+ Filters filter1000s;
+ filter1000s.set_refuse_seconds(1000.);
+ allocator->recoverResources(
+ framework.id(),
+ agent.id(),
+ agent.resources(),
+ filter1000s);
+
+ // Advance the clock to trigger a background allocation cycle.
+ Clock::advance(flags.allocation_interval);
+
+ Clock::settle();
+ allocation = allocations.get();
+ EXPECT_TRUE(allocation.isPending());
+
+ allocator->reviveOffers(framework.id());
+
+ // Wait for the `reviveOffers` operation to be processed.
+ Clock::settle();
+
+ // Framework will be offered all of agent's resources again
+ // after revive offer.
+ AWAIT_READY(allocation);
+ EXPECT_EQ(framework.id(), allocation.get().frameworkId);
+ EXPECT_EQ(agent.resources(), Resources::sum(allocation.get().resources));
+}
+
+
class HierarchicalAllocator_BENCHMARK_Test
: public HierarchicalAllocatorTestBase,
public WithParamInterface<std::tr1::tuple<size_t, size_t>> {};