You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2018/05/22 21:21:54 UTC
mesos git commit: Fixed a quota-related metrics bug.
Repository: mesos
Updated Branches:
refs/heads/master d7d7cfbc3 -> 07b90e48c
Fixed a quota-related metrics bug.
Review: https://reviews.apache.org/r/67238
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/07b90e48
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/07b90e48
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/07b90e48
Branch: refs/heads/master
Commit: 07b90e48cfabd543b0b6c8f6d2bb35afd88d6560
Parents: d7d7cfb
Author: Greg Mann <gr...@gmail.com>
Authored: Mon May 21 14:11:29 2018 -0700
Committer: Greg Mann <gr...@gmail.com>
Committed: Tue May 22 14:11:39 2018 -0700
----------------------------------------------------------------------
src/master/allocator/mesos/metrics.cpp | 6 ++++++
src/tests/master_quota_tests.cpp | 11 +++++++++++
2 files changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/07b90e48/src/master/allocator/mesos/metrics.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/metrics.cpp b/src/master/allocator/mesos/metrics.cpp
index 5194f5b..82990b2 100644
--- a/src/master/allocator/mesos/metrics.cpp
+++ b/src/master/allocator/mesos/metrics.cpp
@@ -165,12 +165,18 @@ void Metrics::setQuota(const string& role, const Quota& quota)
void Metrics::removeQuota(const string& role)
{
CHECK(quota_allocated.contains(role));
+ CHECK(quota_guarantee.contains(role));
foreachvalue (const PullGauge& gauge, quota_allocated[role]) {
process::metrics::remove(gauge);
}
+ foreachvalue (const PullGauge& gauge, quota_guarantee[role]) {
+ process::metrics::remove(gauge);
+ }
+
quota_allocated.erase(role);
+ quota_guarantee.erase(role);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/07b90e48/src/tests/master_quota_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_quota_tests.cpp b/src/tests/master_quota_tests.cpp
index ddb2903..0692e31 100644
--- a/src/tests/master_quota_tests.cpp
+++ b/src/tests/master_quota_tests.cpp
@@ -468,6 +468,13 @@ TEST_F(MasterQuotaTest, RemoveSingleQuota)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
+ const string metricKey =
+ "allocator/mesos/quota/roles/" + ROLE1 + "/resources/cpus/guarantee";
+
+ JSON::Object metrics = Metrics();
+
+ EXPECT_EQ(1, metrics.values[metricKey]);
+
// Remove the previously requested quota.
Future<Nothing> receivedRemoveRequest;
EXPECT_CALL(allocator, removeQuota(Eq(ROLE1)))
@@ -480,6 +487,10 @@ TEST_F(MasterQuotaTest, RemoveSingleQuota)
// Ensure that the quota remove request has reached the allocator.
AWAIT_READY(receivedRemoveRequest);
+
+ metrics = Metrics();
+
+ ASSERT_NONE(metrics.at<JSON::Number>(metricKey));
}
}