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 2017/12/02 05:34:30 UTC
[4/6] mesos git commit: Updated the tests to use MULTI_ROLE
frameworks by default.
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a87d51e/src/tests/reservation_endpoints_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_endpoints_tests.cpp b/src/tests/reservation_endpoints_tests.cpp
index cc8499a..99dbd42 100644
--- a/src/tests/reservation_endpoints_tests.cpp
+++ b/src/tests/reservation_endpoints_tests.cpp
@@ -80,7 +80,7 @@ public:
{
master::Flags flags = MesosTest::CreateMasterFlags();
flags.allocation_interval = Milliseconds(50);
- flags.roles = createFrameworkInfo().role();
+ flags.roles = createFrameworkInfo().roles(0);
return flags;
}
@@ -88,7 +88,7 @@ public:
FrameworkInfo createFrameworkInfo()
{
FrameworkInfo info = DEFAULT_FRAMEWORK_INFO;
- info.set_role("role");
+ info.set_roles(0, "role");
return info;
}
@@ -126,7 +126,7 @@ TEST_F(ReservationEndpointsTest, AvailableResources)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
Future<Response> response = process::http::post(
@@ -156,7 +156,7 @@ TEST_F(ReservationEndpointsTest, AvailableResources)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
Future<Nothing> recoverResources;
EXPECT_CALL(allocator, recoverResources(_, _, _, _))
@@ -189,7 +189,7 @@ TEST_F(ReservationEndpointsTest, AvailableResources)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// Ignore subsequent `recoverResources` calls triggered from recovering the
// resources that this framework is currently holding onto.
@@ -225,7 +225,7 @@ TEST_F(ReservationEndpointsTest, ReserveOfferedResources)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
MockScheduler sched;
@@ -247,7 +247,7 @@ TEST_F(ReservationEndpointsTest, ReserveOfferedResources)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers));
@@ -269,7 +269,7 @@ TEST_F(ReservationEndpointsTest, ReserveOfferedResources)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -299,8 +299,9 @@ TEST_F(ReservationEndpointsTest, UnreserveOfferedResources)
FrameworkInfo frameworkInfo = createFrameworkInfo();
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
+
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
Future<Response> response = process::http::post(
@@ -330,7 +331,7 @@ TEST_F(ReservationEndpointsTest, UnreserveOfferedResources)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers));
@@ -352,7 +353,7 @@ TEST_F(ReservationEndpointsTest, UnreserveOfferedResources)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -390,7 +391,7 @@ TEST_F(ReservationEndpointsTest, ReserveAvailableAndOfferedResources)
Resources total = available + offered;
Resources dynamicallyReserved = total.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
MockScheduler sched;
@@ -420,7 +421,7 @@ TEST_F(ReservationEndpointsTest, ReserveAvailableAndOfferedResources)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(available + offered, frameworkInfo.role())));
+ allocatedResources(available + offered, frameworkInfo.roles(0))));
// Launch a task on the 'available' resources portion of the offer, which
// recovers 'offered' resources portion.
@@ -455,7 +456,7 @@ TEST_F(ReservationEndpointsTest, ReserveAvailableAndOfferedResources)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(offered, frameworkInfo.role())));
+ allocatedResources(offered, frameworkInfo.roles(0))));
// Kill the task running on 'available' resources to make it available.
EXPECT_CALL(sched, statusUpdate(_, _));
@@ -471,7 +472,7 @@ TEST_F(ReservationEndpointsTest, ReserveAvailableAndOfferedResources)
AWAIT_READY(availableResources);
EXPECT_TRUE(availableResources->contains(
- allocatedResources(available, frameworkInfo.role())));
+ allocatedResources(available, frameworkInfo.roles(0))));
// At this point, we have 'available' resources in the allocator, and
// 'offered' resources offered to the framework.
@@ -501,7 +502,7 @@ TEST_F(ReservationEndpointsTest, ReserveAvailableAndOfferedResources)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
// Ignore subsequent `recoverResources` calls triggered from recovering the
// resources that this framework is currently holding onto.
@@ -541,12 +542,12 @@ TEST_F(ReservationEndpointsTest, UnreserveAvailableAndOfferedResources)
Resources available = Resources::parse("cpus:1;mem:128").get();
available = available.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
Resources offered = Resources::parse("mem:384").get();
offered = offered.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
Resources total = available + offered;
@@ -587,7 +588,7 @@ TEST_F(ReservationEndpointsTest, UnreserveAvailableAndOfferedResources)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(available + offered, frameworkInfo.role())));
+ allocatedResources(available + offered, frameworkInfo.roles(0))));
// Launch a task on the 'available' resources portion of the offer, which
// recovers 'offered' resources portion.
@@ -622,7 +623,7 @@ TEST_F(ReservationEndpointsTest, UnreserveAvailableAndOfferedResources)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(offered, frameworkInfo.role())));
+ allocatedResources(offered, frameworkInfo.roles(0))));
// Kill the task running on 'available' resources to make it available.
EXPECT_CALL(sched, statusUpdate(_, _));
@@ -638,7 +639,7 @@ TEST_F(ReservationEndpointsTest, UnreserveAvailableAndOfferedResources)
AWAIT_READY(availableResources);
EXPECT_TRUE(availableResources->contains(
- allocatedResources(available, frameworkInfo.role())));
+ allocatedResources(available, frameworkInfo.roles(0))));
// At this point, we have 'available' resources in the allocator, and
// 'offered' resources offered to the framework.
@@ -668,7 +669,7 @@ TEST_F(ReservationEndpointsTest, UnreserveAvailableAndOfferedResources)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// Ignore subsequent `recoverResources` calls triggered from recovering the
// resources that this framework is currently holding onto.
@@ -715,10 +716,10 @@ TEST_F(ReservationEndpointsTest, LabeledResources)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources labeledResources1 = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal(), labels1)).get();
Resources labeledResources2 = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal(), labels2)).get();
// Make two resource reservations with different labels.
@@ -758,9 +759,9 @@ TEST_F(ReservationEndpointsTest, LabeledResources)
Resources offeredResources = Resources(offer.resources());
EXPECT_TRUE(offeredResources.contains(
- allocatedResources(labeledResources1, frameworkInfo.role())));
+ allocatedResources(labeledResources1, frameworkInfo.roles(0))));
EXPECT_TRUE(offeredResources.contains(
- allocatedResources(labeledResources2, frameworkInfo.role())));
+ allocatedResources(labeledResources2, frameworkInfo.roles(0))));
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers));
@@ -784,13 +785,13 @@ TEST_F(ReservationEndpointsTest, LabeledResources)
offeredResources = Resources(offer.resources());
EXPECT_FALSE(offeredResources.contains(
- allocatedResources(totalSlaveResources, frameworkInfo.role())));
+ allocatedResources(totalSlaveResources, frameworkInfo.roles(0))));
EXPECT_TRUE(offeredResources.contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
EXPECT_FALSE(offeredResources.contains(
- allocatedResources(labeledResources1, frameworkInfo.role())));
+ allocatedResources(labeledResources1, frameworkInfo.roles(0))));
EXPECT_TRUE(offeredResources.contains(
- allocatedResources(labeledResources2, frameworkInfo.role())));
+ allocatedResources(labeledResources2, frameworkInfo.roles(0))));
// Now that the first labeled reservation has been unreserved,
// attempting to unreserve it again should fail.
@@ -825,11 +826,11 @@ TEST_F(ReservationEndpointsTest, LabeledResources)
offeredResources = Resources(offer.resources());
EXPECT_TRUE(offeredResources.contains(
- allocatedResources(totalSlaveResources, frameworkInfo.role())));
+ allocatedResources(totalSlaveResources, frameworkInfo.roles(0))));
EXPECT_FALSE(offeredResources.contains(
- allocatedResources(labeledResources1, frameworkInfo.role())));
+ allocatedResources(labeledResources1, frameworkInfo.roles(0))));
EXPECT_FALSE(offeredResources.contains(
- allocatedResources(labeledResources2, frameworkInfo.role())));
+ allocatedResources(labeledResources2, frameworkInfo.roles(0))));
// Ignore subsequent `recoverResources` calls triggered from recovering the
// resources that this framework is currently holding onto.
@@ -924,7 +925,7 @@ TEST_F(ReservationEndpointsTest, InsufficientResources)
Resources unreserved = Resources::parse("cpus:4;mem:4096").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
process::http::Headers headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL);
@@ -965,7 +966,7 @@ TEST_F(ReservationEndpointsTest, NoHeader)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
Future<Response> response = process::http::post(
@@ -1057,13 +1058,13 @@ TEST_F(ReservationEndpointsTest, GoodReserveAndUnreserveACL)
DEFAULT_CREDENTIAL.principal());
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
masterFlags.allocation_interval = Milliseconds(50);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
EXPECT_CALL(allocator, initialize(_, _, _, _));
@@ -1087,7 +1088,7 @@ TEST_F(ReservationEndpointsTest, GoodReserveAndUnreserveACL)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
// Reserve the resources.
@@ -1180,13 +1181,13 @@ TEST_F(ReservationEndpointsTest, BadReserveACL)
reserve->mutable_roles()->set_type(mesos::ACL::Entity::NONE);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
masterFlags.allocation_interval = Milliseconds(50);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
EXPECT_CALL(allocator, initialize(_, _, _, _));
@@ -1210,7 +1211,7 @@ TEST_F(ReservationEndpointsTest, BadReserveACL)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
// Attempt to reserve the resources.
@@ -1239,13 +1240,13 @@ TEST_F(ReservationEndpointsTest, BadUnreserveACL)
unreserve->mutable_reserver_principals()->set_type(mesos::ACL::Entity::NONE);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
masterFlags.allocation_interval = Milliseconds(50);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
EXPECT_CALL(allocator, initialize(_, _, _, _));
@@ -1269,7 +1270,7 @@ TEST_F(ReservationEndpointsTest, BadUnreserveACL)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
// Reserve the resources.
@@ -1470,7 +1471,7 @@ TEST_F(ReservationEndpointsTest, ReserveAndUnreserveNoAuthentication)
TestAllocator<> allocator;
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
@@ -1503,7 +1504,7 @@ TEST_F(ReservationEndpointsTest, ReserveAndUnreserveNoAuthentication)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReservedWithNoPrincipal = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo()).get();
// Try a reservation with no principal in `ReservationInfo` and no
@@ -1527,7 +1528,7 @@ TEST_F(ReservationEndpointsTest, ReserveAndUnreserveNoAuthentication)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(Accepted().status, response);
Resources dynamicallyReservedWithPrincipal = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
// Try a reservation with a principal in `ReservationInfo` and no
@@ -1579,12 +1580,13 @@ TEST_F(ReservationEndpointsTest, DifferentPrincipalsSameRole)
FrameworkInfo frameworkInfo = createFrameworkInfo();
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
+
Resources dynamicallyReserved1 = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL.principal())).get();
Resources dynamicallyReserved2 = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(DEFAULT_CREDENTIAL_2.principal())).get();
Future<Response> response = process::http::post(
@@ -1623,9 +1625,9 @@ TEST_F(ReservationEndpointsTest, DifferentPrincipalsSameRole)
Resources resources = Resources(offer.resources());
EXPECT_TRUE(resources.contains(
- allocatedResources(dynamicallyReserved1, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved1, frameworkInfo.roles(0))));
EXPECT_TRUE(resources.contains(
- allocatedResources(dynamicallyReserved2, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved2, frameworkInfo.roles(0))));
driver.stop();
driver.join();
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a87d51e/src/tests/reservation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_tests.cpp b/src/tests/reservation_tests.cpp
index 4504831..77e5dac 100644
--- a/src/tests/reservation_tests.cpp
+++ b/src/tests/reservation_tests.cpp
@@ -89,11 +89,11 @@ class ReservationTest : public MesosTest {};
TEST_F(ReservationTest, ReserveThenUnreserve)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -116,7 +116,7 @@ TEST_F(ReservationTest, ReserveThenUnreserve)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -137,7 +137,7 @@ TEST_F(ReservationTest, ReserveThenUnreserve)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -153,7 +153,7 @@ TEST_F(ReservationTest, ReserveThenUnreserve)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -169,7 +169,7 @@ TEST_F(ReservationTest, ReserveThenUnreserve)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -186,7 +186,7 @@ TEST_F(ReservationTest, ReserveThenUnreserve)
TEST_F(ReservationTest, ReserveTwiceWithDoubleValue)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
@@ -213,7 +213,7 @@ TEST_F(ReservationTest, ReserveTwiceWithDoubleValue)
Resources unreserved = Resources::parse("cpus:0.1;mem:512").get();
Resources dynamicallyReserved =
unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
Future<vector<Offer>> offers;
@@ -231,7 +231,7 @@ TEST_F(ReservationTest, ReserveTwiceWithDoubleValue)
// In the first offer, expect an offer with unreserved resources.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -247,7 +247,7 @@ TEST_F(ReservationTest, ReserveTwiceWithDoubleValue)
// In the second offer, expect an offer with reserved resources.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -268,11 +268,11 @@ TEST_F(ReservationTest, ReserveTwiceWithDoubleValue)
Resources reserved = Resources::parse("cpus:0.2;mem:512").get();
Resources finalReservation =
reserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(finalReservation, frameworkInfo.role())));
+ allocatedResources(finalReservation, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -290,11 +290,11 @@ TEST_F(ReservationTest, ReserveTwiceWithDoubleValue)
TEST_F(ReservationTest, ReserveAndLaunchThenUnreserve)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -317,7 +317,7 @@ TEST_F(ReservationTest, ReserveAndLaunchThenUnreserve)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -338,7 +338,7 @@ TEST_F(ReservationTest, ReserveAndLaunchThenUnreserve)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// Create a task.
TaskInfo taskInfo =
@@ -369,7 +369,7 @@ TEST_F(ReservationTest, ReserveAndLaunchThenUnreserve)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -390,7 +390,7 @@ TEST_F(ReservationTest, ReserveAndLaunchThenUnreserve)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
EXPECT_CALL(exec, shutdown(_))
.Times(AtMost(1));
@@ -412,11 +412,11 @@ TEST_F(ReservationTest, ReserveShareWithinRole)
FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
frameworkInfo1.set_name("framework1");
- frameworkInfo1.set_role(role);
+ frameworkInfo1.set_roles(0, role);
FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
frameworkInfo1.set_name("framework2");
- frameworkInfo2.set_role(role);
+ frameworkInfo2.set_roles(0, role);
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
@@ -462,7 +462,7 @@ TEST_F(ReservationTest, ReserveShareWithinRole)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo1.role())));
+ allocatedResources(unreserved, frameworkInfo1.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched1, resourceOffers(&driver1, _))
@@ -483,7 +483,7 @@ TEST_F(ReservationTest, ReserveShareWithinRole)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo1.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo1.roles(0))));
// The filter to decline the offer "forever".
Filters filtersForever;
@@ -509,7 +509,7 @@ TEST_F(ReservationTest, ReserveShareWithinRole)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo1.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo1.roles(0))));
driver1.stop();
driver1.join();
@@ -527,11 +527,11 @@ TEST_F(ReservationTest, DropReserveTooLarge)
TestAllocator<> allocator;
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
EXPECT_CALL(allocator, initialize(_, _, _, _));
@@ -554,7 +554,7 @@ TEST_F(ReservationTest, DropReserveTooLarge)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources unreservedTooLarge = Resources::parse("cpus:1;mem:1024").get();
Resources dynamicallyReservedTooLarge = unreservedTooLarge.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture the offers from 'resourceOffers'.
@@ -577,7 +577,7 @@ TEST_F(ReservationTest, DropReserveTooLarge)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -606,7 +606,7 @@ TEST_F(ReservationTest, DropReserveTooLarge)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -620,11 +620,11 @@ TEST_F(ReservationTest, DropReserveStaticReservation)
TestAllocator<> allocator;
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
EXPECT_CALL(allocator, initialize(_, _, _, _));
@@ -647,7 +647,7 @@ TEST_F(ReservationTest, DropReserveStaticReservation)
Resources staticallyReserved =
Resources::parse("cpus(role):1;mem(role):512").get();
Resources dynamicallyReserved = staticallyReserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -671,7 +671,7 @@ TEST_F(ReservationTest, DropReserveStaticReservation)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(staticallyReserved, frameworkInfo.role())));
+ allocatedResources(staticallyReserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -697,7 +697,7 @@ TEST_F(ReservationTest, DropReserveStaticReservation)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(staticallyReserved, frameworkInfo.role())));
+ allocatedResources(staticallyReserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -711,11 +711,11 @@ TEST_F(ReservationTest, DropReserveStaticReservation)
TEST_F(ReservationTest, SendingCheckpointResourcesMessage)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -733,12 +733,12 @@ TEST_F(ReservationTest, SendingCheckpointResourcesMessage)
Resources unreserved1 = Resources::parse("cpus:8").get();
Resources reserved1 = unreserved1.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
Resources unreserved2 = Resources::parse("mem:2048").get();
Resources reserved2 = unreserved2.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -761,7 +761,7 @@ TEST_F(ReservationTest, SendingCheckpointResourcesMessage)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved1 + unreserved2, frameworkInfo.role())));
+ allocatedResources(unreserved1 + unreserved2, frameworkInfo.roles(0))));
Future<CheckpointResourcesMessage> message3 =
FUTURE_PROTOBUF(CheckpointResourcesMessage(), _, _);
@@ -813,11 +813,11 @@ TEST_F(ReservationTest, SendingCheckpointResourcesMessage)
TEST_F(ReservationTest, ResourcesCheckpointing)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -836,7 +836,7 @@ TEST_F(ReservationTest, ResourcesCheckpointing)
Resources unreserved = Resources::parse("cpus:8;mem:2048").get();
Resources reserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -858,7 +858,7 @@ TEST_F(ReservationTest, ResourcesCheckpointing)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
Future<CheckpointResourcesMessage> checkpointResources =
FUTURE_PROTOBUF(CheckpointResourcesMessage(), _, slave.get()->pid);
@@ -905,11 +905,11 @@ TEST_F(ReservationTest, ResourcesCheckpointing)
TEST_F(ReservationTest, MasterFailover)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master1 = StartMaster(masterFlags);
ASSERT_SOME(master1);
@@ -927,7 +927,7 @@ TEST_F(ReservationTest, MasterFailover)
Resources unreserved = Resources::parse("cpus:8;mem:2048").get();
Resources reserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -1005,7 +1005,7 @@ TEST_F(ReservationTest, MasterFailover)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(reserved, frameworkInfo.role())));
+ allocatedResources(reserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -1027,11 +1027,11 @@ TEST_F(ReservationTest, MasterFailover)
TEST_F(ReservationTest, CompatibleCheckpointedResources)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -1053,7 +1053,7 @@ TEST_F(ReservationTest, CompatibleCheckpointedResources)
Resources unreserved = Resources::parse("cpus:8;mem:2048").get();
Resources reserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -1075,7 +1075,7 @@ TEST_F(ReservationTest, CompatibleCheckpointedResources)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
Future<CheckpointResourcesMessage> checkpointResources =
FUTURE_PROTOBUF(CheckpointResourcesMessage(), _, _);
@@ -1135,11 +1135,11 @@ TEST_F(ReservationTest, CompatibleCheckpointedResources)
TEST_F(ReservationTest, CompatibleCheckpointedResourcesWithPersistentVolumes)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -1161,12 +1161,12 @@ TEST_F(ReservationTest, CompatibleCheckpointedResourcesWithPersistentVolumes)
Resources unreserved = Resources::parse("cpus:8;mem:2048").get();
Resources reserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
Resource unreservedDisk = Resources::parse("disk", "1024", "*").get();
Resource reservedDisk = unreservedDisk;
- reservedDisk.set_role(frameworkInfo.role());
+ reservedDisk.set_role(frameworkInfo.roles(0));
reservedDisk.mutable_reservation()->CopyFrom(
createReservationInfo(frameworkInfo.principal()));
@@ -1195,7 +1195,7 @@ TEST_F(ReservationTest, CompatibleCheckpointedResourcesWithPersistentVolumes)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved + unreservedDisk, frameworkInfo.role())));
+ allocatedResources(unreserved + unreservedDisk, frameworkInfo.roles(0))));
Future<CheckpointResourcesMessage> message2 =
FUTURE_PROTOBUF(CheckpointResourcesMessage(), _, _);
@@ -1233,7 +1233,7 @@ TEST_F(ReservationTest, CompatibleCheckpointedResourcesWithPersistentVolumes)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(reserved + volume, frameworkInfo.role())));
+ allocatedResources(reserved + volume, frameworkInfo.roles(0))));
Future<OfferID> rescindedOfferId;
@@ -1286,11 +1286,11 @@ TEST_F(ReservationTest, CompatibleCheckpointedResourcesWithPersistentVolumes)
TEST_F(ReservationTest, IncompatibleCheckpointedResources)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -1312,7 +1312,7 @@ TEST_F(ReservationTest, IncompatibleCheckpointedResources)
Resources unreserved = Resources::parse("cpus:8;mem:2048").get();
Resources reserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -1333,7 +1333,7 @@ TEST_F(ReservationTest, IncompatibleCheckpointedResources)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
Future<CheckpointResourcesMessage> checkpointResources =
FUTURE_PROTOBUF(CheckpointResourcesMessage(), _, _);
@@ -1405,13 +1405,13 @@ TEST_F(ReservationTest, GoodACLReserveThenUnreserve)
DEFAULT_CREDENTIAL.principal());
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -1436,7 +1436,7 @@ TEST_F(ReservationTest, GoodACLReserveThenUnreserve)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -1457,7 +1457,7 @@ TEST_F(ReservationTest, GoodACLReserveThenUnreserve)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -1473,7 +1473,7 @@ TEST_F(ReservationTest, GoodACLReserveThenUnreserve)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -1489,7 +1489,7 @@ TEST_F(ReservationTest, GoodACLReserveThenUnreserve)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -1508,13 +1508,13 @@ TEST_F(ReservationTest, BadACLDropReserve)
reserve->mutable_roles()->set_type(mesos::ACL::Entity::ANY);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -1539,7 +1539,7 @@ TEST_F(ReservationTest, BadACLDropReserve)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -1560,7 +1560,7 @@ TEST_F(ReservationTest, BadACLDropReserve)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -1577,7 +1577,7 @@ TEST_F(ReservationTest, BadACLDropReserve)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -1601,13 +1601,13 @@ TEST_F(ReservationTest, BadACLDropUnreserve)
unreserve->mutable_reserver_principals()->set_type(mesos::ACL::Entity::NONE);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -1633,12 +1633,12 @@ TEST_F(ReservationTest, BadACLDropUnreserve)
// Define the resources to be reserved.
Resources unreserved1 = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved1 = unreserved1.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
Resources unreserved2 = Resources::parse("cpus:0.5;mem:256").get();
Resources dynamicallyReserved2 = unreserved2.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -1660,7 +1660,7 @@ TEST_F(ReservationTest, BadACLDropUnreserve)
// The slave's total resources are twice those defined by `unreserved1`.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved1 + unreserved1, frameworkInfo.role())));
+ allocatedResources(unreserved1 + unreserved1, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -1680,7 +1680,7 @@ TEST_F(ReservationTest, BadACLDropUnreserve)
EXPECT_TRUE(Resources(offer.resources()).contains(
allocatedResources(
dynamicallyReserved1 + unreserved1,
- frameworkInfo.role())));
+ frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -1702,7 +1702,7 @@ TEST_F(ReservationTest, BadACLDropUnreserve)
EXPECT_TRUE(Resources(offer.resources()).contains(
allocatedResources(
dynamicallyReserved1 + dynamicallyReserved2 + unreserved2,
- frameworkInfo.role())));
+ frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -1730,13 +1730,13 @@ TEST_F(ReservationTest, ACLMultipleOperations)
unreserve->mutable_reserver_principals()->set_type(mesos::ACL::Entity::NONE);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
masterFlags.allocation_interval = Milliseconds(5);
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -1767,12 +1767,12 @@ TEST_F(ReservationTest, ACLMultipleOperations)
// Define the resources to be reserved.
Resources unreserved1 = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved1 = unreserved1.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
Resources unreserved2 = Resources::parse("cpus:0.5;mem:256").get();
Resources dynamicallyReserved2 = unreserved2.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from 'resourceOffers'.
@@ -1800,7 +1800,7 @@ TEST_F(ReservationTest, ACLMultipleOperations)
// The slave's total resources are twice those defined by `unreserved1`.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved1 + unreserved1, frameworkInfo.role())));
+ allocatedResources(unreserved1 + unreserved1, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -1823,7 +1823,7 @@ TEST_F(ReservationTest, ACLMultipleOperations)
EXPECT_TRUE(Resources(offer.resources()).contains(
allocatedResources(
dynamicallyReserved1 + unreserved1,
- frameworkInfo.role())));
+ frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -1868,7 +1868,7 @@ TEST_F(ReservationTest, ACLMultipleOperations)
EXPECT_TRUE(Resources(offer.resources()).contains(
allocatedResources(
dynamicallyReserved1 + dynamicallyReserved2 + unreserved2,
- frameworkInfo.role())));
+ frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -1905,7 +1905,7 @@ TEST_F(ReservationTest, ACLMultipleOperations)
EXPECT_TRUE(Resources(offer.resources()).contains(
allocatedResources(
dynamicallyReserved1 + dynamicallyReserved2 + unreserved2,
- frameworkInfo.role())));
+ frameworkInfo.roles(0))));
// Check that the task launched as expected.
EXPECT_EQ(TASK_FINISHED, failedTaskStatus->state());
@@ -1928,7 +1928,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithoutPrincipal)
// Create a framework without a principal.
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
frameworkInfo.clear_principal();
// Create a master with no framework authentication.
@@ -1958,7 +1958,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithoutPrincipal)
// Create dynamically reserved resources whose `ReservationInfo` does not
// contain a principal.
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(), createReservationInfo()).get();
+ frameworkInfo.roles(0), createReservationInfo()).get();
// We use this to capture offers from `resourceOffers`.
Future<vector<Offer>> offers;
@@ -1980,7 +1980,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithoutPrincipal)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// The expectation for the offer with reserved resources.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -1999,7 +1999,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithoutPrincipal)
// Make sure that the reservation succeeded.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
// An expectation for an offer with unreserved resources.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -2019,7 +2019,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithoutPrincipal)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -2036,7 +2036,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithPrincipal)
// Create a framework with a principal.
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
// Create a master with no framework authentication.
master::Flags masterFlags = CreateMasterFlags();
@@ -2065,7 +2065,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithPrincipal)
// Create dynamically reserved resources whose `ReservationInfo` contains a
// principal.
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from `resourceOffers`.
@@ -2088,7 +2088,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithPrincipal)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// The expectation for the offer with reserved resources.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -2107,7 +2107,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithPrincipal)
// Make sure that the reservation succeeded.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
// An expectation for an offer with unreserved resources.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -2127,7 +2127,7 @@ TEST_F(ReservationTest, WithoutAuthenticationWithPrincipal)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -2142,7 +2142,7 @@ TEST_F(ReservationTest, DropReserveWithInvalidRole)
const string invalidRole = "invalid-role";
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(frameworkRole);
+ frameworkInfo.set_roles(0, frameworkRole);
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
@@ -2187,7 +2187,7 @@ TEST_F(ReservationTest, DropReserveWithInvalidRole)
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -2221,7 +2221,7 @@ TEST_F(ReservationTest, DropReserveWithInvalidRole)
offer = offers->front();
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -2235,12 +2235,12 @@ TEST_F(ReservationTest, PreventUnreservingAlienResources)
const string frameworkRole1 = "role1";
FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
frameworkInfo1.set_name("framework1");
- frameworkInfo1.set_role(frameworkRole1);
+ frameworkInfo1.set_roles(0, frameworkRole1);
const string frameworkRole2 = "role2";
FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo1.set_name("framework2");
- frameworkInfo2.set_role(frameworkRole2);
+ frameworkInfo2.set_name("framework2");
+ frameworkInfo2.set_roles(0, frameworkRole2);
master::Flags masterFlags = CreateMasterFlags();
masterFlags.allocation_interval = Milliseconds(5);
@@ -2286,7 +2286,7 @@ TEST_F(ReservationTest, PreventUnreservingAlienResources)
const Resources unreserved = Resources::parse("cpus:1;mem:512").get();
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo1.role())));
+ allocatedResources(unreserved, frameworkInfo1.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched1, resourceOffers(&driver1, _))
@@ -2314,9 +2314,9 @@ TEST_F(ReservationTest, PreventUnreservingAlienResources)
offer = offers->front();
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo1.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo1.roles(0))));
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(halfMemory, frameworkInfo1.role())));
+ allocatedResources(halfMemory, frameworkInfo1.roles(0))));
// The filter to decline the offer "forever".
Filters filtersForever;
@@ -2341,9 +2341,9 @@ TEST_F(ReservationTest, PreventUnreservingAlienResources)
offer = offers->front();
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(halfMemory, frameworkInfo2.role())));
+ allocatedResources(halfMemory, frameworkInfo2.roles(0))));
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo2.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo2.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched2, resourceOffers(&driver2, _))
@@ -2361,9 +2361,9 @@ TEST_F(ReservationTest, PreventUnreservingAlienResources)
AWAIT_READY(offers);
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(halfMemory, frameworkInfo2.role())));
+ allocatedResources(halfMemory, frameworkInfo2.roles(0))));
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo2.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo2.roles(0))));
// Decline the offer "forever" in order to force `framework1` to
// receive the remaining resources.
@@ -2387,9 +2387,9 @@ TEST_F(ReservationTest, PreventUnreservingAlienResources)
// Make sure that the reservation is still in place.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(halfMemory, frameworkInfo1.role())));
+ allocatedResources(halfMemory, frameworkInfo1.roles(0))));
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo1.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo1.roles(0))));
driver1.stop();
driver1.join();
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a87d51e/src/tests/role_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/role_tests.cpp b/src/tests/role_tests.cpp
index 4285e64..6b879df 100644
--- a/src/tests/role_tests.cpp
+++ b/src/tests/role_tests.cpp
@@ -70,7 +70,7 @@ class RoleTest : public MesosTest {};
TEST_F(RoleTest, BadRegister)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("invalid");
+ frameworkInfo.set_roles(0, "invalid");
master::Flags masterFlags = CreateMasterFlags();
masterFlags.roles = "foo,bar";
@@ -115,7 +115,7 @@ TEST_F(RoleTest, ImplicitRoleRegister)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("new-role-name");
+ frameworkInfo.set_roles(0, "new-role-name");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -128,7 +128,7 @@ TEST_F(RoleTest, ImplicitRoleRegister)
Resources unreserved = Resources::parse("disk:1024").get();
Resources dynamicallyReserved = unreserved.flatten(
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
createReservationInfo(frameworkInfo.principal())).get();
// We use this to capture offers from `resourceOffers`.
@@ -149,9 +149,9 @@ TEST_F(RoleTest, ImplicitRoleRegister)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -167,13 +167,13 @@ TEST_F(RoleTest, ImplicitRoleRegister)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
Resources volume = createPersistentVolume(
Megabytes(64),
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
"id1",
"path1",
frameworkInfo.principal(),
@@ -193,11 +193,11 @@ TEST_F(RoleTest, ImplicitRoleRegister)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -227,7 +227,7 @@ TEST_F(RoleTest, ImplicitRoleStaticReservation)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -258,7 +258,7 @@ TEST_F(RoleTest, ImplicitRoleStaticReservation)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(staticallyReserved, frameworkInfo.role())));
+ allocatedResources(staticallyReserved, frameworkInfo.roles(0))));
// Create a task to launch with the resources of `staticallyReserved`.
TaskInfo taskInfo =
@@ -467,7 +467,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, EndpointImplicitRolesWeights)
ASSERT_SOME(master);
FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo1.set_role("roleX");
+ frameworkInfo1.set_roles(0, "roleX");
MockScheduler sched1;
MesosSchedulerDriver driver1(
@@ -480,7 +480,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(RoleTest, EndpointImplicitRolesWeights)
driver1.start();
FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo2.set_role("roleZ");
+ frameworkInfo2.set_roles(0, "roleZ");
MockScheduler sched2;
MesosSchedulerDriver driver2(
@@ -673,10 +673,8 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
ASSERT_SOME(master);
FrameworkInfo framework = DEFAULT_FRAMEWORK_INFO;
- framework.add_roles("role1");
+ framework.set_roles(0, "role1");
framework.add_roles("role2");
- framework.add_capabilities()->set_type(
- FrameworkInfo::Capability::MULTI_ROLE);
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -929,7 +927,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
auto runTask = [&master, &PATH, DISK_SIZE](
const string& role, const string& id) {
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(role);
+ frameworkInfo.set_roles(0, role);
MockScheduler sched;
MesosSchedulerDriver driver(
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a87d51e/src/tests/scheduler_http_api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/scheduler_http_api_tests.cpp b/src/tests/scheduler_http_api_tests.cpp
index cc03be0..4e17471 100644
--- a/src/tests/scheduler_http_api_tests.cpp
+++ b/src/tests/scheduler_http_api_tests.cpp
@@ -324,7 +324,7 @@ TEST_P(SchedulerHttpApiTest, RejectFrameworkWithInvalidRole)
Call::Subscribe* subscribe = call.mutable_subscribe();
v1::FrameworkInfo framework = v1::DEFAULT_FRAMEWORK_INFO;
// Set invalid role.
- framework.set_role("/test/test1");
+ framework.set_roles(0, "/test/test1");
subscribe->mutable_framework_info()->CopyFrom(framework);
// Retrieve the parameter passed as content type to this test.
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a87d51e/src/tests/slave_authorization_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_authorization_tests.cpp b/src/tests/slave_authorization_tests.cpp
index 4e55148..834ee05 100644
--- a/src/tests/slave_authorization_tests.cpp
+++ b/src/tests/slave_authorization_tests.cpp
@@ -166,7 +166,7 @@ TYPED_TEST(SlaveAuthorizerTest, FilterStateEndpoint)
// Register framework with user "bar".
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
frameworkInfo.set_user("bar");
// Create an executor with user "bar".
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a87d51e/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp
index 4a0207e..4f5a6a2 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -1851,13 +1851,13 @@ TYPED_TEST(SlaveRecoveryTest, RemoveNonCheckpointingFramework)
Offer offer1 = offer;
Resources resources1 = allocatedResources(
- Resources::parse("cpus:1;mem:512").get(), frameworkInfo.role());
+ Resources::parse("cpus:1;mem:512").get(), frameworkInfo.roles(0));
offer1.mutable_resources()->CopyFrom(resources1);
tasks.push_back(createTask(offer1, "sleep 1000")); // Long-running task.
Offer offer2 = offer;
Resources resources2 = allocatedResources(
- Resources::parse("cpus:1;mem:512").get(), frameworkInfo.role());
+ Resources::parse("cpus:1;mem:512").get(), frameworkInfo.roles(0));
offer2.mutable_resources()->CopyFrom(resources2);
tasks.push_back(createTask(offer2, "sleep 1000")); // Long-running task,
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a87d51e/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 2a568a9..e3e50dd 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -785,12 +785,12 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest, GetExecutorInfo)
FrameworkID frameworkId;
frameworkId.set_value("20141010-221431-251662764-60288-32120-0000");
- FrameworkInfo frameworkInfo;
+ FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
frameworkInfo.mutable_id()->CopyFrom(frameworkId);
// Launch a task with the command executor.
Resources taskResources = Resources::parse("cpus:0.1;mem:32").get();
- taskResources.allocate(frameworkInfo.role());
+ taskResources.allocate(frameworkInfo.roles(0));
TaskInfo task;
task.set_name("task");
@@ -843,14 +843,14 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest, GetExecutorInfoForTaskWithContainer)
MockSlave slave(CreateSlaveFlags(), &detector, &containerizer);
- FrameworkInfo frameworkInfo;
+ FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
frameworkInfo.mutable_id()->set_value(
"20141010-221431-251662764-60288-12345-0000");
// Launch a task with the command executor and ContainerInfo with
// NetworkInfo.
Resources taskResources = Resources::parse("cpus:0.1;mem:32").get();
- taskResources.allocate(frameworkInfo.role());
+ taskResources.allocate(frameworkInfo.roles(0));
TaskInfo task;
task.set_name("task");
@@ -920,12 +920,12 @@ TEST_F(SlaveTest, ROOT_LaunchTaskInfoWithContainerInfo)
StandaloneMasterDetector detector;
MockSlave slave(flags, &detector, containerizer.get());
- FrameworkInfo frameworkInfo;
+ FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
frameworkInfo.mutable_id()->set_value(
"20141010-221431-251662764-60288-12345-0000");
Resources taskResources = Resources::parse("cpus:0.1;mem:32").get();
- taskResources.allocate(frameworkInfo.role());
+ taskResources.allocate(frameworkInfo.roles(0));
// Launch a task with the command executor and ContainerInfo with
// NetworkInfo.
@@ -1642,9 +1642,14 @@ TEST_F(SlaveTest, StateEndpoint)
EXPECT_EQ(1u, frameworks.values.size());
ASSERT_TRUE(frameworks.values[0].is<JSON::Object>());
- JSON::Object framework = frameworks.values[0].as<JSON::Object>();
- EXPECT_EQ("*", framework.values["role"]);
+ JSON::Object roles = {
+ { "roles", JSON::Array { DEFAULT_FRAMEWORK_INFO.roles(0) } }
+ };
+
+ EXPECT_TRUE(frameworks.values[0].contains(roles));
+
+ JSON::Object framework = frameworks.values[0].as<JSON::Object>();
EXPECT_EQ("default", framework.values["name"]);
EXPECT_EQ(model(resources.get()), state.values["resources"]);
http://git-wip-us.apache.org/repos/asf/mesos/blob/5a87d51e/src/tests/upgrade_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/upgrade_tests.cpp b/src/tests/upgrade_tests.cpp
index 03ca360..2a66490 100644
--- a/src/tests/upgrade_tests.cpp
+++ b/src/tests/upgrade_tests.cpp
@@ -119,6 +119,8 @@ TEST_F(UpgradeTest, ReregisterOldAgentWithMultiRoleMaster)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+ frameworkInfo.clear_capabilities();
+ frameworkInfo.clear_roles();
frameworkInfo.set_role("foo");
MockScheduler sched;
@@ -335,10 +337,7 @@ TEST_F(UpgradeTest, UpgradeSlaveIntoMultiRole)
AWAIT_READY(slaveRegisteredMessage);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.clear_role();
- frameworkInfo.add_roles("foo");
- frameworkInfo.add_capabilities()->set_type(
- FrameworkInfo::Capability::MULTI_ROLE);
+ frameworkInfo.set_roles(0, "foo");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -408,6 +407,8 @@ TEST_F(UpgradeTest, MultiRoleSchedulerUpgrade)
ASSERT_SOME(agent);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+ frameworkInfo.clear_capabilities();
+ frameworkInfo.clear_roles();
frameworkInfo.set_role("foo");
MockScheduler sched1;