You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2019/07/10 03:37:43 UTC
[mesos] branch master updated (de7b506 -> 121dcb5)
This is an automated email from the ASF dual-hosted git repository.
bmahler pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git.
from de7b506 Used euid to determine subprocess' user when launching tasks.
new 01de239 Renamed Role::allocatedResources to Role::allocatedAndOfferedResources.
new 76c4743 Renamed the roles ui column from 'Allocation' to 'Allocation + Offered'.
new 697de69 Added Role::consumedQuota to the master.
new f1b4849 Added quota.consumed field to /roles endpoint.
new 5bb3dcd Updated LaunchTask test action to use a unique TaskID across runs.
new 121dcb5 Added a test for /roles quota.consumed field.
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/master/framework.cpp | 2 +-
src/master/http.cpp | 3 +-
src/master/master.hpp | 66 ++++++++-
src/master/readonly_handler.cpp | 48 ++++---
src/tests/mesos.hpp | 3 +-
src/tests/role_tests.cpp | 292 +++++++++++++++++++++++++++++++++-------
src/webui/app/roles/roles.html | 2 +-
7 files changed, 338 insertions(+), 78 deletions(-)
[mesos] 02/06: Renamed the roles ui column from 'Allocation' to
'Allocation + Offered'.
Posted by bm...@apache.org.
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 76c474380b19b52e36547f3bcd2975ab5c11fed6
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Fri Jun 28 16:10:14 2019 -0400
Renamed the roles ui column from 'Allocation' to 'Allocation + Offered'.
This column actually displays the allocation + offered amount, so this
renames it accordingly to avoid confusion. Later, we will split these
apart into separate selectable columns.
Review: https://reviews.apache.org/r/71028
---
src/webui/app/roles/roles.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/webui/app/roles/roles.html b/src/webui/app/roles/roles.html
index 02cb7ba..6b08b91 100644
--- a/src/webui/app/roles/roles.html
+++ b/src/webui/app/roles/roles.html
@@ -14,7 +14,7 @@
<th data-key="name" data-sort class="ascending vertically-center" rowspan="2">Role</th>
<th data-key="weight" class="vertically-center" rowspan="2">Weight</th>
<th data-key="frameworks.length" class="vertically-center" rowspan="2">Frameworks</th>
- <th data-key="resources.cpus" class="group-column" colspan="4">Allocation</th>
+ <th data-key="resources.cpus" class="group-column" colspan="4">Allocation + Offered</th>
<th data-key="resources.gpus" class="group-column" colspan="4">Guarantee</th>
<th data-key="resources.mem" class="group-column" colspan="4">Limit</th>
</tr>
[mesos] 01/06: Renamed Role::allocatedResources to
Role::allocatedAndOfferedResources.
Posted by bm...@apache.org.
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 01de23909afc0de9a79cc1eb1047a9b09e244774
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Fri Jun 28 16:08:14 2019 -0400
Renamed Role::allocatedResources to Role::allocatedAndOfferedResources.
This exposes allocated + offered, so it has been renamed accordingly.
Review: https://reviews.apache.org/r/71027
---
src/master/http.cpp | 3 ++-
src/master/master.hpp | 2 +-
src/master/readonly_handler.cpp | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/master/http.cpp b/src/master/http.cpp
index b42ebb9..1b3d48d 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -2704,7 +2704,8 @@ Future<Response> Master::Http::getRoles(
if (master->roles.contains(name)) {
Role* role_ = master->roles.at(name);
- role.mutable_resources()->CopyFrom(role_->allocatedResources());
+ *role.mutable_resources() =
+ role_->allocatedAndOfferedResources();
foreachkey (const FrameworkID& frameworkId, role_->frameworks) {
role.add_frameworks()->CopyFrom(frameworkId);
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 23dafe7..6da02b8 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -2699,7 +2699,7 @@ struct Role
frameworks.erase(framework->id());
}
- Resources allocatedResources() const
+ Resources allocatedAndOfferedResources() const
{
Resources resources;
diff --git a/src/master/readonly_handler.cpp b/src/master/readonly_handler.cpp
index 0d1e3dc..5772b7c 100644
--- a/src/master/readonly_handler.cpp
+++ b/src/master/readonly_handler.cpp
@@ -737,7 +737,8 @@ process::http::Response Master::ReadOnlyHandler::roles(
if (role.isNone()) {
writer->field("resources", Resources());
} else {
- writer->field("resources", (*role)->allocatedResources());
+ writer->field(
+ "resources", (*role)->allocatedAndOfferedResources());
}
if (role.isNone()) {
[mesos] 06/06: Added a test for /roles quota.consumed field.
Posted by bm...@apache.org.
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 121dcb59d183005a1dd55f987c12617a327a7654
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Mon Jul 8 13:36:09 2019 -0400
Added a test for /roles quota.consumed field.
This ensures that the various edge different states of resources
are correctly handled, see test comment for more details.
Review: https://reviews.apache.org/r/71032
---
src/tests/role_tests.cpp | 148 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 148 insertions(+)
diff --git a/src/tests/role_tests.cpp b/src/tests/role_tests.cpp
index 384b1d5..f7a8234 100644
--- a/src/tests/role_tests.cpp
+++ b/src/tests/role_tests.cpp
@@ -57,6 +57,7 @@ using process::http::Response;
using process::http::Unauthorized;
using testing::AtMost;
+using testing::DoAll;
namespace mesos {
namespace internal {
@@ -471,6 +472,153 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, RolesEndpointContainsQuota)
}
+// This test ensures that quota consumption is included
+// in /roles endpoint of master.
+//
+// We set up the following that should be included in
+// the quota consumption:
+// - Allocated unreserved resources
+// - Allocated reservation
+// - Unallocated reservation
+//
+// And we set up the following that should not be included
+// in the quota consumption:
+// - Outstanding offer
+//
+// TODO(bmahler): Test hierarchical accounting accuracy.
+TEST_F(RoleTest, RolesEndpointContainsConsumedQuota)
+{
+ Try<Owned<cluster::Master>> master = StartMaster();
+ ASSERT_SOME(master);
+
+ // Start an agent with reserved resources and
+ // allocate them to a task.
+ slave::Flags agentFlags1 = CreateSlaveFlags();
+ agentFlags1.resources = "cpus(role):1;mem(role):10;"
+ "disk:0;ports:[]";
+
+ Owned<MasterDetector> detector = master.get()->createDetector();
+ Try<Owned<cluster::Slave>> slave1 = StartSlave(detector.get(), agentFlags1);
+
+ FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+ frameworkInfo.set_roles(0, "role");
+
+ MockScheduler sched;
+ MesosSchedulerDriver driver(
+ &sched, frameworkInfo, master.get()->pid, DEFAULT_CREDENTIAL);
+
+ Future<FrameworkID> frameworkId;
+ EXPECT_CALL(sched, registered(&driver, _, _))
+ .WillOnce(FutureArg<1>(&frameworkId));
+
+ ExecutorInfo executorInfo = createExecutorInfo("dummy", "sleep 3600");
+
+ Future<Nothing> task1Launched;
+ EXPECT_CALL(sched, resourceOffers(&driver, _))
+ .WillOnce(DoAll(LaunchTasks(executorInfo, 1, 1, 10, "role"),
+ FutureSatisfy(&task1Launched)));
+
+ EXPECT_CALL(sched, statusUpdate(&driver, _))
+ .WillRepeatedly(Return());
+
+ driver.start();
+
+ AWAIT_READY(task1Launched);
+
+ // Now we have:
+ // - Allocated reservation: cpus:1;mem:10
+
+ // Start an agent with unreserved resources and allocate
+ // them to a task.
+
+ Future<Nothing> task2Launched;
+ EXPECT_CALL(sched, resourceOffers(&driver, _))
+ .WillOnce(DoAll(LaunchTasks(executorInfo, 1, 10, 100, "role"),
+ FutureSatisfy(&task2Launched)));
+
+ slave::Flags agentFlags2 = CreateSlaveFlags();
+ agentFlags2.resources = "cpus:10;mem:100;"
+ "disk:0;ports:[]";
+
+ Try<Owned<cluster::Slave>> slave2 = StartSlave(detector.get(), agentFlags2);
+
+ AWAIT_READY(task2Launched);
+
+ // Now we have:
+ // - Allocated reservation: cpus:1;mem:10
+ // - Allocated unreserved resources: cpus:10;mem:100
+
+ // Start an agent with both reserved and unreserved
+ // resources, but let them remain offered.
+
+ Future<Nothing> offer;
+ EXPECT_CALL(sched, resourceOffers(&driver, _))
+ .WillOnce(FutureSatisfy(&offer));
+
+ slave::Flags agentFlags3 = CreateSlaveFlags();
+ agentFlags3.resources = "cpus(role):100;mem(role):1000;"
+ "cpus:1000;mem:10000;"
+ ";disk:0;ports:[]";
+
+ Try<Owned<cluster::Slave>> slave3 = StartSlave(detector.get(), agentFlags3);
+
+ AWAIT_READY(offer);
+
+ // Now we have:
+ // - Allocated reservation: cpus:1;mem:10
+ // - Allocated unreserved resources: cpus:10;mem:100
+ // - Offered reservation: cpus:100;mem:1000
+ // - Offered unreserved resources: cpus:1000;mem:10000
+
+ // Check that the /roles endopint has the correct quota
+ // consumption information.
+ {
+ Future<Response> response = process::http::get(
+ master.get()->pid,
+ "roles",
+ None(),
+ createBasicAuthHeaders(DEFAULT_CREDENTIAL));
+
+ AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
+
+ Try<JSON::Value> parse = JSON::parse(response->body);
+ ASSERT_SOME(parse);
+
+ Try<JSON::Value> expected = JSON::parse(
+ "{"
+ " \"roles\": ["
+ " {"
+ " \"frameworks\": [\"" + frameworkId->value() + "\"],"
+ " \"name\": \"role\","
+ " \"resources\": {"
+ " \"cpus\": 1111.0,"
+ " \"mem\": 11110.0,"
+ " \"disk\": 0,"
+ " \"gpus\": 0"
+ " },"
+ " \"quota\": {"
+ " \"consumed\": {"
+ " \"cpus\": 111.0,"
+ " \"mem\": 1110.0"
+ " },"
+ " \"guarantee\": {},"
+ " \"limit\": {},"
+ " \"role\": \"role\""
+ " },"
+ " \"weight\": 1.0"
+ " }"
+ " ]"
+ "}");
+
+ ASSERT_SOME(expected);
+
+ EXPECT_EQ(*expected, *parse)
+ << "expected " << stringify(*expected)
+ << " vs actual " << stringify(*parse);
+ }
+}
+
+
// This test checks that when using implicit roles, the "/roles"
// endpoint shows roles that have a configured weight even if they
// have no registered frameworks.
[mesos] 03/06: Added Role::consumedQuota to the master.
Posted by bm...@apache.org.
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 697de69e9ebf3e5ffdad4a44118cdbdf24a8f39d
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Fri Jun 28 17:07:42 2019 -0400
Added Role::consumedQuota to the master.
Quota consumption is computed as follows:
Allocation + Unallocated Reservation ==
Reservations + Unreserved Allocation
That is, reservations count towards quota regardless of whether
they're allocated. Allocation counts towards quota. Offered resources
*do not* count towards quota, this is to (1) provide stability of the
quota consumption metrics in the face of offers flowing in and out,
and (2) to ensure that we treat offers as rescindable and therefore
not yet "counting" towards quota. Also, if in the future schedulers
are offered more than their quota to improve their choices, counting
offered resources as consumed quota will be problematic.
Review: https://reviews.apache.org/r/71029
---
src/master/framework.cpp | 2 +-
src/master/master.hpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/src/master/framework.cpp b/src/master/framework.cpp
index c35de25..e69a7c2 100644
--- a/src/master/framework.cpp
+++ b/src/master/framework.cpp
@@ -646,7 +646,7 @@ void Framework::trackUnderRole(const std::string& role)
CHECK(!isTrackedUnderRole(role));
if (!master->roles.contains(role)) {
- master->roles[role] = new Role(role);
+ master->roles[role] = new Role(master, role);
}
master->roles.at(role)->addFramework(this);
}
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 6da02b8..b57483c 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -27,6 +27,7 @@
#include <mesos/mesos.hpp>
#include <mesos/resources.hpp>
+#include <mesos/roles.hpp>
#include <mesos/type_utils.hpp>
#include <mesos/maintenance/maintenance.hpp>
@@ -1954,6 +1955,7 @@ private:
friend struct Framework;
friend struct FrameworkMetrics;
friend struct Metrics;
+ friend struct Role;
friend struct Slave;
friend struct SlavesWriter;
friend struct Subscriber;
@@ -2687,7 +2689,9 @@ struct Role
{
Role() = delete;
- Role(const std::string& _role) : role(_role) {}
+ Role(const Master* _master,
+ const std::string& _role)
+ : master(_master), role(_role) {}
void addFramework(Framework* framework)
{
@@ -2699,6 +2703,63 @@ struct Role
frameworks.erase(framework->id());
}
+ // TODO(bmahler): Include non-scalar quantities.
+ //
+ // TODO(bmahler): This function is somewhat expensive,
+ // it should ideally migrate into a field updated in an
+ // event-driven manner within a role tree structure. Or,
+ // at least compute the overall tree when looping over
+ // all agents rather than looping over all agents for
+ // each role.
+ ResourceQuantities consumedQuota() const
+ {
+ const std::string& role = this->role; // For cleaner captures.
+
+ // Consumed quota = allocation + unallocated reservation.
+
+ ResourceQuantities allocation;
+
+ auto allocatedToRoleSubtree = [&role](const Resource& r) {
+ CHECK(r.has_allocation_info());
+ return r.allocation_info().role() == role ||
+ roles::isStrictSubroleOf(r.allocation_info().role(), role);
+ };
+
+ // Loop over all frameworks since `frameworks` only tracks
+ // those that are directly subscribed to this role, and we
+ // need to sum all descendant role allocations.
+ foreachvalue (Framework* framework, master->frameworks.registered) {
+ allocation += ResourceQuantities::fromScalarResources(
+ framework->totalUsedResources.scalars()
+ .filter(allocatedToRoleSubtree));
+ }
+
+ ResourceQuantities unallocatedReservation;
+
+ auto reservedToRoleSubtree = [&role](const Resource& r) {
+ return Resources::isReserved(r) &&
+ (Resources::reservationRole(r) == role ||
+ roles::isStrictSubroleOf(Resources::reservationRole(r), role));
+ };
+
+ foreachvalue (Slave* slave, master->slaves.registered) {
+ ResourceQuantities totalReservation =
+ ResourceQuantities::fromScalarResources(
+ slave->totalResources.scalars()
+ .filter(reservedToRoleSubtree));
+
+ ResourceQuantities usedReservation;
+ foreachvalue (const Resources& r, slave->usedResources) {
+ usedReservation += ResourceQuantities::fromScalarResources(
+ r.scalars().filter(reservedToRoleSubtree));
+ }
+
+ unallocatedReservation += totalReservation - usedReservation;
+ }
+
+ return allocation + unallocatedReservation;
+ }
+
Resources allocatedAndOfferedResources() const
{
Resources resources;
@@ -2718,6 +2779,7 @@ struct Role
return resources;
}
+ const Master* master;
const std::string role;
// NOTE: The dynamic role/quota relation is stored in and administrated
[mesos] 05/06: Updated LaunchTask test action to use a unique
TaskID across runs.
Posted by bm...@apache.org.
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 5bb3dcd4f8662857b234761e2e35fd08fa87b5d6
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Mon Jul 8 13:34:32 2019 -0400
Updated LaunchTask test action to use a unique TaskID across runs.
The existing incremented counter is problematic if the action is
used multiple times in a test, as the task id will clash across
usages.
No tests appear to rely on the existing task id assignment scheme,
so this updates it to be randomly unique via UUID.
Review: https://reviews.apache.org/r/71031
---
src/tests/mesos.hpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index d0c82fa..4612e2e 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -2418,7 +2418,6 @@ ACTION_P5(LaunchTasks, executor, tasks, cpus, mem, role)
taskResources.allocate(role);
}
- int nextTaskId = 0;
std::vector<TaskInfo> tasks;
Resources remaining = offer.resources();
@@ -2426,7 +2425,7 @@ ACTION_P5(LaunchTasks, executor, tasks, cpus, mem, role)
launched < numTasks) {
TaskInfo task;
task.set_name("TestTask");
- task.mutable_task_id()->set_value(stringify(nextTaskId++));
+ task.mutable_task_id()->set_value(id::UUID::random().toString());
task.mutable_slave_id()->MergeFrom(offer.slave_id());
task.mutable_executor()->MergeFrom(executor);
[mesos] 04/06: Added quota.consumed field to /roles endpoint.
Posted by bm...@apache.org.
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 f1b484996c856292c8c0a15978e64d3adf14f292
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Mon Jul 1 15:18:35 2019 -0400
Added quota.consumed field to /roles endpoint.
Per the previous commit that adds the consumed quota computation,
consumed quota is:
Allocation + Unallocated Reservation ==
Reservations + Unreserved Allocation
That is, reservations count towards quota regardless of whether
they're allocated. Allocation counts towards quota. Offered resources
*do not* count towards quota, this is to (1) provide stability of the
quota consumption metrics in the face of offers flowing in and out,
and (2) to ensure that we treat offers as rescindable and therefore
not yet "counting" towards quota. Also, if in the future schedulers
are offered more than their quota to improve their choices, counting
offered resources as consumed quota will be problematic.
Review: https://reviews.apache.org/r/71030
---
src/master/readonly_handler.cpp | 45 +++++++------
src/tests/role_tests.cpp | 144 ++++++++++++++++++++++++++--------------
2 files changed, 119 insertions(+), 70 deletions(-)
diff --git a/src/master/readonly_handler.cpp b/src/master/readonly_handler.cpp
index 5772b7c..27965e3 100644
--- a/src/master/readonly_handler.cpp
+++ b/src/master/readonly_handler.cpp
@@ -712,28 +712,33 @@ process::http::Response Master::ReadOnlyHandler::roles(
// Default weight is 1.0.
writer->field("weight", master->weights.get(name).getOrElse(1.0));
- if (master->quotas.contains(name)) {
- // Prior to Mesos 1.9, this field is filled based on
- // `QuotaInfo` which is now deprecated. For backward
- // compatibility reasons, we do not use any formatter
- // for the new struct but construct the response by hand.
- // Specifically:
- //
- // - We keep the `role` field which was present in the
- // `QuotaInfo`.
- //
- // - We name the field using singular `guarantee` and `limit`
- // which is different from the plural used in `QuotaConfig`.
- const Quota& quota = master->quotas.at(name);
- writer->field("quota", [&](JSON::ObjectWriter* writer) {
- writer->field("role", name);
- writer->field("guarantee", quota.guarantees);
- writer->field("limit", quota.limits);
- });
- }
-
Option<Role*> role = master->roles.get(name);
+ // Prior to Mesos 1.9, this field is filled based on
+ // `QuotaInfo` which is now deprecated. For backward
+ // compatibility reasons, we do not use any formatter
+ // for the new struct but construct the response by hand.
+ // Specifically:
+ //
+ // - We keep the `role` field which was present in the
+ // `QuotaInfo`.
+ //
+ // - We name the field using singular `guarantee` and `limit`
+ // which is different from the plural used in `QuotaConfig`.
+ const Quota quota = master->quotas.get(name).getOrElse(Quota());
+
+ writer->field("quota", [&](JSON::ObjectWriter* writer) {
+ writer->field("role", name);
+
+ writer->field("guarantee", quota.guarantees);
+ writer->field("limit", quota.limits);
+
+ ResourceQuantities consumed = role.isSome() ?
+ (*role)->consumedQuota() : ResourceQuantities();
+
+ writer->field("consumed", consumed);
+ });
+
if (role.isNone()) {
writer->field("resources", Resources());
} else {
diff --git a/src/tests/role_tests.cpp b/src/tests/role_tests.cpp
index bf5b3cb..384b1d5 100644
--- a/src/tests/role_tests.cpp
+++ b/src/tests/role_tests.cpp
@@ -309,7 +309,10 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, EndpointEmpty)
"}");
ASSERT_SOME(expected);
- EXPECT_EQ(expected.get(), parse.get());
+
+ EXPECT_EQ(*expected, *parse)
+ << "expected " << stringify(*expected)
+ << " vs actual " << stringify(*parse);
}
@@ -345,10 +348,13 @@ TEST_F(RoleTest, EndpointNoFrameworks)
" \"frameworks\": [],"
" \"name\": \"*\","
" \"resources\": {"
- " \"cpus\": 0,"
- " \"disk\": 0,"
- " \"gpus\": 0,"
- " \"mem\": 0"
+ " \"cpus\": 0, \"disk\": 0, \"gpus\": 0, \"mem\": 0"
+ " },"
+ " \"quota\": {"
+ " \"role\": \"*\","
+ " \"consumed\": {},"
+ " \"guarantee\": {},"
+ " \"limit\": {}"
" },"
" \"weight\": 1.0"
" },"
@@ -356,10 +362,13 @@ TEST_F(RoleTest, EndpointNoFrameworks)
" \"frameworks\": [],"
" \"name\": \"role1\","
" \"resources\": {"
- " \"cpus\": 0,"
- " \"disk\": 0,"
- " \"gpus\": 0,"
- " \"mem\": 0"
+ " \"cpus\": 0, \"disk\": 0, \"gpus\": 0, \"mem\": 0"
+ " },"
+ " \"quota\": {"
+ " \"role\": \"role1\","
+ " \"consumed\": {},"
+ " \"guarantee\": {},"
+ " \"limit\": {}"
" },"
" \"weight\": 5.0"
" },"
@@ -367,10 +376,13 @@ TEST_F(RoleTest, EndpointNoFrameworks)
" \"frameworks\": [],"
" \"name\": \"role2\","
" \"resources\": {"
- " \"cpus\": 0,"
- " \"disk\": 0,"
- " \"gpus\": 0,"
- " \"mem\": 0"
+ " \"cpus\": 0, \"disk\": 0, \"gpus\": 0, \"mem\": 0"
+ " },"
+ " \"quota\": {"
+ " \"role\": \"role2\","
+ " \"consumed\": {},"
+ " \"guarantee\": {},"
+ " \"limit\": {}"
" },"
" \"weight\": 1.0"
" }"
@@ -378,7 +390,10 @@ TEST_F(RoleTest, EndpointNoFrameworks)
"}");
ASSERT_SOME(expected);
- EXPECT_EQ(expected.get(), parse.get());
+
+ EXPECT_EQ(*expected, *parse)
+ << "expected " << stringify(*expected)
+ << " vs actual " << stringify(*parse);
}
@@ -433,22 +448,25 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, RolesEndpointContainsQuota)
"\"quota\":"
"{"
"\"role\":\"foo\","
+ "\"consumed\": {},"
"\"guarantee\":"
"{"
"\"cpus\":1.0,"
"\"mem\":512.0"
"},"
- "\"limit\":"
- "{"
- "\"cpus\":1.0,"
- "\"mem\":512.0"
- "}"
+ "\"limit\":"
+ "{"
+ "\"cpus\":1.0,"
+ "\"mem\":512.0"
+ "}"
"}"
"}"
);
ASSERT_SOME(expected);
- EXPECT_TRUE(role.contains(expected.get()));
+ EXPECT_TRUE(role.contains(*expected))
+ << "expected " << stringify(*expected)
+ << " vs actual " << stringify(role);
}
}
@@ -513,10 +531,13 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, EndpointImplicitRolesWeights)
" \"frameworks\": [\"" + frameworkId1->value() + "\"],"
" \"name\": \"roleX\","
" \"resources\": {"
- " \"cpus\": 0,"
- " \"disk\": 0,"
- " \"gpus\": 0,"
- " \"mem\": 0"
+ " \"cpus\": 0, \"disk\": 0, \"gpus\": 0, \"mem\": 0"
+ " },"
+ " \"quota\": {"
+ " \"role\": \"roleX\","
+ " \"consumed\": {},"
+ " \"guarantee\": {},"
+ " \"limit\": {}"
" },"
" \"weight\": 5.0"
" },"
@@ -524,10 +545,13 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, EndpointImplicitRolesWeights)
" \"frameworks\": [],"
" \"name\": \"roleY\","
" \"resources\": {"
- " \"cpus\": 0,"
- " \"disk\": 0,"
- " \"gpus\": 0,"
- " \"mem\": 0"
+ " \"cpus\": 0, \"disk\": 0, \"gpus\": 0, \"mem\": 0"
+ " },"
+ " \"quota\": {"
+ " \"role\": \"roleY\","
+ " \"consumed\": {},"
+ " \"guarantee\": {},"
+ " \"limit\": {}"
" },"
" \"weight\": 4.0"
" },"
@@ -535,10 +559,13 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, EndpointImplicitRolesWeights)
" \"frameworks\": [\"" + frameworkId2->value() + "\"],"
" \"name\": \"roleZ\","
" \"resources\": {"
- " \"cpus\": 0,"
- " \"disk\": 0,"
- " \"gpus\": 0,"
- " \"mem\": 0"
+ " \"cpus\": 0, \"disk\": 0, \"gpus\": 0, \"mem\": 0"
+ " },"
+ " \"quota\": {"
+ " \"role\": \"roleZ\","
+ " \"consumed\": {},"
+ " \"guarantee\": {},"
+ " \"limit\": {}"
" },"
" \"weight\": 1.0"
" }"
@@ -546,7 +573,10 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, EndpointImplicitRolesWeights)
"}");
ASSERT_SOME(expected);
- EXPECT_EQ(expected.get(), parse.get());
+
+ EXPECT_EQ(*expected, *parse)
+ << "expected " << stringify(*expected)
+ << " vs actual " << stringify(*parse);
driver1.stop();
driver1.join();
@@ -607,10 +637,13 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, EndpointImplicitRolesQuotas)
" \"frameworks\": [],"
" \"name\": \"non-existent-role\","
" \"resources\": {"
- " \"cpus\": 0,"
- " \"disk\": 0,"
- " \"gpus\": 0,"
- " \"mem\": 0"
+ " \"cpus\": 0, \"disk\": 0, \"gpus\": 0, \"mem\": 0"
+ " },"
+ " \"quota\": {"
+ " \"role\": \"non-existent-role\","
+ " \"consumed\": {},"
+ " \"guarantee\": {},"
+ " \"limit\": {}"
" },"
" \"weight\": 1.0"
" }"
@@ -651,8 +684,10 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, EndpointImplicitRolesQuotas)
"}");
ASSERT_SOME(expected);
- EXPECT_EQ(expected.get(), parse.get());
-}
+
+ EXPECT_EQ(*expected, *parse)
+ << "expected " << stringify(*expected)
+ << " vs actual " << stringify(*parse);}
// This test ensures that master adds/removes all roles of
@@ -705,10 +740,13 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
" \"frameworks\": [\"" + frameworkId->value() + "\"],"
" \"name\": \"role1\","
" \"resources\": {"
- " \"cpus\": 0,"
- " \"disk\": 0,"
- " \"gpus\": 0,"
- " \"mem\": 0"
+ " \"cpus\": 0, \"disk\": 0, \"gpus\": 0, \"mem\": 0"
+ " },"
+ " \"quota\": {"
+ " \"role\": \"role1\","
+ " \"consumed\": {},"
+ " \"guarantee\": {},"
+ " \"limit\": {}"
" },"
" \"weight\": 1.0"
" },"
@@ -716,10 +754,13 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
" \"frameworks\": [\"" + frameworkId->value() + "\"],"
" \"name\": \"role2\","
" \"resources\": {"
- " \"cpus\": 0,"
- " \"disk\": 0,"
- " \"gpus\": 0,"
- " \"mem\": 0"
+ " \"cpus\": 0, \"disk\": 0, \"gpus\": 0, \"mem\": 0"
+ " },"
+ " \"quota\": {"
+ " \"role\": \"role2\","
+ " \"consumed\": {},"
+ " \"guarantee\": {},"
+ " \"limit\": {}"
" },"
" \"weight\": 1.0"
" }"
@@ -728,7 +769,9 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
ASSERT_SOME(expected);
- EXPECT_EQ(expected.get(), parse.get());
+ EXPECT_EQ(*expected, *parse)
+ << "expected " << stringify(*expected)
+ << " vs actual " << stringify(*parse);
}
// Set expectation that Master receives teardown call.
@@ -764,8 +807,9 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
ASSERT_SOME(expected);
- EXPECT_EQ(expected.get(), parse.get());
- }
+ EXPECT_EQ(*expected, *parse)
+ << "expected " << stringify(*expected)
+ << " vs actual " << stringify(*parse); }
}