You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/02/11 01:38:14 UTC
[2/2] mesos git commit: Fixed a flaky test in quota tests.
Fixed a flaky test in quota tests.
The `AvailableResourcesAfterRescinding` test became flaky after we
stopped offering unreserved resources beyond quota in
https://reviews.apache.org/r/42835. Hence the allocator offers
rescinded resources to `framework1` if an allocation happens before
the test finishes, which violates the expectation that `framework1`
receives resources only once. Since we do not really care about
allocations in this test but rather about rescinded resources, the
fix is just to ignore subsequent offers to `framework1`.
Review: https://reviews.apache.org/r/42908/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/84c6b714
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/84c6b714
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/84c6b714
Branch: refs/heads/master
Commit: 84c6b714dd5df836a7943493562683ed41f7f396
Parents: 56f7e01
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Wed Feb 10 13:38:29 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Wed Feb 10 13:38:29 2016 -0800
----------------------------------------------------------------------
src/tests/master_quota_tests.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/84c6b714/src/tests/master_quota_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_quota_tests.cpp b/src/tests/master_quota_tests.cpp
index 11cb321..8357ec9 100644
--- a/src/tests/master_quota_tests.cpp
+++ b/src/tests/master_quota_tests.cpp
@@ -895,9 +895,12 @@ TEST_F(MasterQuotaTest, AvailableResourcesAfterRescinding)
Future<vector<Offer>> offers;
// Set expectations for the first offer and launch the framework.
+ // In this test we care about rescinded resources and not about
+ // following allocations, hence ignore any subsequent offers.
EXPECT_CALL(sched1, registered(&framework1, _, _));
EXPECT_CALL(sched1, resourceOffers(&framework1, _))
- .WillOnce(FutureArg<1>(&offers));
+ .WillOnce(FutureArg<1>(&offers))
+ .WillRepeatedly(Return());
framework1.start();
@@ -955,6 +958,14 @@ TEST_F(MasterQuotaTest, AvailableResourcesAfterRescinding)
EXPECT_CALL(sched1, offerRescinded(&framework1, _))
.Times(2);
+ // In this test we are not interested in which frameworks will be offered
+ // the rescinded resources.
+ EXPECT_CALL(sched2, resourceOffers(&framework2, _))
+ .WillRepeatedly(Return());
+
+ EXPECT_CALL(sched3, resourceOffers(&framework3, _))
+ .WillRepeatedly(Return());
+
// Send a quota request for the specified role.
Future<Quota> receivedQuotaRequest;
EXPECT_CALL(allocator, setQuota(Eq(ROLE2), _))