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:21 UTC
[3/4] mesos git commit: Updated the tests to use MULTI_ROLE
frameworks by default.
Updated the tests to use MULTI_ROLE frameworks by default.
Now that we strip the `Resource.allocation_info` for non-MULTI_ROLE
schedulers, it's simpler to default the tests to use the MULTI_ROLE
capability, since we've already updated the majority of the tests
to be aware of `Resource.allocation_info`.
Review: https://reviews.apache.org/r/64195
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ae45afc1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ae45afc1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ae45afc1
Branch: refs/heads/1.4.x
Commit: ae45afc1905da835a7367b15d62d54ce1477f411
Parents: ab6f1d8
Author: Benjamin Mahler <bm...@apache.org>
Authored: Wed Nov 29 17:41:11 2017 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Dec 1 21:31:01 2017 -0800
----------------------------------------------------------------------
src/examples/balloon_framework.cpp | 10 +-
src/examples/disk_full_framework.cpp | 7 +-
src/examples/dynamic_reservation_framework.cpp | 4 +-
src/examples/long_lived_framework.cpp | 11 +-
src/examples/no_executor_framework.cpp | 5 +-
src/examples/persistent_volume_framework.cpp | 14 +-
src/examples/test_framework.cpp | 4 +-
src/examples/test_http_framework.cpp | 13 +-
src/tests/api_tests.cpp | 26 +--
.../containerizer/cgroups_isolator_tests.cpp | 4 +-
.../docker_containerizer_tests.cpp | 6 +-
.../linux_filesystem_isolator_tests.cpp | 8 +-
src/tests/default_executor_tests.cpp | 16 +-
src/tests/disk_quota_tests.cpp | 4 +-
src/tests/fault_tolerance_tests.cpp | 11 +-
src/tests/hook_tests.cpp | 2 +-
src/tests/master_allocator_tests.cpp | 16 +-
src/tests/master_authorization_tests.cpp | 12 +-
src/tests/master_quota_tests.cpp | 4 +-
src/tests/master_tests.cpp | 71 ++++---
src/tests/master_validation_tests.cpp | 23 +-
src/tests/mesos.hpp | 9 +-
src/tests/oversubscription_tests.cpp | 24 +--
src/tests/partition_tests.cpp | 2 +-
src/tests/persistent_volume_endpoints_tests.cpp | 72 +++----
src/tests/persistent_volume_tests.cpp | 122 ++++++-----
src/tests/reservation_endpoints_tests.cpp | 98 ++++-----
src/tests/reservation_tests.cpp | 210 +++++++++----------
src/tests/role_tests.cpp | 36 ++--
src/tests/scheduler_http_api_tests.cpp | 2 +-
src/tests/scheduler_tests.cpp | 4 +-
src/tests/slave_authorization_tests.cpp | 2 +-
src/tests/slave_recovery_tests.cpp | 4 +-
src/tests/slave_tests.cpp | 21 +-
src/tests/upgrade_tests.cpp | 28 ++-
35 files changed, 472 insertions(+), 433 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/examples/balloon_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/balloon_framework.cpp b/src/examples/balloon_framework.cpp
index 1a97f56..c1fe723 100644
--- a/src/examples/balloon_framework.cpp
+++ b/src/examples/balloon_framework.cpp
@@ -182,6 +182,7 @@ public:
const ExecutorInfo& _executor,
const Flags& _flags)
: frameworkInfo(_frameworkInfo),
+ role(_frameworkInfo.roles(0)),
executor(_executor),
flags(_flags),
taskActive(false),
@@ -209,10 +210,10 @@ public:
Resources taskResources = Resources::parse(
"cpus:" + stringify(CPUS_PER_TASK) +
";mem:" + stringify(flags.task_memory.megabytes())).get();
- taskResources.allocate(frameworkInfo.role());
+ taskResources.allocate(role);
Resources executorResources = Resources(executor.resources());
- executorResources.allocate(frameworkInfo.role());
+ executorResources.allocate(role);
foreach (const Offer& offer, offers) {
Resources resources(offer.resources());
@@ -308,6 +309,7 @@ public:
private:
const FrameworkInfo frameworkInfo;
+ const string role;
const ExecutorInfo executor;
const Flags flags;
bool taskActive;
@@ -551,7 +553,9 @@ int main(int argc, char** argv)
framework.set_user(os::user().get());
framework.set_name(flags.name);
framework.set_checkpoint(flags.checkpoint);
- framework.set_role("*");
+ framework.add_roles("*");
+ framework.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
framework.add_capabilities()->set_type(
FrameworkInfo::Capability::RESERVATION_REFINEMENT);
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/examples/disk_full_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/disk_full_framework.cpp b/src/examples/disk_full_framework.cpp
index f9d5af5..9164207 100644
--- a/src/examples/disk_full_framework.cpp
+++ b/src/examples/disk_full_framework.cpp
@@ -123,6 +123,7 @@ public:
const FrameworkInfo& _frameworkInfo)
: flags(_flags),
frameworkInfo(_frameworkInfo),
+ role(_frameworkInfo.roles(0)),
tasksLaunched(0),
taskActive(false),
isRegistered(false),
@@ -149,7 +150,7 @@ public:
"cpus:" + stringify(CPUS_PER_TASK) +
";mem:" + stringify(MEMORY_PER_TASK) +
";disk:" + stringify(DISK_PER_TASK.megabytes())).get();
- taskResources.allocate(frameworkInfo.role());
+ taskResources.allocate(role);
foreach (const Offer& offer, offers) {
LOG(INFO) << "Received offer " << offer.id() << " from agent "
@@ -268,6 +269,7 @@ public:
private:
const Flags flags;
const FrameworkInfo frameworkInfo;
+ const string role;
int tasksLaunched;
bool taskActive;
@@ -448,6 +450,9 @@ int main(int argc, char** argv)
framework.set_user(""); // Have Mesos fill the current user.
framework.set_name(flags.name);
framework.set_checkpoint(true);
+ framework.add_roles("*");
+ framework.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
framework.add_capabilities()->set_type(
FrameworkInfo::Capability::RESERVATION_REFINEMENT);
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/examples/dynamic_reservation_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/dynamic_reservation_framework.cpp b/src/examples/dynamic_reservation_framework.cpp
index bb6f58b..6d4d564 100644
--- a/src/examples/dynamic_reservation_framework.cpp
+++ b/src/examples/dynamic_reservation_framework.cpp
@@ -382,7 +382,9 @@ int main(int argc, char** argv)
FrameworkInfo framework;
framework.set_user(""); // Mesos'll fill in the current user.
framework.set_name(FRAMEWORK_NAME);
- framework.set_role(flags.role.get());
+ framework.add_roles(flags.role.get());
+ framework.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
framework.set_principal(flags.principal);
framework.add_capabilities()->set_type(
FrameworkInfo::Capability::RESERVATION_REFINEMENT);
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/examples/long_lived_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/long_lived_framework.cpp b/src/examples/long_lived_framework.cpp
index 3de4a02..12077d4 100644
--- a/src/examples/long_lived_framework.cpp
+++ b/src/examples/long_lived_framework.cpp
@@ -114,12 +114,13 @@ public:
: state(DISCONNECTED),
master(_master),
framework(_framework),
+ role(_framework.roles(0)),
executor(_executor),
- taskResources([&_framework]() {
+ taskResources([this]() {
Resources resources = Resources::parse(
"cpus:" + stringify(CPUS_PER_TASK) +
";mem:" + stringify(MEM_PER_TASK)).get();
- resources.allocate(_framework.role());
+ resources.allocate(this->role);
return resources;
}()),
tasksLaunched(0),
@@ -252,7 +253,7 @@ protected:
const Resources executorResources = [this]() {
Resources resources(executor.resources());
- resources.allocate(framework.role());
+ resources.allocate(role);
return resources;
}();
@@ -413,6 +414,7 @@ private:
const string master;
FrameworkInfo framework;
+ const string role;
const ExecutorInfo executor;
const Resources taskResources;
string uri;
@@ -642,6 +644,9 @@ int main(int argc, char** argv)
framework.set_user(os::user().get());
framework.set_name(FRAMEWORK_NAME);
framework.set_checkpoint(flags.checkpoint);
+ framework.add_roles("*");
+ framework.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
framework.add_capabilities()->set_type(
FrameworkInfo::Capability::RESERVATION_REFINEMENT);
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/examples/no_executor_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/no_executor_framework.cpp b/src/examples/no_executor_framework.cpp
index 2ca240b..9cadcea 100644
--- a/src/examples/no_executor_framework.cpp
+++ b/src/examples/no_executor_framework.cpp
@@ -319,6 +319,9 @@ int main(int argc, char** argv)
framework.set_user(""); // Have Mesos fill in the current user.
framework.set_name(FRAMEWORK_NAME);
framework.set_checkpoint(flags.checkpoint);
+ framework.add_roles("*");
+ framework.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
framework.add_capabilities()->set_type(
FrameworkInfo::Capability::RESERVATION_REFINEMENT);
@@ -355,7 +358,7 @@ int main(int argc, char** argv)
}
}
- taskResources.allocate(framework.role());
+ taskResources.allocate(framework.roles(0));
logging::initialize(argv[0], flags, true); // Catch signals.
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/examples/persistent_volume_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/persistent_volume_framework.cpp b/src/examples/persistent_volume_framework.cpp
index bce2a2d..c8d3b01 100644
--- a/src/examples/persistent_volume_framework.cpp
+++ b/src/examples/persistent_volume_framework.cpp
@@ -142,14 +142,15 @@ public:
size_t numShards,
size_t numSharedShards,
size_t tasksPerShard)
- : frameworkInfo(_frameworkInfo)
+ : frameworkInfo(_frameworkInfo),
+ role(_frameworkInfo.roles(0))
{
// Initialize the shards using regular persistent volume.
for (size_t i = 0; i < numShards; i++) {
shards.push_back(
Shard(
"shard-" + stringify(i),
- frameworkInfo.role(),
+ role,
tasksPerShard,
false));
}
@@ -159,7 +160,7 @@ public:
shards.push_back(
Shard(
"shared-shard-" + stringify(i),
- frameworkInfo.role(),
+ role,
tasksPerShard,
true));
}
@@ -209,7 +210,7 @@ public:
if (offered.contains(shard.resources)) {
Resource volume = SHARD_PERSISTENT_VOLUME(
- frameworkInfo.role(),
+ role,
UUID::random().toString(),
"volume",
frameworkInfo.principal(),
@@ -485,6 +486,7 @@ private:
};
FrameworkInfo frameworkInfo;
+ const string role;
vector<Shard> shards;
};
@@ -568,7 +570,9 @@ int main(int argc, char** argv)
FrameworkInfo framework;
framework.set_user(""); // Have Mesos fill in the current user.
framework.set_name(FRAMEWORK_NAME);
- framework.set_role(flags.role);
+ framework.add_roles(flags.role);
+ framework.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
framework.set_checkpoint(true);
framework.set_principal(flags.principal);
framework.add_capabilities()->set_type(
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/examples/test_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_framework.cpp b/src/examples/test_framework.cpp
index a6b38f0..9111462 100644
--- a/src/examples/test_framework.cpp
+++ b/src/examples/test_framework.cpp
@@ -264,7 +264,9 @@ int main(int argc, char** argv)
FrameworkInfo framework;
framework.set_user(""); // Have Mesos fill in the current user.
framework.set_name(FRAMEWORK_NAME);
- framework.set_role(flags.role);
+ framework.add_roles(flags.role);
+ framework.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
framework.add_capabilities()->set_type(
FrameworkInfo::Capability::RESERVATION_REFINEMENT);
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/examples/test_http_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_http_framework.cpp b/src/examples/test_http_framework.cpp
index 693dd47..b96d186 100644
--- a/src/examples/test_http_framework.cpp
+++ b/src/examples/test_http_framework.cpp
@@ -76,6 +76,7 @@ public:
const ExecutorInfo& _executor,
const string& _master)
: framework(_framework),
+ role(_framework.roles(0)),
executor(_executor),
master(_master),
state(INITIALIZING),
@@ -88,6 +89,7 @@ public:
const string& _master,
const Credential& credential)
: framework(_framework),
+ role(_framework.roles(0)),
executor(_executor),
master(_master),
state(INITIALIZING),
@@ -229,7 +231,7 @@ private:
Resources taskResources = Resources::parse(
"cpus:" + stringify(CPUS_PER_TASK) +
";mem:" + stringify(MEM_PER_TASK)).get();
- taskResources.allocate(framework.role());
+ taskResources.allocate(role);
Resources remaining = offer.resources();
@@ -249,12 +251,12 @@ private:
task.mutable_executor()->MergeFrom(executor);
Option<Resources> resources = [&]() {
- if (framework.role() == "*") {
+ if (role == "*") {
return remaining.find(taskResources);
} else {
Resource::ReservationInfo reservation;
reservation.set_type(Resource::ReservationInfo::STATIC);
- reservation.set_role(framework.role());
+ reservation.set_role(role);
return remaining.find(taskResources.pushReservation(reservation));
}
@@ -361,6 +363,7 @@ private:
}
FrameworkInfo framework;
+ const string role;
const ExecutorInfo executor;
const string master;
process::Owned<scheduler::Mesos> mesos;
@@ -437,7 +440,9 @@ int main(int argc, char** argv)
FrameworkInfo framework;
framework.set_name(FRAMEWORK_NAME);
- framework.set_role(flags.role);
+ framework.add_roles(flags.role);
+ framework.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
framework.add_capabilities()->set_type(
FrameworkInfo::Capability::RESERVATION_REFINEMENT);
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index 75f7a58..903e7ea 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -248,7 +248,7 @@ TEST_P(MasterAPITest, GetFrameworks)
ASSERT_EQ(1, frameworks.frameworks_size());
ASSERT_EQ("default", frameworks.frameworks(0).framework_info().name());
- ASSERT_EQ("*", frameworks.frameworks(0).framework_info().role());
+ ASSERT_EQ("*", frameworks.frameworks(0).framework_info().roles(0));
ASSERT_FALSE(frameworks.frameworks(0).framework_info().checkpoint());
ASSERT_TRUE(frameworks.frameworks(0).active());
ASSERT_TRUE(frameworks.frameworks(0).connected());
@@ -893,7 +893,7 @@ TEST_P(MasterAPITest, GetRoles)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -988,12 +988,12 @@ TEST_P(MasterAPITest, ReserveResources)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved =
unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -1014,7 +1014,7 @@ TEST_P(MasterAPITest, ReserveResources)
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));
@@ -1048,7 +1048,7 @@ TEST_P(MasterAPITest, ReserveResources)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -1080,12 +1080,12 @@ TEST_P(MasterAPITest, UnreserveResources)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
Resources unreserved = Resources::parse("cpus:1;mem:512").get();
Resources dynamicallyReserved =
unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
v1::master::Call v1Call;
v1Call.set_type(v1::master::Call::RESERVE_RESOURCES);
@@ -1126,7 +1126,7 @@ TEST_P(MasterAPITest, UnreserveResources)
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));
@@ -1160,7 +1160,7 @@ TEST_P(MasterAPITest, UnreserveResources)
// Verifies if the resources are unreserved.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -2607,7 +2607,7 @@ TEST_P(MasterAPITest, CreateAndDestroyVolumes)
AWAIT_READY(v1CreateVolumesResponse);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
// Start a framework and launch a task on the persistent volume.
MockScheduler sched;
@@ -2628,11 +2628,11 @@ TEST_P(MasterAPITest, CreateAndDestroyVolumes)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
Resources taskResources = Resources::parse(
"disk:256",
- frameworkInfo.role()).get();
+ frameworkInfo.roles(0)).get();
TaskInfo taskInfo = createTask(
offer.slave_id(),
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/containerizer/cgroups_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/cgroups_isolator_tests.cpp b/src/tests/containerizer/cgroups_isolator_tests.cpp
index 6724211..b85e677 100644
--- a/src/tests/containerizer/cgroups_isolator_tests.cpp
+++ b/src/tests/containerizer/cgroups_isolator_tests.cpp
@@ -309,8 +309,8 @@ TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_RevocableCpu)
// Now the framework will get revocable resources.
AWAIT_READY(offers2);
- EXPECT_NE(0u, offers2->size());
- EXPECT_EQ(allocatedResources(cpus, frameworkInfo.role()),
+ ASSERT_FALSE(offers2->empty());
+ EXPECT_EQ(allocatedResources(cpus, frameworkInfo.roles(0)),
Resources(offers2.get()[0].resources()));
TaskInfo task = createTask(
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/containerizer/docker_containerizer_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/docker_containerizer_tests.cpp b/src/tests/containerizer/docker_containerizer_tests.cpp
index fa91bcf..1d542f9 100644
--- a/src/tests/containerizer/docker_containerizer_tests.cpp
+++ b/src/tests/containerizer/docker_containerizer_tests.cpp
@@ -1585,7 +1585,7 @@ TEST_F(DockerContainerizerTest, ROOT_DOCKER_LaunchWithPersistentVolumes)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -1739,7 +1739,7 @@ TEST_F(DockerContainerizerTest, ROOT_DOCKER_RecoverPersistentVolumes)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
frameworkInfo.set_checkpoint(true);
MockScheduler sched;
@@ -1903,7 +1903,7 @@ TEST_F(DockerContainerizerTest, ROOT_DOCKER_RecoverOrphanedPersistentVolumes)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
frameworkInfo.set_checkpoint(true);
MockScheduler sched;
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/containerizer/linux_filesystem_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/linux_filesystem_isolator_tests.cpp b/src/tests/containerizer/linux_filesystem_isolator_tests.cpp
index f9cab2f..6f57250 100644
--- a/src/tests/containerizer/linux_filesystem_isolator_tests.cpp
+++ b/src/tests/containerizer/linux_filesystem_isolator_tests.cpp
@@ -1182,7 +1182,7 @@ TEST_F(LinuxFilesystemIsolatorMesosTest,
MockScheduler sched;
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
MesosSchedulerDriver driver(
&sched,
@@ -1320,7 +1320,7 @@ TEST_F(LinuxFilesystemIsolatorMesosTest,
MockScheduler sched;
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
frameworkInfo.set_checkpoint(true);
MesosSchedulerDriver driver(
@@ -1540,7 +1540,7 @@ TEST_F(LinuxFilesystemIsolatorMesosTest,
MockScheduler sched;
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
MesosSchedulerDriver driver(
&sched,
@@ -1632,7 +1632,7 @@ TEST_F(LinuxFilesystemIsolatorMesosTest,
MockScheduler sched;
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
frameworkInfo.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/default_executor_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/default_executor_tests.cpp b/src/tests/default_executor_tests.cpp
index 7061dca..29e224c 100644
--- a/src/tests/default_executor_tests.cpp
+++ b/src/tests/default_executor_tests.cpp
@@ -1289,7 +1289,7 @@ TEST_P(DefaultExecutorTest, ReservedResources)
AWAIT_READY(connected);
v1::FrameworkInfo frameworkInfo = v1::DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
Future<v1::scheduler::Event::Subscribed> subscribed;
EXPECT_CALL(*scheduler, subscribed(_, _))
@@ -1320,7 +1320,7 @@ TEST_P(DefaultExecutorTest, ReservedResources)
// Launch the executor using reserved resources.
v1::Resources reserved =
unreserved.pushReservation(v1::createDynamicReservationInfo(
- frameworkInfo.role(), frameworkInfo.principal()));
+ frameworkInfo.roles(0), frameworkInfo.principal()));
v1::ExecutorInfo executorInfo;
executorInfo.set_type(v1::ExecutorInfo::DEFAULT);
@@ -1612,7 +1612,7 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
auto scheduler = std::make_shared<v1::MockHTTPScheduler>();
v1::FrameworkInfo frameworkInfo = v1::DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
Future<Nothing> connected;
EXPECT_CALL(*scheduler, connected(_))
@@ -1646,11 +1646,11 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
v1::Resources reserved =
unreserved.pushReservation(v1::createDynamicReservationInfo(
- frameworkInfo.role(), frameworkInfo.principal()));
+ frameworkInfo.roles(0), frameworkInfo.principal()));
v1::Resource volume = v1::createPersistentVolume(
Megabytes(1),
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
"id1",
"executor_volume_path",
frameworkInfo.principal(),
@@ -1755,7 +1755,7 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
auto scheduler = std::make_shared<v1::MockHTTPScheduler>();
v1::FrameworkInfo frameworkInfo = v1::DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
Future<Nothing> connected;
EXPECT_CALL(*scheduler, connected(_))
@@ -1803,7 +1803,7 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
v1::Resource volume = v1::createPersistentVolume(
Megabytes(1),
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
"id1",
"task_volume_path",
frameworkInfo.principal(),
@@ -1812,7 +1812,7 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
v1::Resources reserved =
unreserved.pushReservation(v1::createDynamicReservationInfo(
- frameworkInfo.role(), frameworkInfo.principal()));
+ frameworkInfo.roles(0), frameworkInfo.principal()));
// Launch a task that expects the persistent volume to be
// mounted in its sandbox.
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/disk_quota_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/disk_quota_tests.cpp b/src/tests/disk_quota_tests.cpp
index 3bf0508..5752caf 100644
--- a/src/tests/disk_quota_tests.cpp
+++ b/src/tests/disk_quota_tests.cpp
@@ -245,7 +245,7 @@ TEST_F(DiskQuotaTest, DiskUsageExceedsQuota)
TEST_F(DiskQuotaTest, VolumeUsageExceedsQuota)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
master::Flags masterFlags = CreateMasterFlags();
@@ -472,7 +472,7 @@ TEST_F(DiskQuotaTest, ResourceStatistics)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
MockScheduler sched;
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/fault_tolerance_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/fault_tolerance_tests.cpp b/src/tests/fault_tolerance_tests.cpp
index 5b82135..78ad297 100644
--- a/src/tests/fault_tolerance_tests.cpp
+++ b/src/tests/fault_tolerance_tests.cpp
@@ -2040,10 +2040,8 @@ TEST_F(FaultToleranceTest, UpdateFrameworkInfoOnSchedulerFailover)
// scheduler with updated information.
FrameworkInfo finfo1 = DEFAULT_FRAMEWORK_INFO;
-
- // TODO(mpark): Remove this once `RESERVATION_REFINEMENT`
- // is removed from `DEFAULT_FRAMEWORK_INFO`.
finfo1.clear_capabilities();
+ finfo1.clear_roles();
finfo1.set_name("Framework 1");
finfo1.set_failover_timeout(1000);
@@ -2069,11 +2067,7 @@ TEST_F(FaultToleranceTest, UpdateFrameworkInfoOnSchedulerFailover)
// updated FrameworkInfo and wait until it gets a registered
// callback.
- FrameworkInfo finfo2 = DEFAULT_FRAMEWORK_INFO;
-
- // TODO(mpark): Remove this once `RESERVATION_REFINEMENT`
- // is removed from `DEFAULT_FRAMEWORK_INFO`.
- finfo2.clear_capabilities();
+ FrameworkInfo finfo2 = finfo1;
finfo2.mutable_id()->MergeFrom(frameworkId.get());
auto capabilityType = FrameworkInfo::Capability::REVOCABLE_RESOURCES;
@@ -2082,6 +2076,7 @@ TEST_F(FaultToleranceTest, UpdateFrameworkInfoOnSchedulerFailover)
finfo2.set_webui_url("http://localhost:8080/");
finfo2.set_failover_timeout(100);
finfo2.set_hostname("myHostname");
+ finfo2.clear_labels();
finfo2.mutable_labels()->add_labels()->CopyFrom(createLabel("baz", "qux"));
MockScheduler sched2;
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/hook_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/hook_tests.cpp b/src/tests/hook_tests.cpp
index 04edbf8..509e158 100644
--- a/src/tests/hook_tests.cpp
+++ b/src/tests/hook_tests.cpp
@@ -1119,7 +1119,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
EXPECT_EQ(TEST_HOOK_CPUS, resources.cpus().get());
- const string allocationRole = DEFAULT_FRAMEWORK_INFO.role();
+ const string allocationRole = DEFAULT_FRAMEWORK_INFO.roles(0);
EXPECT_TRUE(resources.contains(
allocatedResources(TEST_HOOK_ADDITIONAL_RESOURCES, allocationRole)));
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/master_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_allocator_tests.cpp b/src/tests/master_allocator_tests.cpp
index f8b315c..455b7da 100644
--- a/src/tests/master_allocator_tests.cpp
+++ b/src/tests/master_allocator_tests.cpp
@@ -839,7 +839,7 @@ TYPED_TEST(MasterAllocatorTest, SlaveLost)
EXPECT_EQ(Resources(resourceOffers.get()[0].resources()),
allocatedResources(
Resources::parse(flags2.resources.get()).get(),
- DEFAULT_FRAMEWORK_INFO.role()));
+ DEFAULT_FRAMEWORK_INFO.roles(0)));
// Shut everything down.
EXPECT_CALL(allocator, recoverResources(_, _, _, _))
@@ -1287,7 +1287,7 @@ TYPED_TEST(MasterAllocatorTest, RoleTest)
FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
frameworkInfo1.set_name("framework1");
frameworkInfo1.set_user("user1");
- frameworkInfo1.set_role("role1");
+ frameworkInfo1.set_roles(0, "role1");
MockScheduler sched1;
MesosSchedulerDriver driver1(
@@ -1306,7 +1306,7 @@ TYPED_TEST(MasterAllocatorTest, RoleTest)
FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
frameworkInfo2.set_name("framework2");
frameworkInfo2.set_user("user2");
- frameworkInfo2.set_role("role2");
+ frameworkInfo2.set_roles(0, "role2");
MockScheduler sched2;
MesosSchedulerDriver driver2(
@@ -1656,7 +1656,7 @@ TYPED_TEST(MasterAllocatorTest, RebalancedForUpdatedWeights)
// and all resources will be offered to this framework since it is the only
// framework running so far.
FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo1.set_role("role1");
+ frameworkInfo1.set_roles(0, "role1");
MockScheduler sched1;
MesosSchedulerDriver driver1(
&sched1, frameworkInfo1, master.get()->pid, DEFAULT_CREDENTIAL);
@@ -1686,7 +1686,7 @@ TYPED_TEST(MasterAllocatorTest, RebalancedForUpdatedWeights)
// It will not get any offers due to all resources having outstanding offers
// to framework1 when it registered.
FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo2.set_role("role2");
+ frameworkInfo2.set_roles(0, "role2");
MockScheduler sched2;
MesosSchedulerDriver driver2(
&sched2, frameworkInfo2, master.get()->pid, DEFAULT_CREDENTIAL);
@@ -1835,7 +1835,7 @@ TYPED_TEST(MasterAllocatorTest, NestedRoles)
// Register a framework in the "a/b" role and launch a single task,
// consuming all the resources on `slave1`.
FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo1.set_role("a/b");
+ frameworkInfo1.set_roles(0, "a/b");
MockScheduler sched1;
MesosSchedulerDriver driver1(
@@ -1865,7 +1865,7 @@ TYPED_TEST(MasterAllocatorTest, NestedRoles)
// Register a framework in the "a/c" role. It should not get any
// offers, because there are no unused resources.
FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo2.set_role("a/c");
+ frameworkInfo2.set_roles(0, "a/c");
MockScheduler sched2;
MesosSchedulerDriver driver2(
@@ -1884,7 +1884,7 @@ TYPED_TEST(MasterAllocatorTest, NestedRoles)
// Register a framework in the "b/x" role. It should not get any
// offers, because there are no unused resources.
FrameworkInfo frameworkInfo3 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo3.set_role("b/x");
+ frameworkInfo3.set_roles(0, "b/x");
MockScheduler sched3;
MesosSchedulerDriver driver3(
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/master_authorization_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_authorization_tests.cpp b/src/tests/master_authorization_tests.cpp
index 0c68a1f..4b446e8 100644
--- a/src/tests/master_authorization_tests.cpp
+++ b/src/tests/master_authorization_tests.cpp
@@ -993,7 +993,7 @@ TEST_F(MasterAuthorizationTest, AuthorizedRole)
ASSERT_SOME(master);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("foo");
+ frameworkInfo.set_roles(0, "foo");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -1031,7 +1031,7 @@ TEST_F(MasterAuthorizationTest, UnauthorizedRole)
ASSERT_SOME(master);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("foo");
+ frameworkInfo.set_roles(0, "foo");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -1369,7 +1369,7 @@ TYPED_TEST(MasterAuthorizerTest, FilterStateSummaryEndpoint)
// Start framwork with user "bar".
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
frameworkInfo.set_user(user);
MockScheduler sched;
@@ -1501,7 +1501,7 @@ TYPED_TEST(MasterAuthorizerTest, FilterStateEndpoint)
// Start framwork with user "bar".
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
frameworkInfo.set_user(user);
// Create an executor with user "bar".
@@ -1690,7 +1690,7 @@ TYPED_TEST(MasterAuthorizerTest, FilterFrameworksEndpoint)
// Start framwork 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".
@@ -1881,7 +1881,7 @@ TYPED_TEST(MasterAuthorizerTest, FilterTasksEndpoint)
// Start framwork with user "bar".
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role");
+ frameworkInfo.set_roles(0, "role");
frameworkInfo.set_user(user);
// Create an executor with user "bar".
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/master_quota_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_quota_tests.cpp b/src/tests/master_quota_tests.cpp
index 9d52f76..fe4479e 100644
--- a/src/tests/master_quota_tests.cpp
+++ b/src/tests/master_quota_tests.cpp
@@ -114,11 +114,11 @@ protected:
// Creates a FrameworkInfo with the specified role.
FrameworkInfo createFrameworkInfo(const string& role)
{
- FrameworkInfo info;
+ FrameworkInfo info = DEFAULT_FRAMEWORK_INFO;
info.set_user("user");
info.set_name("framework" + process::ID::generate());
info.mutable_id()->set_value(info.name());
- info.set_role(role);
+ info.set_roles(0, role);
return info;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index e6ed02e..5b93ccc 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -974,7 +974,7 @@ TEST_F(MasterTest, RecoverResources)
Resources executorResources = allocatedResources(
Resources::parse("cpus:0.3;mem:200;ports:[5-8, 23-25]").get(),
- DEFAULT_FRAMEWORK_INFO.role());
+ DEFAULT_FRAMEWORK_INFO.roles(0));
executorInfo.mutable_resources()->MergeFrom(executorResources);
TaskID taskId;
@@ -1056,7 +1056,7 @@ TEST_F(MasterTest, RecoverResources)
ASSERT_NE(0u, offers->size());
Resources slaveResources = Resources::parse(flags.resources.get()).get();
- EXPECT_EQ(allocatedResources(slaveResources, DEFAULT_FRAMEWORK_INFO.role()),
+ EXPECT_EQ(allocatedResources(slaveResources, DEFAULT_FRAMEWORK_INFO.roles(0)),
offers.get()[0].resources());
driver.stop();
@@ -2070,11 +2070,8 @@ TEST_F(MasterTest, LaunchDifferentRoleLost)
ASSERT_SOME(slave);
FrameworkInfo framework = DEFAULT_FRAMEWORK_INFO;
- framework.clear_role();
- 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(
@@ -4018,7 +4015,7 @@ TEST_F(MasterTest, IgnoreEphemeralPortsResource)
Resources(offers.get()[0].resources()),
allocatedResources(
Resources::parse(resourcesWithoutEphemeralPorts).get(),
- DEFAULT_FRAMEWORK_INFO.role()));
+ DEFAULT_FRAMEWORK_INFO.roles(0)));
driver.stop();
driver.join();
@@ -4530,9 +4527,6 @@ TEST_F(MasterTest, StateEndpointFrameworkInfo)
AWAIT_READY(slaveRegisteredMessage);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
-
- // TODO(mpark): Remove this once `RESERVATION_REFINEMENT`
- // is removed from `DEFAULT_FRAMEWORK_INFO`.
frameworkInfo.clear_capabilities();
frameworkInfo.set_webui_url("http://localhost:8080/");
@@ -4541,7 +4535,9 @@ TEST_F(MasterTest, StateEndpointFrameworkInfo)
FrameworkInfo::Capability::REVOCABLE_RESOURCES,
FrameworkInfo::Capability::TASK_KILLING_STATE,
FrameworkInfo::Capability::GPU_RESOURCES,
- FrameworkInfo::Capability::PARTITION_AWARE
+ FrameworkInfo::Capability::PARTITION_AWARE,
+ FrameworkInfo::Capability::MULTI_ROLE,
+ FrameworkInfo::Capability::RESERVATION_REFINEMENT,
};
foreach (FrameworkInfo::Capability::Type capability, capabilities) {
@@ -4617,7 +4613,7 @@ TEST_F(MasterTest, StateEndpointFrameworkInfo)
.as<JSON::Array>().values[0].as<JSON::Object>();
JSON::Object allocationInfo;
- allocationInfo.values["role"] = frameworkInfo.role();
+ allocationInfo.values["role"] = frameworkInfo.roles(0);
ASSERT_EQ(1u, offer.values.count("allocation_info"));
EXPECT_EQ(allocationInfo, offer.values.at("allocation_info"));
@@ -4792,7 +4788,7 @@ TEST_F(MasterTest, StateEndpointAllocationRole)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("foo");
+ frameworkInfo.set_roles(0, "foo");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -4862,10 +4858,10 @@ TEST_F(MasterTest, StateEndpointAllocationRole)
JSON::Array {
JSON::Object {
{ "executors", JSON::Array {
- JSON::Object { { "role", frameworkInfo.role() } } }
+ JSON::Object { { "role", frameworkInfo.roles(0) } } }
},
{ "tasks", JSON::Array {
- JSON::Object { { "role", frameworkInfo.role() } } }
+ JSON::Object { { "role", frameworkInfo.roles(0) } } }
}
}
}
@@ -5939,7 +5935,7 @@ TEST_F(MasterTest, RejectFrameworkWithInvalidRole)
FrameworkInfo framework = DEFAULT_FRAMEWORK_INFO;
// Add invalid role to the FrameworkInfo.
- framework.set_role("/test/test1");
+ framework.set_roles(0, "/test/test1");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -7329,10 +7325,8 @@ TEST_F(MasterTest, MultiRoleFrameworkReceivesOffers)
ASSERT_SOME(slave1);
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(
@@ -7474,12 +7468,9 @@ TEST_F(MasterTest, MultiRoleSchedulerUnsubscribeFromRole)
// capability, so we expect its tasks to continue running when the
// partitioned agent reregisters.
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.clear_role();
- frameworkInfo.add_roles("foo");
+ frameworkInfo.set_roles(0, "foo");
frameworkInfo.add_capabilities()->set_type(
FrameworkInfo::Capability::PARTITION_AWARE);
- frameworkInfo.add_capabilities()->set_type(
- FrameworkInfo::Capability::MULTI_ROLE);
MockScheduler sched1;
MesosSchedulerDriver driver1(
@@ -8099,11 +8090,13 @@ INSTANTIATE_TEST_CASE_P(
TEST_P(MasterTestPrePostReservationRefinement, LaunchTask)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
// TODO(mpark): Remove this once `RESERVATION_REFINEMENT`
// is removed from `DEFAULT_FRAMEWORK_INFO`.
frameworkInfo.clear_capabilities();
+ frameworkInfo.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
if (GetParam()) {
frameworkInfo.add_capabilities()->set_type(
@@ -8179,11 +8172,13 @@ TEST_P(MasterTestPrePostReservationRefinement, LaunchTask)
TEST_P(MasterTestPrePostReservationRefinement, LaunchGroup)
{
v1::FrameworkInfo frameworkInfo = v1::DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
// TODO(mpark): Remove this once `RESERVATION_REFINEMENT`
// is removed from `DEFAULT_FRAMEWORK_INFO`.
frameworkInfo.clear_capabilities();
+ frameworkInfo.add_capabilities()->set_type(
+ v1::FrameworkInfo::Capability::MULTI_ROLE);
if (GetParam()) {
frameworkInfo.add_capabilities()->set_type(
@@ -8336,11 +8331,13 @@ TEST_P(MasterTestPrePostReservationRefinement,
ReserveCreateLaunchDestroyUnreserve)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
// TODO(mpark): Remove this once `RESERVATION_REFINEMENT`
// is removed from `DEFAULT_FRAMEWORK_INFO`.
frameworkInfo.clear_capabilities();
+ frameworkInfo.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
if (GetParam()) {
frameworkInfo.add_capabilities()->set_type(
@@ -8349,7 +8346,7 @@ TEST_P(MasterTestPrePostReservationRefinement,
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);
@@ -8375,11 +8372,11 @@ TEST_P(MasterTestPrePostReservationRefinement,
Resources reservedCpus =
unreservedCpus.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), frameworkInfo.principal()));
+ frameworkInfo.roles(0), frameworkInfo.principal()));
Resources reservedDisk =
unreservedDisk.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), frameworkInfo.principal()));
+ frameworkInfo.roles(0), frameworkInfo.principal()));
Resources volume = createPersistentVolume(
createDiskResource("512", DEFAULT_TEST_ROLE, None(), None()),
@@ -8407,7 +8404,7 @@ TEST_P(MasterTestPrePostReservationRefinement,
EXPECT_TRUE(inboundResources(offer.resources())
.contains(allocatedResources(
- unreservedCpus + unreservedDisk, frameworkInfo.role())));
+ unreservedCpus + unreservedDisk, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -8432,7 +8429,7 @@ TEST_P(MasterTestPrePostReservationRefinement,
EXPECT_TRUE(inboundResources(offer.resources())
.contains(allocatedResources(
- reservedCpus + reservedDisk, frameworkInfo.role())));
+ reservedCpus + reservedDisk, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -8457,7 +8454,7 @@ TEST_P(MasterTestPrePostReservationRefinement,
EXPECT_TRUE(inboundResources(offer.resources())
.contains(allocatedResources(
- reservedCpus + volume, frameworkInfo.role())));
+ reservedCpus + volume, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -8482,7 +8479,7 @@ TEST_P(MasterTestPrePostReservationRefinement,
EXPECT_TRUE(inboundResources(offer.resources())
.contains(allocatedResources(
- reservedCpus + reservedDisk, frameworkInfo.role())));
+ reservedCpus + reservedDisk, frameworkInfo.roles(0))));
// The expectation for the next offer.
EXPECT_CALL(sched, resourceOffers(&driver, _))
@@ -8507,7 +8504,7 @@ TEST_P(MasterTestPrePostReservationRefinement,
EXPECT_TRUE(inboundResources(offer.resources())
.contains(allocatedResources(
- unreservedCpus + unreservedDisk, frameworkInfo.role())));
+ unreservedCpus + unreservedDisk, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -8519,11 +8516,13 @@ TEST_P(MasterTestPrePostReservationRefinement,
TEST_P(MasterTestPrePostReservationRefinement, StateEndpointPendingTasks)
{
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
// TODO(mpark): Remove this once `RESERVATION_REFINEMENT`
// is removed from `DEFAULT_FRAMEWORK_INFO`.
frameworkInfo.clear_capabilities();
+ frameworkInfo.add_capabilities()->set_type(
+ FrameworkInfo::Capability::MULTI_ROLE);
if (GetParam()) {
frameworkInfo.add_capabilities()->set_type(
@@ -8598,7 +8597,7 @@ TEST_P(MasterTestPrePostReservationRefinement, StateEndpointPendingTasks)
JSON::Array {
JSON::Object {
{ "id", "1" },
- { "role", frameworkInfo.role() },
+ { "role", frameworkInfo.roles(0) },
{ "state", "TASK_STAGING" }
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/master_validation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_validation_tests.cpp b/src/tests/master_validation_tests.cpp
index 27de34b..4d4fa34 100644
--- a/src/tests/master_validation_tests.cpp
+++ b/src/tests/master_validation_tests.cpp
@@ -854,7 +854,7 @@ TEST_F(CreateOperationValidationTest, SharedVolumeBasedOnCapability)
// When a FrameworkInfo with no SHARED_RESOURCES capability is
// specified, the validation should fail.
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
error = operation::validate(
create, Resources(), None(), capabilities, frameworkInfo);
@@ -880,14 +880,14 @@ TEST_F(CreateOperationValidationTest, InsufficientDiskResource)
protobuf::slave::Capabilities capabilities;
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role("role1");
+ frameworkInfo.set_roles(0, "role1");
master::Flags masterFlags = CreateMasterFlags();
ACLs acls;
mesos::ACL::RegisterFramework* acl = acls.add_register_frameworks();
acl->mutable_principals()->add_values(frameworkInfo.principal());
- acl->mutable_roles()->add_values(frameworkInfo.role());
+ acl->mutable_roles()->add_values(frameworkInfo.roles(0));
masterFlags.acls = acls;
masterFlags.roles = "role1";
@@ -3470,7 +3470,8 @@ TEST_F(FrameworkInfoValidationTest, MissingMultiRoleCapability)
ASSERT_SOME(master);
FrameworkInfo framework = DEFAULT_FRAMEWORK_INFO;
- framework.add_roles("role");
+ framework.clear_capabilities();
+ framework.set_roles(0, "role");
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -3493,7 +3494,7 @@ TEST_F(FrameworkInfoValidationTest, AcceptMultiRoleFramework)
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);
@@ -3523,7 +3524,7 @@ TEST_F(FrameworkInfoValidationTest, MultiRoleWhitelist)
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);
@@ -3556,6 +3557,8 @@ TEST_F(FrameworkInfoValidationTest, UpgradeToMultiRole)
ASSERT_SOME(master);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+ frameworkInfo.clear_capabilities();
+ frameworkInfo.clear_roles();
frameworkInfo.set_role("role");
// Set a long failover timeout so the framework isn't immediately removed.
@@ -3627,7 +3630,7 @@ TEST_F(FrameworkInfoValidationTest, DowngradeFromMultipleRoles)
// is removed from `DEFAULT_FRAMEWORK_INFO`.
frameworkInfo.clear_capabilities();
- frameworkInfo.add_roles("role1");
+ frameworkInfo.set_roles(0, "role1");
frameworkInfo.add_roles("role2");
frameworkInfo.add_capabilities()->set_type(
FrameworkInfo::Capability::MULTI_ROLE);
@@ -3697,9 +3700,7 @@ TEST_F(FrameworkInfoValidationTest, RoleChangeWithMultiRole)
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
ASSERT_FALSE(frameworkInfo.has_role());
- frameworkInfo.add_roles("role1");
- frameworkInfo.add_capabilities()->set_type(
- FrameworkInfo::Capability::MULTI_ROLE);
+ frameworkInfo.set_roles(0, "role1");
// Set a long failover timeout so the framework isn't immediately removed.
frameworkInfo.set_failover_timeout(Weeks(1).secs());
@@ -3769,6 +3770,8 @@ TEST_F(FrameworkInfoValidationTest, RoleChangeWithMultiRoleMasterFailover)
// immediately cleaned up.
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
frameworkInfo.set_failover_timeout(Weeks(1).secs());
+ frameworkInfo.clear_capabilities();
+ frameworkInfo.clear_roles();
frameworkInfo.set_role("role1");
Future<FrameworkID> frameworkId;
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 6f06261..83f94b3 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -438,6 +438,9 @@ struct DefaultFrameworkInfo
framework.set_user(os::user().get());
framework.set_principal(
DefaultCredential<TCredential>::create().principal());
+ framework.add_roles("*");
+ framework.add_capabilities()->set_type(
+ TFrameworkInfo::Capability::MULTI_ROLE);
framework.add_capabilities()->set_type(
TFrameworkInfo::Capability::RESERVATION_REFINEMENT);
@@ -1736,7 +1739,11 @@ ACTION_P5(LaunchTasks, executor, tasks, cpus, mem, role)
Resources taskResources = Resources::parse(
"cpus:" + stringify(cpus) + ";mem:" + stringify(mem)).get();
- taskResources.allocate(role);
+
+ if (offer.resources_size() > 0 &&
+ offer.resources(0).has_allocation_info()) {
+ taskResources.allocate(role);
+ }
int nextTaskId = 0;
std::vector<TaskInfo> tasks;
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/oversubscription_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/oversubscription_tests.cpp b/src/tests/oversubscription_tests.cpp
index 54535a3..79514a7 100644
--- a/src/tests/oversubscription_tests.cpp
+++ b/src/tests/oversubscription_tests.cpp
@@ -403,10 +403,10 @@ TEST_F(OversubscriptionTest, RevocableOffer)
estimations.put(createRevocableResources("cpus", "2"));
Resources taskResources = createRevocableResources("cpus", "1");
- taskResources.allocate(framework.role());
+ taskResources.allocate(framework.roles(0));
Resources executorResources = createRevocableResources("cpus", "1");
- executorResources.allocate(framework.role());
+ executorResources.allocate(framework.roles(0));
// Now the framework will get revocable resources.
AWAIT_READY(offers2);
@@ -512,7 +512,7 @@ TEST_F(OversubscriptionTest, RescindRevocableOfferWithIncreasedRevocable)
EXPECT_EQ(1u, offers.size());
Future<Offer> offer = offers.get();
AWAIT_READY(offer);
- EXPECT_EQ(allocatedResources(resources1, framework.role()),
+ EXPECT_EQ(allocatedResources(resources1, framework.roles(0)),
Resources(offer->resources()));
Future<OfferID> offerId;
@@ -550,7 +550,7 @@ TEST_F(OversubscriptionTest, RescindRevocableOfferWithIncreasedRevocable)
}
// The offered resources should match the resource estimate.
- EXPECT_EQ(allocatedResources(resources2, framework.role()), resources3);
+ EXPECT_EQ(allocatedResources(resources2, framework.roles(0)), resources3);
driver.stop();
driver.join();
@@ -625,8 +625,8 @@ TEST_F(OversubscriptionTest, RescindRevocableOfferWithDecreasedRevocable)
// Now the framework will get revocable resources.
AWAIT_READY(offers2);
- EXPECT_NE(0u, offers2->size());
- EXPECT_EQ(allocatedResources(resources1, framework.role()),
+ ASSERT_FALSE(offers2->empty());
+ EXPECT_EQ(allocatedResources(resources1, framework.roles(0)),
Resources(offers2.get()[0].resources()));
Future<OfferID> offerId;
@@ -656,8 +656,8 @@ TEST_F(OversubscriptionTest, RescindRevocableOfferWithDecreasedRevocable)
// The new offer should include the latest oversubscribed resources.
AWAIT_READY(offers3);
- EXPECT_NE(0u, offers3->size());
- EXPECT_EQ(allocatedResources(resources2, framework.role()),
+ ASSERT_FALSE(offers3->empty());
+ EXPECT_EQ(allocatedResources(resources2, framework.roles(0)),
Resources(offers3.get()[0].resources()));
driver.stop();
@@ -1289,8 +1289,8 @@ TEST_F(OversubscriptionTest, UpdateAllocatorOnSchedulerFailover)
estimations.put(revocable);
AWAIT_READY(offers2);
- EXPECT_NE(0u, offers2->size());
- EXPECT_EQ(allocatedResources(revocable, framework2.role()),
+ ASSERT_FALSE(offers2->empty());
+ EXPECT_EQ(allocatedResources(revocable, framework2.roles(0)),
Resources(offers2.get()[0].resources()));
EXPECT_EQ(DRIVER_STOPPED, driver2.stop());
@@ -1363,8 +1363,8 @@ TEST_F(OversubscriptionTest, RemoveCapabilitiesOnSchedulerFailover)
// Now the framework will get revocable resources.
AWAIT_READY(offers2);
- EXPECT_NE(0u, offers2->size());
- EXPECT_EQ(allocatedResources(revocable, framework1.role()),
+ ASSERT_FALSE(offers2->empty());
+ EXPECT_EQ(allocatedResources(revocable, framework1.roles(0)),
Resources(offers2.get()[0].resources()));
// Reregister the framework with removal of revocable resources capability.
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/partition_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/partition_tests.cpp b/src/tests/partition_tests.cpp
index 62a84f7..bcc632c 100644
--- a/src/tests/partition_tests.cpp
+++ b/src/tests/partition_tests.cpp
@@ -867,7 +867,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
Offer offer = offers.get()[0];
Resources taskResources = Resources::parse("cpus:1;mem:512").get();
- taskResources.allocate(DEFAULT_FRAMEWORK_INFO.role());
+ taskResources.allocate(DEFAULT_FRAMEWORK_INFO.roles(0));
EXPECT_TRUE(Resources(offer.resources()).contains(taskResources));
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/persistent_volume_endpoints_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/persistent_volume_endpoints_tests.cpp b/src/tests/persistent_volume_endpoints_tests.cpp
index 7a24bf4..c9b148d 100644
--- a/src/tests/persistent_volume_endpoints_tests.cpp
+++ b/src/tests/persistent_volume_endpoints_tests.cpp
@@ -79,7 +79,7 @@ public:
{
master::Flags flags = MesosTest::CreateMasterFlags();
flags.allocation_interval = Milliseconds(50);
- flags.roles = createFrameworkInfo().role();
+ flags.roles = createFrameworkInfo().roles(0);
return flags;
}
@@ -87,7 +87,7 @@ public:
FrameworkInfo createFrameworkInfo()
{
FrameworkInfo info = DEFAULT_FRAMEWORK_INFO;
- info.set_role("role1");
+ info.set_roles(0, "role1");
return info;
}
@@ -163,7 +163,7 @@ TEST_F(PersistentVolumeEndpointsTest, StaticReservation)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
Future<OfferID> rescindedOfferId;
@@ -191,7 +191,7 @@ TEST_F(PersistentVolumeEndpointsTest, StaticReservation)
offer = offers.get()[0];
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -223,7 +223,7 @@ TEST_F(PersistentVolumeEndpointsTest, DynamicReservation)
Resources unreserved = Resources::parse("disk:1024").get();
Resources dynamicallyReserved =
unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
Future<Response> response = process::http::post(
master.get()->pid,
@@ -256,7 +256,7 @@ TEST_F(PersistentVolumeEndpointsTest, DynamicReservation)
EXPECT_TRUE(Resources(offer.resources())
.contains(allocatedResources(
- dynamicallyReserved, frameworkInfo.role())));
+ dynamicallyReserved, frameworkInfo.roles(0))));
Future<OfferID> rescindedOfferId;
@@ -268,7 +268,7 @@ TEST_F(PersistentVolumeEndpointsTest, DynamicReservation)
Resources volume = createPersistentVolume(
Megabytes(64),
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
"id1",
"path1",
DEFAULT_CREDENTIAL.principal(),
@@ -293,7 +293,7 @@ TEST_F(PersistentVolumeEndpointsTest, DynamicReservation)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
EXPECT_CALL(sched, offerRescinded(&driver, _))
.WillOnce(FutureArg<1>(&rescindedOfferId));
@@ -343,7 +343,7 @@ TEST_F(PersistentVolumeEndpointsTest, DynamicReservationRoleMismatch)
Resources unreserved = Resources::parse("disk:1024").get();
Resources dynamicallyReserved =
unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
Future<Response> response = process::http::post(
master.get()->pid,
@@ -372,9 +372,9 @@ TEST_F(PersistentVolumeEndpointsTest, DynamicReservationRoleMismatch)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
- ASSERT_NE(frameworkInfo.role(), "role2");
+ ASSERT_NE(frameworkInfo.roles(0), "role2");
Resources volume = createPersistentVolume(
Megabytes(64),
"role2",
@@ -422,7 +422,7 @@ TEST_F(PersistentVolumeEndpointsTest, UnreserveVolumeResources)
Resources unreserved = Resources::parse("disk:1024").get();
Resources dynamicallyReserved =
unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
Future<Response> response = process::http::post(
master.get()->pid,
@@ -434,7 +434,7 @@ TEST_F(PersistentVolumeEndpointsTest, UnreserveVolumeResources)
Resources volume = createPersistentVolume(
Megabytes(64),
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
"id1",
"path1",
DEFAULT_CREDENTIAL.principal(),
@@ -702,7 +702,7 @@ TEST_F(PersistentVolumeEndpointsTest, NoHeader)
Resources volume = createPersistentVolume(
Megabytes(64),
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
"id1",
"path1",
None(),
@@ -873,7 +873,7 @@ TEST_F(PersistentVolumeEndpointsTest, GoodCreateAndDestroyACL)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
Future<OfferID> rescindedOfferId;
@@ -904,7 +904,7 @@ TEST_F(PersistentVolumeEndpointsTest, GoodCreateAndDestroyACL)
offer = offers.get()[0];
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -1100,7 +1100,7 @@ TEST_F(PersistentVolumeEndpointsTest, BadCreateAndDestroyACL)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
// The failed destruction attempt.
Future<Response> destroyResponse = process::http::post(
@@ -1305,7 +1305,7 @@ TEST_F(PersistentVolumeEndpointsTest, GoodCreateAndDestroyACLBadCredential)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
// The failed destruction attempt.
Future<Response> destroyResponse = process::http::post(
@@ -1527,7 +1527,7 @@ TEST_F(PersistentVolumeEndpointsTest, OfferCreateThenEndpointRemove)
Resources unreserved = Resources::parse("disk:512").get();
Resources dynamicallyReserved =
unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
EXPECT_CALL(sched, registered(_, _, _));
@@ -1563,12 +1563,12 @@ TEST_F(PersistentVolumeEndpointsTest, OfferCreateThenEndpointRemove)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
// Create a 1MB persistent volume.
Resources volume = createPersistentVolume(
Megabytes(1),
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
"id1",
"volume_path",
frameworkInfo.principal(),
@@ -1588,7 +1588,7 @@ TEST_F(PersistentVolumeEndpointsTest, OfferCreateThenEndpointRemove)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
Future<OfferID> rescindedOfferId;
@@ -1617,7 +1617,7 @@ TEST_F(PersistentVolumeEndpointsTest, OfferCreateThenEndpointRemove)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(dynamicallyReserved, frameworkInfo.role())));
+ allocatedResources(dynamicallyReserved, frameworkInfo.roles(0))));
EXPECT_CALL(sched, offerRescinded(&driver, _))
.WillOnce(FutureArg<1>(&rescindedOfferId));
@@ -1644,7 +1644,7 @@ TEST_F(PersistentVolumeEndpointsTest, OfferCreateThenEndpointRemove)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -1678,7 +1678,7 @@ TEST_F(PersistentVolumeEndpointsTest, EndpointCreateThenOfferRemove)
Resources unreserved = Resources::parse("disk:512").get();
Resources dynamicallyReserved =
unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
Future<Response> response = process::http::post(
master.get()->pid,
@@ -1691,7 +1691,7 @@ TEST_F(PersistentVolumeEndpointsTest, EndpointCreateThenOfferRemove)
// Create a 1MB persistent volume.
Resources volume = createPersistentVolume(
Megabytes(1),
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
"id1",
"volume_path",
frameworkInfo.principal(),
@@ -1726,7 +1726,7 @@ TEST_F(PersistentVolumeEndpointsTest, EndpointCreateThenOfferRemove)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
// We use the filter explicitly here so that the resources will not
// be filtered for 5 seconds (the default).
@@ -1749,9 +1749,9 @@ TEST_F(PersistentVolumeEndpointsTest, EndpointCreateThenOfferRemove)
EXPECT_TRUE(Resources(offer.resources())
.contains(allocatedResources(
- dynamicallyReserved, frameworkInfo.role())))
+ dynamicallyReserved, frameworkInfo.roles(0))))
<< Resources(offer.resources()) << " vs "
- << allocatedResources(dynamicallyReserved, frameworkInfo.role());
+ << allocatedResources(dynamicallyReserved, frameworkInfo.roles(0));
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers));
@@ -1766,7 +1766,7 @@ TEST_F(PersistentVolumeEndpointsTest, EndpointCreateThenOfferRemove)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(unreserved, frameworkInfo.role())));
+ allocatedResources(unreserved, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -1819,7 +1819,7 @@ TEST_F(PersistentVolumeEndpointsTest, ReserveAndSlaveRemoval)
Resources slave1Unreserved = Resources::parse("cpus:4").get();
Resources slave1Reserved =
slave1Unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
Future<Response> response = process::http::post(
master.get()->pid,
@@ -1856,7 +1856,7 @@ TEST_F(PersistentVolumeEndpointsTest, ReserveAndSlaveRemoval)
Resources slave2Unreserved = Resources::parse("cpus:3").get();
Resources slave2Reserved =
slave2Unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
for (size_t i = 0; i < offers->size(); i++) {
const Offer& offer = offers.get()[i];
@@ -1924,7 +1924,7 @@ TEST_F(PersistentVolumeEndpointsTest, SlavesEndpointFullResources)
Resources unreserved = Resources::parse("cpus:1;mem:512;disk:1024").get();
Resources dynamicallyReserved =
unreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
Future<Response> response = process::http::post(
master.get()->pid,
@@ -1936,7 +1936,7 @@ TEST_F(PersistentVolumeEndpointsTest, SlavesEndpointFullResources)
Resources volume = createPersistentVolume(
Megabytes(64),
- frameworkInfo.role(),
+ frameworkInfo.roles(0),
"id1",
"path1",
DEFAULT_CREDENTIAL.principal(),
@@ -1972,12 +1972,12 @@ TEST_F(PersistentVolumeEndpointsTest, SlavesEndpointFullResources)
Offer offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
Resources taskUnreserved = Resources::parse("cpus:1;mem:256").get();
Resources taskResources =
taskUnreserved.pushReservation(createDynamicReservationInfo(
- frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+ frameworkInfo.roles(0), DEFAULT_CREDENTIAL.principal()));
TaskInfo taskInfo = createTask(offer.slave_id(), taskResources, "sleep 1000");
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae45afc1/src/tests/persistent_volume_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/persistent_volume_tests.cpp b/src/tests/persistent_volume_tests.cpp
index 7b0f436..0450164 100644
--- a/src/tests/persistent_volume_tests.cpp
+++ b/src/tests/persistent_volume_tests.cpp
@@ -15,6 +15,7 @@
// limitations under the License.
#include <list>
+#include <set>
#include <string>
#include <vector>
@@ -68,6 +69,7 @@ using mesos::master::detector::MasterDetector;
using mesos::master::detector::StandaloneMasterDetector;
using std::list;
+using std::set;
using std::string;
using std::vector;
@@ -138,14 +140,16 @@ protected:
master::Flags flags = CreateMasterFlags();
ACLs acls;
- hashset<string> roles;
+ set<string> roles;
foreach (const FrameworkInfo& framework, frameworks) {
mesos::ACL::RegisterFramework* acl = acls.add_register_frameworks();
acl->mutable_principals()->add_values(framework.principal());
- acl->mutable_roles()->add_values(framework.role());
- roles.insert(framework.role());
+ foreach (const string& role, protobuf::framework::getRoles(framework)) {
+ acl->mutable_roles()->add_values(role);
+ roles.insert(role);
+ }
}
flags.acls = acls;
@@ -255,11 +259,11 @@ TEST_P(PersistentVolumeTest, CreateAndDestroyPersistentVolumes)
Clock::pause();
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -375,9 +379,9 @@ TEST_P(PersistentVolumeTest, CreateAndDestroyPersistentVolumes)
// Expect that the offer contains the persistent volumes we created.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume1, frameworkInfo.role())));
+ allocatedResources(volume1, frameworkInfo.roles(0))));
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume2, frameworkInfo.role())));
+ allocatedResources(volume2, frameworkInfo.roles(0))));
// Destroy `volume1`.
driver.acceptOffers(
@@ -432,7 +436,7 @@ TEST_P(PersistentVolumeTest, ResourcesCheckpointing)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -504,7 +508,7 @@ TEST_P(PersistentVolumeTest, PreparePersistentVolume)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -573,7 +577,7 @@ TEST_P(PersistentVolumeTest, MasterFailover)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
MockScheduler sched;
TestingMesosSchedulerDriver driver(&sched, &detector, frameworkInfo);
@@ -649,7 +653,7 @@ TEST_P(PersistentVolumeTest, MasterFailover)
Offer offer2 = offers2.get()[0];
EXPECT_TRUE(Resources(offer2.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -675,7 +679,7 @@ TEST_P(PersistentVolumeTest, IncompatibleCheckpointedResources)
spawn(slave1);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
MockScheduler sched;
MesosSchedulerDriver driver(
@@ -762,7 +766,7 @@ TEST_P(PersistentVolumeTest, AccessPersistentVolume)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
@@ -875,7 +879,7 @@ TEST_P(PersistentVolumeTest, AccessPersistentVolume)
offer = offers.get()[0];
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
Future<CheckpointResourcesMessage> checkpointMessage =
FUTURE_PROTOBUF(CheckpointResourcesMessage(), _, _);
@@ -929,7 +933,7 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeMultipleTasks)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
@@ -1043,7 +1047,7 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeRescindOnDestroy)
// 1. Create framework1 so that all resources are offered to this framework.
FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo1.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo1.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo1.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
@@ -1121,7 +1125,7 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeRescindOnDestroy)
// 3. Create framework2 of the same role. It would be offered resources
// recovered from the framework1 call.
FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo2.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo2.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo2.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
@@ -1143,9 +1147,9 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeRescindOnDestroy)
Offer offer2 = offers2.get()[0];
EXPECT_TRUE(Resources(offer2.resources()).contains(
- allocatedResources(volume1, frameworkInfo2.role())));
+ allocatedResources(volume1, frameworkInfo2.roles(0))));
EXPECT_TRUE(Resources(offer2.resources()).contains(
- allocatedResources(volume2, frameworkInfo2.role())));
+ allocatedResources(volume2, frameworkInfo2.roles(0))));
// 4. framework1 kills the task which results in an offer to framework1
// with the shared volumes. At this point, both frameworks will have
@@ -1168,9 +1172,9 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeRescindOnDestroy)
offer1 = offers1.get()[0];
EXPECT_TRUE(Resources(offer1.resources()).contains(
- allocatedResources(volume1, frameworkInfo1.role())));
+ allocatedResources(volume1, frameworkInfo1.roles(0))));
EXPECT_TRUE(Resources(offer1.resources()).contains(
- allocatedResources(volume2, frameworkInfo1.role())));
+ allocatedResources(volume2, frameworkInfo1.roles(0))));
// 5. DESTROY both the shared volumes via framework2 which would result
// in framework1 being rescinded the offer.
@@ -1215,7 +1219,7 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeMultipleFrameworks)
// 1. Create framework1 so that all resources are offered to this framework.
FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo1.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo1.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo1.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
@@ -1296,7 +1300,7 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeMultipleFrameworks)
// 3. Create framework2 of the same role. It would be offered resources
// recovered from the framework1 call.
FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo2.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo2.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo2.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
@@ -1319,7 +1323,7 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeMultipleFrameworks)
Offer offer2 = offers2.get()[0];
EXPECT_TRUE(Resources(offer2.resources()).contains(
- allocatedResources(volume, frameworkInfo2.role())));
+ allocatedResources(volume, frameworkInfo2.roles(0))));
// 4. framework2 LAUNCHes a task with a subset of resources from the offer.
@@ -1391,7 +1395,7 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeMasterFailover)
// Create the framework with SHARED_RESOURCES capability.
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
@@ -1493,9 +1497,9 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeMasterFailover)
EXPECT_TRUE(Resources(offer2.resources()).contains(
allocatedResources(
Resources::parse("cpus:1;mem:1024").get(),
- frameworkInfo.role())));
+ frameworkInfo.roles(0))));
EXPECT_TRUE(Resources(offer2.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -1517,7 +1521,7 @@ TEST_P(PersistentVolumeTest, DestroyPersistentVolumeMultipleTasks)
filters.set_refuse_seconds(0);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
@@ -1742,7 +1746,7 @@ TEST_P(PersistentVolumeTest, SharedPersistentVolumeMultipleIterations)
// 1. Create framework so that all resources are offered to this framework.
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo.add_capabilities()->set_type(
FrameworkInfo::Capability::SHARED_RESOURCES);
@@ -1880,7 +1884,7 @@ TEST_P(PersistentVolumeTest, SlaveRecovery)
ASSERT_SOME(slave);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo.set_checkpoint(true);
MockScheduler sched;
@@ -2014,12 +2018,12 @@ TEST_P(PersistentVolumeTest, GoodACLCreateThenDestroy)
filters.set_refuse_seconds(0);
FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
@@ -2092,7 +2096,7 @@ TEST_P(PersistentVolumeTest, GoodACLCreateThenDestroy)
// Check that the persistent volume was created successfully.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
EXPECT_TRUE(os::exists(slave::paths::getPersistentVolumePath(
slaveFlags.work_dir,
volume)));
@@ -2124,7 +2128,7 @@ TEST_P(PersistentVolumeTest, GoodACLCreateThenDestroy)
// Check that the persistent volume is not in the offer.
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
driver.stop();
driver.join();
@@ -2159,18 +2163,15 @@ TEST_P(PersistentVolumeTest, GoodACLNoPrincipal)
filters.set_refuse_seconds(0);
// Create a `FrameworkInfo` with no principal.
- FrameworkInfo frameworkInfo;
- frameworkInfo.set_name("no-principal");
- frameworkInfo.set_user(os::user().get());
- frameworkInfo.set_role(DEFAULT_TEST_ROLE);
- frameworkInfo.add_capabilities()->set_type(
- FrameworkInfo::Capability::RESERVATION_REFINEMENT);
+ FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+ frameworkInfo.clear_principal();
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
// Create a master. Since the framework has no
// principal, we don't authenticate frameworks.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
- masterFlags.roles = frameworkInfo.role();
+ masterFlags.roles = frameworkInfo.roles(0);
masterFlags.authenticate_frameworks = false;
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
@@ -2244,7 +2245,7 @@ TEST_P(PersistentVolumeTest, GoodACLNoPrincipal)
// Check that the persistent volume was successfully created.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
EXPECT_TRUE(os::exists(slave::paths::getPersistentVolumePath(
slaveFlags.work_dir,
volume)));
@@ -2274,7 +2275,7 @@ TEST_P(PersistentVolumeTest, GoodACLNoPrincipal)
// Check that the persistent volume was not created
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo.role())));
+ allocatedResources(volume, frameworkInfo.roles(0))));
EXPECT_FALSE(
Resources(checkpointResources2->resources()).contains(volume));
@@ -2317,22 +2318,19 @@ TEST_P(PersistentVolumeTest, BadACLNoPrincipal)
filters.set_refuse_seconds(0);
// Create a `FrameworkInfo` with no principal.
- FrameworkInfo frameworkInfo1;
- frameworkInfo1.set_name("no-principal");
- frameworkInfo1.set_user(os::user().get());
- frameworkInfo1.set_role(DEFAULT_TEST_ROLE);
- frameworkInfo1.add_capabilities()->set_type(
- FrameworkInfo::Capability::RESERVATION_REFINEMENT);
+ FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
+ frameworkInfo1.clear_principal();
+ frameworkInfo1.set_roles(0, DEFAULT_TEST_ROLE);
// Create a `FrameworkInfo` with a principal.
FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo2.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo2.set_roles(0, DEFAULT_TEST_ROLE);
// Create a master. Since one framework has no
// principal, we don't authenticate frameworks.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
- masterFlags.roles = frameworkInfo1.role();
+ masterFlags.roles = frameworkInfo1.roles(0);
masterFlags.authenticate_frameworks = false;
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
@@ -2396,7 +2394,7 @@ TEST_P(PersistentVolumeTest, BadACLNoPrincipal)
// Check that the persistent volume is not contained in this offer.
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo1.role())));
+ allocatedResources(volume, frameworkInfo1.roles(0))));
}
// Decline the offer and suppress so the second
@@ -2452,7 +2450,7 @@ TEST_P(PersistentVolumeTest, BadACLNoPrincipal)
// Check that the persistent volume is contained in this offer.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo2.role())));
+ allocatedResources(volume, frameworkInfo2.roles(0))));
// Decline and suppress offers to `driver2` so that
// `driver1` can receive an offer.
@@ -2498,7 +2496,7 @@ TEST_P(PersistentVolumeTest, BadACLNoPrincipal)
// the offer, we should also confirm that the Destroy operation failed for the
// correct reason. See MESOS-5470.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo1.role())));
+ allocatedResources(volume, frameworkInfo1.roles(0))));
driver1.stop();
driver1.join();
@@ -2542,21 +2540,19 @@ TEST_P(PersistentVolumeTest, BadACLDropCreateAndDestroy)
// Create a `FrameworkInfo` that cannot create or destroy volumes.
FrameworkInfo frameworkInfo1 = DEFAULT_FRAMEWORK_INFO;
- frameworkInfo1.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo1.set_roles(0, DEFAULT_TEST_ROLE);
// Create a `FrameworkInfo` that can create volumes.
- FrameworkInfo frameworkInfo2;
+ FrameworkInfo frameworkInfo2 = DEFAULT_FRAMEWORK_INFO;
frameworkInfo2.set_name("creator-framework");
frameworkInfo2.set_user(os::user().get());
- frameworkInfo2.set_role(DEFAULT_TEST_ROLE);
+ frameworkInfo2.set_roles(0, DEFAULT_TEST_ROLE);
frameworkInfo2.set_principal("creator-principal");
- frameworkInfo2.add_capabilities()->set_type(
- FrameworkInfo::Capability::RESERVATION_REFINEMENT);
// Create a master.
master::Flags masterFlags = CreateMasterFlags();
masterFlags.acls = acls;
- masterFlags.roles = frameworkInfo1.role();
+ masterFlags.roles = frameworkInfo1.roles(0);
masterFlags.authenticate_frameworks = false;
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
@@ -2620,7 +2616,7 @@ TEST_P(PersistentVolumeTest, BadACLDropCreateAndDestroy)
// Check that the persistent volume is not contained in this offer.
EXPECT_FALSE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo1.role())));
+ allocatedResources(volume, frameworkInfo1.roles(0))));
}
// Decline the offer and suppress so the second
@@ -2676,7 +2672,7 @@ TEST_P(PersistentVolumeTest, BadACLDropCreateAndDestroy)
// Check that the persistent volume is contained in this offer.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo2.role())));
+ allocatedResources(volume, frameworkInfo2.roles(0))));
// Decline and suppress offers to `driver2` so that
// `driver1` can receive an offer.
@@ -2722,7 +2718,7 @@ TEST_P(PersistentVolumeTest, BadACLDropCreateAndDestroy)
// the offer, we should also confirm that the Destroy operation failed for the
// correct reason. See MESOS-5470.
EXPECT_TRUE(Resources(offer.resources()).contains(
- allocatedResources(volume, frameworkInfo1.role())));
+ allocatedResources(volume, frameworkInfo1.roles(0))));
driver1.stop();
driver1.join();