17 #ifndef __TESTS_MESOS_HPP__
18 #define __TESTS_MESOS_HPP__
24 #include <gmock/gmock.h>
75 #include "master/master.hpp"
90 #include "tests/utils.hpp"
94 #endif // MESOS_HAS_JAVA
98 using ::testing::DoDefault;
99 using ::testing::Invoke;
100 using ::testing::Return;
110 "72kUKUFtghAjNbIOvLzfF2RxNBfeM64Bri8g9WhpyaunwqRB/yozHAqSnyHbddAV"
111 "PcWRQlrJAt871oWgSH+n52vMZ3aVI+AFMzXSo8+sUfMk83IGp0WJefhzeQsjDlGH"
112 "GYQgCAuGim0BE2X5U+lEue8s697uQpAO8L/FFRuDH2s";
156 const std::shared_ptr<MockRateLimiter>& slaveRemovalLimiter,
193 const std::string&
id,
200 const std::string&
id,
284 "cpus:4;gpus:0;mem:2048;disk:1024;ports:[31000-32000]"
286 "cpus:2;gpus:0;mem:1024;disk:1024;ports:[31000-32000]"
287 #endif // __WINDOWS__
292 "cpus:1;mem:512;disk:32"
294 "cpus:0.1;mem:32;disk:32"
295 #endif // __WINDOWS__
300 template <
typename T>
305 const static std::string TEST_CGROUPS_HIERARCHY =
"/tmp/mesos_test_cgroup";
308 const static std::string TEST_CGROUPS_ROOT =
"mesos_test";
320 virtual void SetUp();
327 std::string baseHierarchy;
342 #ifdef MESOS_HAS_JAVA
344 class MesosZooKeeperTest :
public MesosTest
347 static void SetUpTestCase()
354 server->startNetwork();
357 "zk://" + server->connectString() +
"/znode");
363 static void TearDownTestCase()
372 server->startNetwork();
375 virtual void TearDown()
377 server->shutdownNetwork();
382 MesosZooKeeperTest() : MesosTest(url) {}
384 virtual master::Flags CreateMasterFlags()
395 static ZooKeeperTestServer* server;
399 #endif // MESOS_HAS_JAVA
408 namespace agent = mesos::v1::agent;
409 namespace maintenance = mesos::v1::maintenance;
410 namespace master = mesos::v1::master;
411 namespace quota = mesos::v1::quota;
413 using mesos::v1::TASK_STAGING;
414 using mesos::v1::TASK_STARTING;
415 using mesos::v1::TASK_RUNNING;
416 using mesos::v1::TASK_KILLING;
417 using mesos::v1::TASK_FINISHED;
418 using mesos::v1::TASK_FAILED;
419 using mesos::v1::TASK_KILLED;
420 using mesos::v1::TASK_ERROR;
421 using mesos::v1::TASK_LOST;
422 using mesos::v1::TASK_DROPPED;
423 using mesos::v1::TASK_UNREACHABLE;
424 using mesos::v1::TASK_GONE;
425 using mesos::v1::TASK_GONE_BY_OPERATOR;
426 using mesos::v1::TASK_UNKNOWN;
428 using mesos::v1::AgentID;
429 using mesos::v1::CheckInfo;
430 using mesos::v1::CommandInfo;
431 using mesos::v1::ContainerID;
432 using mesos::v1::ContainerStatus;
433 using mesos::v1::Environment;
434 using mesos::v1::ExecutorID;
435 using mesos::v1::ExecutorInfo;
436 using mesos::v1::Filters;
437 using mesos::v1::FrameworkID;
438 using mesos::v1::FrameworkInfo;
439 using mesos::v1::HealthCheck;
440 using mesos::v1::InverseOffer;
441 using mesos::v1::MachineID;
442 using mesos::v1::Metric;
443 using mesos::v1::Offer;
444 using mesos::v1::Resource;
445 using mesos::v1::ResourceProviderInfo;
447 using mesos::v1::TaskID;
448 using mesos::v1::TaskInfo;
449 using mesos::v1::TaskGroupInfo;
450 using mesos::v1::TaskState;
451 using mesos::v1::TaskStatus;
452 using mesos::v1::WeightInfo;
458 template <
typename TCredential>
463 TCredential credential;
464 credential.set_principal(
"test-principal");
465 credential.set_secret(
"test-secret");
472 template <
typename TCredential>
477 TCredential credential;
478 credential.set_principal(
"test-principal-2");
479 credential.set_secret(
"test-secret-2");
485 template <
typename TFrameworkInfo,
typename TCredential>
490 TFrameworkInfo framework;
491 framework.set_name(
"default");
492 framework.set_user(
os::user().
get());
493 framework.set_principal(
495 framework.add_roles(
"*");
496 framework.add_capabilities()->set_type(
497 TFrameworkInfo::Capability::MULTI_ROLE);
498 framework.add_capabilities()->set_type(
499 TFrameworkInfo::Capability::RESERVATION_REFINEMENT);
509 inline namespace internal {
529 template <
typename TCommandInfo>
532 const std::vector<std::string>& arguments = {})
534 TCommandInfo commandInfo;
535 if (value.isSome()) {
536 commandInfo.set_value(value.get());
538 if (!arguments.empty()) {
539 commandInfo.set_shell(
false);
540 foreach (
const std::string& arg, arguments) {
541 commandInfo.add_arguments(arg);
548 template <
typename TExecutorInfo,
549 typename TExecutorID,
551 typename TCommandInfo,
552 typename TFrameworkID>
554 const TExecutorID& executorId,
560 TExecutorInfo executor;
561 executor.mutable_executor_id()->CopyFrom(executorId);
563 executor.mutable_command()->CopyFrom(command.
get());
566 executor.mutable_resources()->CopyFrom(resources.
get());
569 executor.set_type(type.
get());
571 if (frameworkId.
isSome()) {
572 executor.mutable_framework_id()->CopyFrom(frameworkId.
get());
578 template <
typename TExecutorInfo,
579 typename TExecutorID,
581 typename TCommandInfo,
582 typename TFrameworkID>
584 const std::string& _executorId,
590 TExecutorID executorId;
591 executorId.set_value(_executorId);
597 executorId, command, resources,
type, frameworkId);
601 template <
typename TExecutorInfo,
602 typename TExecutorID,
604 typename TCommandInfo,
605 typename TFrameworkID>
607 const std::string& executorId,
613 if (resources.isSome()) {
635 template <
typename TExecutorInfo,
636 typename TExecutorID,
638 typename TCommandInfo,
639 typename TFrameworkID>
641 const TExecutorID& executorId,
643 const std::string& resources,
660 template <
typename TExecutorInfo,
661 typename TExecutorID,
663 typename TCommandInfo,
664 typename TFrameworkID>
666 const std::string& executorId,
667 const std::string& command,
672 TCommandInfo commandInfo = createCommandInfo<TCommandInfo>(command);
678 executorId, commandInfo, resources,
type, frameworkId);
682 template <
typename TImage>
686 image.set_type(TImage::DOCKER);
687 image.mutable_docker()->set_name(imageName);
692 template <
typename TVolume>
694 const std::string& containerPath,
695 const std::string& sandboxPath,
699 volume.set_container_path(containerPath);
700 volume.set_mode(mode);
703 volume.set_host_path(sandboxPath);
709 template <
typename TVolume>
711 const std::string& containerPath,
712 const std::string& hostPath,
717 volume.set_container_path(containerPath);
718 volume.set_mode(mode);
720 typename TVolume::Source* source = volume.mutable_source();
721 source->set_type(TVolume::Source::HOST_PATH);
722 source->mutable_host_path()->set_path(hostPath);
724 if (mountPropagationMode.isSome()) {
726 ->mutable_host_path()
727 ->mutable_mount_propagation()
728 ->set_mode(mountPropagationMode.get());
735 template <
typename TVolume,
typename TImage>
737 const std::string& containerPath,
738 const std::string& imageName,
742 volume.set_container_path(containerPath);
743 volume.set_mode(mode);
744 volume.mutable_image()->CopyFrom(createDockerImage<TImage>(imageName));
749 template <
typename TNetworkInfo>
751 const std::string& networkName)
754 info.set_name(networkName);
759 template <
typename TContainerInfo,
typename TVolume,
typename TImage>
762 const std::vector<TVolume>& volumes = {})
765 info.set_type(TContainerInfo::MESOS);
767 if (imageName.isSome()) {
768 TImage*
image = info.mutable_mesos()->mutable_image();
769 image->CopyFrom(createDockerImage<TImage>(imageName.get()));
772 foreach (
const TVolume& volume, volumes) {
773 info.add_volumes()->CopyFrom(volume);
780 inline void setAgentID(TaskInfo* task,
const SlaveID& slaveId)
782 task->mutable_slave_id()->CopyFrom(slaveId);
785 mesos::v1::TaskInfo* task,
786 const mesos::v1::AgentID& agentId)
788 task->mutable_agent_id()->CopyFrom(agentId);
796 typename TExecutorID,
799 typename TExecutorInfo,
800 typename TCommandInfo,
803 const TSlaveID& slaveId,
804 const TResources& resources,
805 const TCommandInfo& command,
807 const std::string&
name =
"test-task",
812 task.mutable_task_id()->set_value(
id);
814 task.mutable_resources()->CopyFrom(resources);
815 if (executorId.isSome()) {
816 TExecutorInfo executor;
817 executor.mutable_executor_id()->CopyFrom(executorId.get());
818 executor.mutable_command()->CopyFrom(command);
819 task.mutable_executor()->CopyFrom(executor);
821 task.mutable_command()->CopyFrom(command);
830 typename TExecutorID,
833 typename TExecutorInfo,
834 typename TCommandInfo,
837 const TSlaveID& slaveId,
838 const TResources& resources,
839 const std::string& command,
841 const std::string&
name =
"test-task",
854 createCommandInfo<TCommandInfo>(command),
863 typename TExecutorID,
866 typename TExecutorInfo,
867 typename TCommandInfo,
871 const std::string& command,
873 const std::string&
name =
"test-task",
893 template <
typename TTaskGroupInfo,
typename TTaskInfo>
896 TTaskGroupInfo taskGroup;
897 foreach (
const TTaskInfo& task, tasks) {
898 taskGroup.add_tasks()->CopyFrom(task);
904 template <
typename TResource>
906 const std::string& role)
908 typename TResource::ReservationInfo info;
909 info.set_type(TResource::ReservationInfo::STATIC);
915 template <
typename TResource,
typename TLabels>
917 const std::string& role,
921 typename TResource::ReservationInfo info;
923 info.set_type(TResource::ReservationInfo::DYNAMIC);
926 if (principal.isSome()) {
927 info.set_principal(principal.get());
930 if (labels.isSome()) {
931 info.mutable_labels()->CopyFrom(labels.get());
941 typename... TReservationInfos>
943 const std::string&
name,
944 const std::string& value,
945 const TReservationInfos&... reservations)
947 std::initializer_list<typename TResource::ReservationInfo> reservations_ = {
952 resource.mutable_reservations()->CopyFrom(
953 google::protobuf::RepeatedPtrField<typename TResource::ReservationInfo>{
954 reservations_.begin(), reservations_.end()});
963 template <
typename TResource,
typename TVolume>
972 typename TResource::DiskInfo info;
974 if (persistenceId.
isSome()) {
975 info.mutable_persistence()->set_id(persistenceId.
get());
978 if (principal.isSome()) {
979 info.mutable_persistence()->set_principal(principal.get());
982 if (containerPath.
isSome()) {
984 volume.set_container_path(containerPath.
get());
985 volume.set_mode(mode.isSome() ? mode.get() : TVolume::RW);
987 if (hostPath.isSome()) {
988 volume.set_host_path(hostPath.get());
991 info.mutable_volume()->CopyFrom(volume);
994 if (source.isSome()) {
995 info.mutable_source()->CopyFrom(source.get());
1003 template <
typename TResource>
1009 typename TResource::DiskInfo::Source source;
1011 source.set_type(TResource::DiskInfo::Source::PATH);
1013 if (root.isSome()) {
1014 source.mutable_path()->set_root(root.get());
1018 source.set_id(
id.
get());
1021 if (profile.isSome()) {
1022 source.set_profile(profile.get());
1030 template <
typename TResource>
1036 typename TResource::DiskInfo::Source source;
1038 source.set_type(TResource::DiskInfo::Source::MOUNT);
1040 if (root.isSome()) {
1041 source.mutable_mount()->set_root(root.get());
1045 source.set_id(
id.
get());
1048 if (profile.isSome()) {
1049 source.set_profile(profile.get());
1057 template <
typename TResource>
1062 typename TResource::DiskInfo::Source source;
1064 source.set_type(TResource::DiskInfo::Source::BLOCK);
1067 source.set_id(
id.
get());
1070 if (profile.isSome()) {
1071 source.set_profile(profile.get());
1079 template <
typename TResource>
1084 typename TResource::DiskInfo::Source source;
1086 source.set_type(TResource::DiskInfo::Source::RAW);
1089 source.set_id(
id.
get());
1092 if (profile.isSome()) {
1093 source.set_profile(profile.get());
1101 template <
typename TResource,
typename TResources,
typename TVolume>
1103 const std::string& value,
1104 const std::string& role,
1108 bool isShared =
false)
1112 if (persistenceID.
isSome() || containerPath.
isSome() || source.isSome()) {
1113 resource.mutable_disk()->CopyFrom(
1114 createDiskInfo<TResource, TVolume>(
1122 resource.mutable_shared();
1132 template <
typename TResource,
typename TResources,
typename TVolume>
1135 const std::string& role,
1136 const std::string& persistenceId,
1137 const std::string& containerPath,
1141 bool isShared =
false)
1148 volume.mutable_disk()->CopyFrom(
1149 createDiskInfo<TResource, TVolume>(
1157 if (reservationPrincipal.isSome()) {
1158 typename TResource::ReservationInfo& reservation =
1159 *volume.mutable_reservations()->rbegin();
1161 reservation.set_type(TResource::ReservationInfo::DYNAMIC);
1162 reservation.set_principal(reservationPrincipal.get());
1166 volume.mutable_shared();
1175 template <
typename TResource,
typename TResources,
typename TVolume>
1178 const std::string& persistenceId,
1179 const std::string& containerPath,
1182 bool isShared =
false)
1185 if (volume.has_disk() && volume.disk().has_source()) {
1186 source = volume.disk().source();
1189 volume.mutable_disk()->CopyFrom(
1190 createDiskInfo<TResource, TVolume>(
1198 if (reservationPrincipal.isSome()) {
1199 typename TResource::ReservationInfo& reservation =
1200 *volume.mutable_reservations()->rbegin();
1202 reservation.set_type(TResource::ReservationInfo::DYNAMIC);
1203 reservation.set_principal(reservationPrincipal.get());
1207 volume.mutable_shared();
1214 template <
typename TCredential>
1216 const TCredential& credential)
1221 base64::encode(credential.principal() +
":" + credential.secret())
1227 template <
typename TWeightInfo>
1229 const std::string& weightsFlag)
1231 google::protobuf::RepeatedPtrField<TWeightInfo>
infos;
1233 foreach (
const std::string& token, tokens) {
1235 EXPECT_EQ(2u, pair.size());
1236 double weight = atof(pair[1].c_str());
1237 TWeightInfo weightInfo;
1238 weightInfo.set_role(pair[0]);
1239 weightInfo.set_weight(weight);
1240 infos.Add()->CopyFrom(weightInfo);
1248 template <
typename TWeightInfo>
1250 const google::protobuf::RepeatedPtrField<TWeightInfo> weightInfos)
1254 foreach (
const TWeightInfo& weightInfo, weightInfos) {
1255 weights[weightInfo.role()] = weightInfo.weight();
1263 template <
typename TDomainInfo>
1265 const std::string& regionName,
1266 const std::string& zoneName)
1270 domain.mutable_fault_domain()->mutable_region()->set_name(regionName);
1271 domain.mutable_fault_domain()->mutable_zone()->set_name(zoneName);
1278 template <
typename TResources,
typename TOffer>
1283 operation.mutable_reserve()->mutable_resources()->CopyFrom(resources);
1288 template <
typename TResources,
typename TOffer>
1293 operation.mutable_unreserve()->mutable_resources()->CopyFrom(resources);
1298 template <
typename TResources,
typename TOffer>
1303 operation.mutable_create()->mutable_volumes()->CopyFrom(volumes);
1308 template <
typename TResources,
typename TOffer>
1313 operation.mutable_destroy()->mutable_volumes()->CopyFrom(volumes);
1318 template <
typename TOffer,
typename TTaskInfo>
1324 foreach (
const TTaskInfo& task, tasks) {
1325 operation.mutable_launch()->add_task_infos()->CopyFrom(task);
1332 template <
typename TExecutorInfo,
typename TTaskGroupInfo,
typename TOffer>
1334 const TExecutorInfo& executorInfo,
1335 const TTaskGroupInfo& taskGroup)
1339 operation.mutable_launch_group()->mutable_executor()->CopyFrom(executorInfo);
1340 operation.mutable_launch_group()->mutable_task_group()->CopyFrom(taskGroup);
1345 template <
typename TResource,
typename TTargetType,
typename TOffer>
1347 const TResource& source,
1348 const TTargetType&
type)
1352 operation.mutable_create_volume()->mutable_source()->CopyFrom(source);
1353 operation.mutable_create_volume()->set_target_type(type);
1358 template <
typename TResource,
typename TOffer>
1363 operation.mutable_destroy_volume()->mutable_volume()->CopyFrom(volume);
1368 template <
typename TResource,
typename TOffer>
1373 operation.mutable_create_block()->mutable_source()->CopyFrom(source);
1378 template <
typename TResource,
typename TOffer>
1383 operation.mutable_destroy_block()->mutable_block()->CopyFrom(block);
1388 template <
typename TParameters,
typename TParameter>
1391 TParameters parameters;
1392 TParameter* parameter = parameters.add_parameter();
1393 parameter->set_key(
"acls");
1403 inline namespace internal {
1404 template <
typename... Args>
1412 FrameworkID>(std::forward<Args>(args)...);
1419 const std::vector<std::string>& arguments = {})
1421 return common::createCommandInfo<CommandInfo>(value, arguments);
1428 const ExecutorInfo& executorInfo,
1429 const std::string& sandboxDirectory,
1432 mesos::slave::ContainerConfig containerConfig;
1433 containerConfig.mutable_executor_info()->CopyFrom(executorInfo);
1434 containerConfig.mutable_command_info()->CopyFrom(executorInfo.command());
1435 containerConfig.mutable_resources()->CopyFrom(executorInfo.resources());
1436 containerConfig.set_directory(sandboxDirectory);
1438 if (
user.isSome()) {
1439 containerConfig.set_user(
user.get());
1443 containerConfig.mutable_task_info()->CopyFrom(taskInfo.
get());
1445 if (taskInfo.
get().has_container()) {
1446 containerConfig.mutable_container_info()
1447 ->CopyFrom(taskInfo.
get().container());
1450 if (executorInfo.has_container()) {
1451 containerConfig.mutable_container_info()
1452 ->CopyFrom(executorInfo.container());
1456 return containerConfig;
1462 const CommandInfo& commandInfo,
1467 mesos::slave::ContainerConfig containerConfig;
1468 containerConfig.mutable_command_info()->CopyFrom(commandInfo);
1470 if (
user.isSome()) {
1471 containerConfig.set_user(
user.get());
1474 if (containerInfo.isSome()) {
1475 containerConfig.mutable_container_info()->CopyFrom(containerInfo.get());
1478 if (containerClass.isSome()) {
1479 containerConfig.set_container_class(containerClass.get());
1482 return containerConfig;
1488 const CommandInfo& commandInfo,
1489 const std::string& resources,
1490 const std::string& sandboxDirectory,
1494 mesos::slave::ContainerConfig containerConfig;
1495 containerConfig.mutable_command_info()->CopyFrom(commandInfo);
1496 containerConfig.mutable_resources()->CopyFrom(
1499 containerConfig.set_directory(sandboxDirectory);
1501 if (
user.isSome()) {
1502 containerConfig.set_user(
user.get());
1505 if (containerInfo.isSome()) {
1506 containerConfig.mutable_container_info()->CopyFrom(containerInfo.get());
1509 return containerConfig;
1513 template <
typename... Args>
1516 return common::createDockerImage<Image>(std::forward<Args>(args)...);
1520 template <
typename... Args>
1523 return common::createVolumeSandboxPath<Volume>(std::forward<Args>(args)...);
1527 template <
typename... Args>
1530 return common::createVolumeHostPath<Volume>(std::forward<Args>(args)...);
1534 template <
typename... Args>
1537 return common::createVolumeFromDockerImage<Volume, Image>(
1538 std::forward<Args>(args)...);
1542 template <
typename... Args>
1545 return common::createNetworkInfo<NetworkInfo>(std::forward<Args>(args)...);
1552 const std::vector<Volume>& volumes = {})
1554 return common::createContainerInfo<ContainerInfo, Volume, Image>(
1560 template <
typename... Args>
1570 Offer>(std::forward<Args>(args)...);
1577 return common::createTaskGroupInfo<TaskGroupInfo, TaskInfo>(tasks);
1582 const std::string& role)
1584 return common::createStaticReservationInfo<Resource>(role);
1589 const std::string& role,
1593 return common::createDynamicReservationInfo<Resource, Labels>(
1594 role, principal, labels);
1598 template <
typename... Args>
1601 return common::createReservedResource<Resource, Resources>(
1602 std::forward<Args>(args)...);
1606 template <
typename... Args>
1609 return common::createDiskInfo<Resource, Volume>(std::forward<Args>(args)...);
1613 template <
typename... Args>
1616 return common::createDiskSourcePath<Resource>(std::forward<Args>(args)...);
1620 template <
typename... Args>
1623 return common::createDiskSourceMount<Resource>(std::forward<Args>(args)...);
1627 template <
typename... Args>
1630 return common::createDiskSourceBlock<Resource>(std::forward<Args>(args)...);
1634 template <
typename... Args>
1637 return common::createDiskSourceRaw<Resource>(std::forward<Args>(args)...);
1641 template <
typename... Args>
1644 return common::createDiskResource<Resource, Resources, Volume>(
1645 std::forward<Args>(args)...);
1649 template <
typename... Args>
1652 return common::createPersistentVolume<Resource, Resources, Volume>(
1653 std::forward<Args>(args)...);
1657 template <
typename... Args>
1660 return common::createBasicAuthHeaders<Credential>(
1661 std::forward<Args>(args)...);
1665 template <
typename... Args>
1669 return common::createWeightInfos<WeightInfo>(std::forward<Args>(args)...);
1673 template <
typename... Args>
1676 return common::convertToHashmap<WeightInfo>(std::forward<Args>(args)...);
1680 template <
typename... Args>
1683 return common::createDomainInfo<DomainInfo>(std::forward<Args>(args)...);
1687 template <
typename... Args>
1690 return common::RESERVE<Resources, Offer>(std::forward<Args>(args)...);
1694 template <
typename... Args>
1697 return common::UNRESERVE<Resources, Offer>(std::forward<Args>(args)...);
1701 template <
typename... Args>
1704 return common::CREATE<Resources, Offer>(std::forward<Args>(args)...);
1708 template <
typename... Args>
1711 return common::DESTROY<Resources, Offer>(std::forward<Args>(args)...);
1718 return common::LAUNCH<Offer, TaskInfo>(tasks);
1722 template <
typename... Args>
1725 return common::LAUNCH_GROUP<ExecutorInfo, TaskGroupInfo, Offer>(
1726 std::forward<Args>(args)...);
1730 template <
typename... Args>
1735 Offer>(std::forward<Args>(args)...);
1739 template <
typename... Args>
1742 return common::DESTROY_VOLUME<Resource, Offer>(std::forward<Args>(args)...);
1746 template <
typename... Args>
1749 return common::CREATE_BLOCK<Resource, Offer>(std::forward<Args>(args)...);
1753 template <
typename... Args>
1756 return common::DESTROY_BLOCK<Resource, Offer>(std::forward<Args>(args)...);
1760 template <
typename... Args>
1763 return common::parameterize<Parameters, Parameter>(
1764 std::forward<Args>(args)...);
1770 template <
typename... Args>
1774 mesos::v1::ExecutorInfo,
1775 mesos::v1::ExecutorID,
1777 mesos::v1::CommandInfo,
1778 mesos::v1::FrameworkID>(std::forward<Args>(args)...);
1785 const std::vector<std::string>& arguments = {})
1787 return common::createCommandInfo<mesos::v1::CommandInfo>(value, arguments);
1791 template <
typename... Args>
1794 return common::createDockerImage<mesos::v1::Image>(
1795 std::forward<Args>(args)...);
1799 template <
typename... Args>
1802 return common::createVolumeSandboxPath<mesos::v1::Volume>(
1803 std::forward<Args>(args)...);
1807 template <
typename... Args>
1810 return common::createVolumeHostPath<mesos::v1::Volume>(
1811 std::forward<Args>(args)...);
1815 template <
typename... Args>
1819 mesos::v1::Volume, mesos::v1::Image>(std::forward<Args>(args)...);
1823 template <
typename... Args>
1826 return common::createNetworkInfo<mesos::v1::NetworkInfo>(
1827 std::forward<Args>(args)...);
1834 const std::vector<mesos::v1::Volume>& volumes = {})
1837 mesos::v1::ContainerInfo, mesos::v1::Volume, mesos::v1::Image>(
1838 imageName, volumes);
1842 template <
typename... Args>
1846 mesos::v1::TaskInfo,
1847 mesos::v1::ExecutorID,
1850 mesos::v1::ExecutorInfo,
1851 mesos::v1::CommandInfo,
1852 mesos::v1::Offer>(std::forward<Args>(args)...);
1858 const std::vector<mesos::v1::TaskInfo>& tasks)
1861 mesos::v1::TaskGroupInfo,
1862 mesos::v1::TaskInfo>(tasks);
1867 const std::string& role)
1869 return common::createStaticReservationInfo<mesos::v1::Resource>(role);
1874 const std::string& role,
1879 mesos::v1::Resource, mesos::v1::Labels>(role, principal, labels);
1883 template <
typename... Args>
1891 template <
typename... Args>
1894 return common::createDiskInfo<mesos::v1::Resource, mesos::v1::Volume>(
1895 std::forward<Args>(args)...);
1899 template <
typename... Args>
1903 return common::createDiskSourcePath<mesos::v1::Resource>(
1904 std::forward<Args>(args)...);
1908 template <
typename... Args>
1912 return common::createDiskSourceMount<mesos::v1::Resource>(
1913 std::forward<Args>(args)...);
1917 template <
typename... Args>
1921 return common::createDiskSourceBlock<mesos::v1::Resource>(
1922 std::forward<Args>(args)...);
1926 template <
typename... Args>
1930 return common::createDiskSourceRaw<mesos::v1::Resource>(
1931 std::forward<Args>(args)...);
1935 template <
typename... Args>
1939 mesos::v1::Resource,
1941 mesos::v1::Volume>(std::forward<Args>(args)...);
1945 template <
typename... Args>
1949 mesos::v1::Resource,
1951 mesos::v1::Volume>(std::forward<Args>(args)...);
1955 template <
typename... Args>
1958 return common::createBasicAuthHeaders<mesos::v1::Credential>(
1959 std::forward<Args>(args)...);
1963 template <
typename... Args>
1964 inline google::protobuf::RepeatedPtrField<
1967 return common::createWeightInfos<mesos::v1::WeightInfo>(
1968 std::forward<Args>(args)...);
1972 template <
typename... Args>
1975 return common::convertToHashmap<mesos::v1::WeightInfo>(
1976 std::forward<Args>(args)...);
1980 template <
typename... Args>
1983 return common::RESERVE<mesos::v1::Resources, mesos::v1::Offer>(
1984 std::forward<Args>(args)...);
1988 template <
typename... Args>
1991 return common::UNRESERVE<mesos::v1::Resources, mesos::v1::Offer>(
1992 std::forward<Args>(args)...);
1996 template <
typename... Args>
1999 return common::CREATE<mesos::v1::Resources, mesos::v1::Offer>(
2000 std::forward<Args>(args)...);
2004 template <
typename... Args>
2007 return common::DESTROY<mesos::v1::Resources, mesos::v1::Offer>(
2008 std::forward<Args>(args)...);
2014 const std::vector<mesos::v1::TaskInfo>& tasks)
2016 return common::LAUNCH<mesos::v1::Offer, mesos::v1::TaskInfo>(tasks);
2020 template <
typename... Args>
2024 mesos::v1::ExecutorInfo,
2025 mesos::v1::TaskGroupInfo,
2026 mesos::v1::Offer>(std::forward<Args>(args)...);
2030 template <
typename... Args>
2036 std::forward<Args>(args)...);
2040 template <
typename... Args>
2043 return common::DESTROY_VOLUME<mesos::v1::Resource, mesos::v1::Offer>(
2044 std::forward<Args>(args)...);
2048 template <
typename... Args>
2051 return common::CREATE_BLOCK<mesos::v1::Resource, mesos::v1::Offer>(
2052 std::forward<Args>(args)...);
2056 template <
typename... Args>
2059 return common::DESTROY_BLOCK<mesos::v1::Resource, mesos::v1::Offer>(
2060 std::forward<Args>(args)...);
2064 template <
typename... Args>
2067 return common::parameterize<mesos::v1::Parameters, mesos::v1::Parameter>(
2068 std::forward<Args>(args)...);
2073 const mesos::v1::FrameworkID& frameworkId,
2074 const mesos::v1::Offer& offer,
2075 const std::vector<mesos::v1::Offer::Operation>& operations)
2078 call.set_type(mesos::v1::scheduler::Call::ACCEPT);
2079 call.mutable_framework_id()->CopyFrom(frameworkId);
2081 mesos::v1::scheduler::Call::Accept*
accept = call.mutable_accept();
2082 accept->add_offer_ids()->CopyFrom(offer.id());
2085 accept->add_operations()->CopyFrom(operation);
2093 const mesos::v1::FrameworkID& frameworkId,
2094 const mesos::v1::AgentID& agentId,
2095 const mesos::v1::scheduler::Event::Update&
update)
2098 call.set_type(mesos::v1::scheduler::Call::ACKNOWLEDGE);
2099 call.mutable_framework_id()->CopyFrom(frameworkId);
2101 mesos::v1::scheduler::Call::Acknowledge* acknowledge =
2102 call.mutable_acknowledge();
2104 acknowledge->mutable_task_id()->CopyFrom(
2105 update.status().task_id());
2107 acknowledge->mutable_agent_id()->CopyFrom(agentId);
2108 acknowledge->set_uuid(update.status().uuid());
2115 const mesos::v1::FrameworkID& frameworkId,
2116 const mesos::v1::TaskID& taskId,
2122 call.mutable_framework_id()->CopyFrom(frameworkId);
2124 mesos::v1::scheduler::Call::Kill*
kill = call.mutable_kill();
2125 kill->mutable_task_id()->CopyFrom(taskId);
2127 if (agentId.isSome()) {
2128 kill->mutable_agent_id()->CopyFrom(agentId.get());
2131 if (killPolicy.isSome()) {
2132 kill->mutable_kill_policy()->CopyFrom(killPolicy.get());
2140 const mesos::v1::FrameworkInfo& frameworkInfo,
2144 call.set_type(mesos::v1::scheduler::Call::SUBSCRIBE);
2146 call.mutable_subscribe()->mutable_framework_info()->CopyFrom(frameworkInfo);
2148 if (frameworkId.isSome()) {
2149 call.mutable_framework_id()->CopyFrom(frameworkId.get());
2162 foreachpair (
const std::string& key,
const std::string& value, map) {
2163 mesos::Environment::Variable* variable = environment.add_variables();
2164 variable->set_name(key);
2165 variable->set_value(value);
2175 "docker network create --driver=bridge --ipv6 "
2176 "--subnet=fd01::/64 %s",
2180 dockerCommand.
get(),
2185 ASSERT_SOME(s) <<
"Unable to create the Docker IPv6 network: "
2196 <<
"Unable to create the Docker IPv6 network "
2197 << DOCKER_IPv6_NETWORK
2198 <<
" : " << err.
get();
2206 "docker network rm %s",
2210 dockerCommand.
get(),
2217 ASSERT_SOME(s) <<
"Unable to delete the Docker IPv6 network: "
2228 <<
"Unable to delete the Docker IPv6 network "
2229 << DOCKER_IPv6_NETWORK
2230 <<
" : " << err.
get();
2235 #define DEFAULT_EXECUTOR_INFO createExecutorInfo("default", "exit 1")
2238 #define DEFAULT_CREDENTIAL DefaultCredential::create()
2239 #define DEFAULT_CREDENTIAL_2 DefaultCredential2::create()
2242 #define DEFAULT_FRAMEWORK_INFO DefaultFrameworkInfo::create()
2245 #define DEFAULT_EXECUTOR_ID DEFAULT_EXECUTOR_INFO.executor_id()
2257 const MasterInfo&));
2258 MOCK_METHOD2(reregistered,
void(
SchedulerDriver*,
const MasterInfo&));
2261 const std::vector<Offer>&));
2263 MOCK_METHOD2(statusUpdate,
void(
SchedulerDriver*,
const TaskStatus&));
2267 const std::string&));
2284 std::vector<Offer> offers =
arg1;
2285 int numTasks = tasks;
2288 for (
size_t i = 0; i < offers.size(); i++) {
2289 const Offer& offer = offers[i];
2294 if (offer.resources_size() > 0 &&
2295 offer.resources(0).has_allocation_info()) {
2300 std::vector<TaskInfo> tasks;
2301 Resources remaining = offer.resources();
2304 launched < numTasks) {
2306 task.set_name(
"TestTask");
2307 task.mutable_task_id()->set_value(
stringify(nextTaskId++));
2308 task.mutable_slave_id()->MergeFrom(offer.slave_id());
2309 task.mutable_executor()->MergeFrom(executor);
2312 role == std::string(
"*")
2318 task.mutable_resources()->MergeFrom(resources.
get());
2319 remaining -= resources.
get();
2321 tasks.push_back(task);
2335 std::vector<Offer> offers =
arg1;
2337 for (
size_t i = 0; i < offers.size(); i++) {
2347 std::vector<Offer> offers =
arg1;
2349 for (
size_t i = 0; i < offers.size(); i++) {
2362 std::vector<Offer> offers =
arg1;
2363 foreach (
const Offer& offer, offers) {
2377 const ExecutorInfo&,
2378 const FrameworkInfo&,
2380 MOCK_METHOD2(reregistered,
void(
ExecutorDriver*,
const SlaveInfo&));
2382 MOCK_METHOD2(launchTask,
void(
ExecutorDriver*,
const TaskInfo&));
2384 MOCK_METHOD2(frameworkMessage,
void(
ExecutorDriver*,
const std::string&));
2407 std::shared_ptr<mesos::master::detector::MasterDetector>(
2414 const FrameworkInfo& framework,
2415 bool implicitAcknowledgements =
true)
2420 implicitAcknowledgements,
2425 std::shared_ptr<mesos::master::detector::MasterDetector>(
2432 const FrameworkInfo& framework,
2433 bool implicitAcknowledgements,
2434 const Credential& credential)
2439 implicitAcknowledgements,
2444 std::shared_ptr<mesos::master::detector::MasterDetector>(
2450 namespace scheduler {
2453 template <
typename Mesos,
typename Event>
2457 MOCK_METHOD1_T(connected,
void(
Mesos*));
2458 MOCK_METHOD1_T(disconnected,
void(
Mesos*));
2459 MOCK_METHOD1_T(heartbeat,
void(
Mesos*));
2460 MOCK_METHOD2_T(subscribed,
void(
Mesos*,
const typename Event::Subscribed&));
2461 MOCK_METHOD2_T(offers,
void(
Mesos*,
const typename Event::Offers&));
2464 void(
Mesos*,
const typename Event::InverseOffers&));
2465 MOCK_METHOD2_T(rescind,
void(
Mesos*,
const typename Event::Rescind&));
2467 rescindInverseOffers,
2468 void(
Mesos*,
const typename Event::RescindInverseOffer&));
2469 MOCK_METHOD2_T(
update,
void(
Mesos*,
const typename Event::Update&));
2471 updateOperationStatus,
2472 void(
Mesos*,
const typename Event::UpdateOperationStatus&));
2473 MOCK_METHOD2_T(message,
void(
Mesos*,
const typename Event::Message&));
2474 MOCK_METHOD2_T(failure,
void(
Mesos*,
const typename Event::Failure&));
2475 MOCK_METHOD2_T(
error,
void(
Mesos*,
const typename Event::Error&));
2479 while (!events.empty()) {
2480 Event event = std::move(events.front());
2483 switch (event.type()) {
2484 case Event::SUBSCRIBED:
2485 subscribed(mesos, event.subscribed());
2488 offers(mesos, event.offers());
2490 case Event::INVERSE_OFFERS:
2491 inverseOffers(mesos, event.inverse_offers());
2493 case Event::RESCIND:
2494 rescind(mesos, event.rescind());
2496 case Event::RESCIND_INVERSE_OFFER:
2497 rescindInverseOffers(mesos, event.rescind_inverse_offer());
2500 update(mesos, event.update());
2502 case Event::UPDATE_OPERATION_STATUS:
2503 updateOperationStatus(mesos, event.update_operation_status());
2505 case Event::MESSAGE:
2506 message(mesos, event.message());
2508 case Event::FAILURE:
2509 failure(mesos, event.failure());
2512 error(mesos, event.error());
2514 case Event::HEARTBEAT:
2518 LOG(FATAL) <<
"Received unexpected UNKNOWN event";
2528 template <
typename Mesos,
typename Event>
2533 const std::string& master,
2536 const Option<std::shared_ptr<mesos::master::detector::MasterDetector>>&
2581 namespace scheduler {
2596 call.set_type(Call::SUBSCRIBE);
2597 call.mutable_subscribe()->mutable_framework_info()->CopyFrom(frameworkInfo);
2606 call.set_type(Call::SUBSCRIBE);
2607 call.mutable_framework_id()->CopyFrom(frameworkId);
2608 call.mutable_subscribe()->mutable_framework_info()->CopyFrom(frameworkInfo);
2609 call.mutable_subscribe()->mutable_framework_info()->mutable_id()->CopyFrom(
2619 call.set_type(Call::ACKNOWLEDGE);
2620 call.mutable_framework_id()->CopyFrom(frameworkId);
2622 Call::Acknowledge* acknowledge = call.mutable_acknowledge();
2623 acknowledge->mutable_task_id()->CopyFrom(
arg1.status().task_id());
2624 acknowledge->mutable_agent_id()->CopyFrom(agentId);
2625 acknowledge->set_uuid(
arg1.status().uuid());
2639 namespace executor {
2642 template <
typename Mesos,
typename Event>
2646 MOCK_METHOD1_T(connected,
void(
Mesos*));
2647 MOCK_METHOD1_T(disconnected,
void(
Mesos*));
2648 MOCK_METHOD2_T(subscribed,
void(
Mesos*,
const typename Event::Subscribed&));
2649 MOCK_METHOD2_T(
launch,
void(
Mesos*,
const typename Event::Launch&));
2650 MOCK_METHOD2_T(launchGroup,
void(
Mesos*,
const typename Event::LaunchGroup&));
2651 MOCK_METHOD2_T(
kill,
void(
Mesos*,
const typename Event::Kill&));
2652 MOCK_METHOD2_T(message,
void(
Mesos*,
const typename Event::Message&));
2654 MOCK_METHOD2_T(
error,
void(
Mesos*,
const typename Event::Error&));
2655 MOCK_METHOD2_T(acknowledged,
2656 void(
Mesos*,
const typename Event::Acknowledged&));
2660 while (!events.empty()) {
2661 Event event = std::move(events.front());
2664 switch (event.type()) {
2665 case Event::SUBSCRIBED:
2666 subscribed(mesos, event.subscribed());
2669 launch(mesos, event.launch());
2672 launchGroup(mesos, event.launch_group());
2675 kill(mesos, event.kill());
2677 case Event::ACKNOWLEDGED:
2678 acknowledged(mesos, event.acknowledged());
2680 case Event::MESSAGE:
2681 message(mesos, event.message());
2683 case Event::SHUTDOWN:
2687 error(mesos, event.error());
2690 LOG(FATAL) <<
"Received unexpected UNKNOWN event";
2700 template <
typename Mesos,
typename Event>
2725 namespace executor {
2743 call.mutable_framework_id()->CopyFrom(frameworkId);
2744 call.mutable_executor_id()->CopyFrom(executorId);
2746 call.set_type(mesos::v1::executor::Call::SUBSCRIBE);
2748 call.mutable_subscribe();
2754 ACTION_P3(SendUpdateFromTask, frameworkId, executorId, state)
2756 mesos::v1::TaskStatus
status;
2757 status.mutable_task_id()->CopyFrom(
arg1.task().task_id());
2758 status.mutable_executor_id()->CopyFrom(executorId);
2759 status.set_state(state);
2760 status.set_source(mesos::v1::TaskStatus::SOURCE_EXECUTOR);
2764 call.mutable_framework_id()->CopyFrom(frameworkId);
2765 call.mutable_executor_id()->CopyFrom(executorId);
2767 call.set_type(mesos::v1::executor::Call::UPDATE);
2769 call.mutable_update()->mutable_status()->CopyFrom(status);
2775 ACTION_P3(SendUpdateFromTaskID, frameworkId, executorId, state)
2777 mesos::v1::TaskStatus
status;
2778 status.mutable_task_id()->CopyFrom(
arg1.task_id());
2779 status.mutable_executor_id()->CopyFrom(executorId);
2780 status.set_state(state);
2781 status.set_source(mesos::v1::TaskStatus::SOURCE_EXECUTOR);
2785 call.mutable_framework_id()->CopyFrom(frameworkId);
2786 call.mutable_executor_id()->CopyFrom(executorId);
2788 call.set_type(mesos::v1::executor::Call::UPDATE);
2790 call.mutable_update()->mutable_status()->CopyFrom(status);
2804 namespace resource_provider {
2810 typename ResourceProviderInfo,
2813 typename ResourceProviderID,
2814 typename OperationState,
2821 const ResourceProviderInfo& _info,
2824 resources(_resources)
2826 ON_CALL(*
this, connected())
2827 .WillByDefault(Invoke(
2833 ResourceProviderInfo,
2839 Source>::connectedDefault));
2840 EXPECT_CALL(*
this, connected()).WillRepeatedly(DoDefault());
2842 ON_CALL(*
this, subscribed(_))
2843 .WillByDefault(Invoke(
2849 ResourceProviderInfo,
2855 Source>::subscribedDefault));
2856 EXPECT_CALL(*
this, subscribed(_)).WillRepeatedly(DoDefault());
2858 ON_CALL(*
this, applyOperation(_))
2859 .WillByDefault(Invoke(
2865 ResourceProviderInfo,
2871 Source>::operationDefault));
2872 EXPECT_CALL(*
this, applyOperation(_)).WillRepeatedly(DoDefault());
2874 ON_CALL(*
this, publishResources(_))
2875 .WillByDefault(Invoke(
2881 ResourceProviderInfo,
2887 Source>::publishDefault));
2888 EXPECT_CALL(*
this, publishResources(_)).WillRepeatedly(DoDefault());
2891 MOCK_METHOD0_T(connected,
void());
2892 MOCK_METHOD0_T(disconnected,
void());
2893 MOCK_METHOD1_T(subscribed,
void(
const typename Event::Subscribed&));
2894 MOCK_METHOD1_T(applyOperation,
void(
const typename Event::ApplyOperation&));
2897 void(
const typename Event::PublishResources&));
2899 acknowledgeOperationStatus,
2900 void(
const typename Event::AcknowledgeOperationStatus&));
2902 reconcileOperations,
2903 void(
const typename Event::ReconcileOperations&));
2907 while (!events.empty()) {
2908 Event event = events.front();
2911 switch (event.type()) {
2912 case Event::SUBSCRIBED:
2913 subscribed(event.subscribed());
2915 case Event::APPLY_OPERATION:
2916 applyOperation(event.apply_operation());
2918 case Event::PUBLISH_RESOURCES:
2919 publishResources(event.publish_resources());
2921 case Event::ACKNOWLEDGE_OPERATION_STATUS:
2922 acknowledgeOperationStatus(event.acknowledge_operation_status());
2924 case Event::RECONCILE_OPERATIONS:
2925 reconcileOperations(event.reconcile_operations());
2928 LOG(FATAL) <<
"Received unexpected UNKNOWN event";
2936 return driver->send(call);
2939 template <
typename Credential>
2943 const Credential& credential)
2945 driver.reset(
new Driver(
2946 std::move(detector),
2953 ResourceProviderInfo,
2966 ResourceProviderInfo,
2972 Source>::disconnected,
2979 ResourceProviderInfo,
2996 call.set_type(Call::SUBSCRIBE);
2997 call.mutable_subscribe()->mutable_resource_provider_info()->CopyFrom(info);
3004 info.mutable_id()->CopyFrom(subscribed.provider_id());
3006 if (resources.isSome()) {
3009 foreach (Resource resource, resources.get()) {
3010 resource.mutable_provider_id()->CopyFrom(info.id());
3011 injected += resource;
3015 call.set_type(Call::UPDATE_STATE);
3016 call.mutable_resource_provider_id()->CopyFrom(info.id());
3018 typename Call::UpdateState*
update = call.mutable_update_state();
3019 update->mutable_resources()->CopyFrom(injected);
3020 update->mutable_resource_version_uuid()->set_value(
3029 CHECK(info.has_id());
3032 call.set_type(Call::UPDATE_OPERATION_STATUS);
3033 call.mutable_resource_provider_id()->CopyFrom(info.id());
3035 typename Call::UpdateOperationStatus*
update =
3036 call.mutable_update_operation_status();
3037 update->mutable_framework_id()->CopyFrom(operation.framework_id());
3038 update->mutable_operation_uuid()->CopyFrom(operation.operation_uuid());
3040 update->mutable_status()->set_state(
3041 OperationState::OPERATION_FINISHED);
3043 switch (operation.info().type()) {
3056 update->mutable_status()->add_converted_resources()->CopyFrom(
3057 operation.info().create_volume().source());
3058 update->mutable_status()
3059 ->mutable_converted_resources()
3063 ->set_type(operation.info().create_volume().target_type());
3066 update->mutable_status()->add_converted_resources()->CopyFrom(
3067 operation.info().destroy_volume().volume());
3068 update->mutable_status()
3069 ->mutable_converted_resources()
3073 ->set_type(Source::RAW);
3076 update->mutable_status()->add_converted_resources()->CopyFrom(
3077 operation.info().create_block().source());
3078 update->mutable_status()
3079 ->mutable_converted_resources()
3083 ->set_type(Source::BLOCK);
3086 update->mutable_status()->add_converted_resources()->CopyFrom(
3087 operation.info().destroy_block().block());
3088 update->mutable_status()
3089 ->mutable_converted_resources()
3093 ->set_type(Source::RAW);
3099 update->mutable_latest_status()->CopyFrom(update->status());
3106 CHECK(info.has_id());
3109 call.set_type(Call::UPDATE_PUBLISH_RESOURCES_STATUS);
3110 call.mutable_resource_provider_id()->CopyFrom(info.id());
3112 typename Call::UpdatePublishResourcesStatus*
update =
3113 call.mutable_update_publish_resources_status();
3114 update->mutable_uuid()->CopyFrom(publish.uuid());
3115 update->set_status(Call::UpdatePublishResourcesStatus::OK);
3124 std::unique_ptr<Driver> driver;
3131 std::string scheme =
"http";
3133 #ifdef USE_SSL_SOCKET
3143 pid.
id +
"/api/v1/resource_provider");
3152 namespace resource_provider {
3165 mesos::v1::ResourceProviderInfo,
3166 mesos::v1::Resource,
3168 mesos::v1::ResourceProviderID,
3169 mesos::v1::OperationState,
3171 mesos::v1::Resource::DiskInfo::Source>;
3189 const authorization::Action& action));
3207 status.mutable_task_id()->MergeFrom(
arg1.task_id());
3208 status.set_state(state);
3209 arg0->sendStatusUpdate(status);
3216 status.mutable_task_id()->MergeFrom(
arg1);
3217 status.set_state(state);
3218 arg0->sendStatusUpdate(status);
3224 arg0->sendFrameworkMessage(data);
3228 #define FUTURE_PROTOBUF(message, from, to) \
3229 FutureProtobuf(message, from, to)
3232 #define DROP_PROTOBUF(message, from, to) \
3233 FutureProtobuf(message, from, to, true)
3236 #define DROP_PROTOBUFS(message, from, to) \
3237 DropProtobufs(message, from, to)
3240 #define EXPECT_NO_FUTURE_PROTOBUFS(message, from, to) \
3241 ExpectNoFutureProtobufs(message, from, to)
3244 #define FUTURE_HTTP_PROTOBUF(message, path, contentType) \
3245 FutureHttp(message, path, contentType)
3248 #define DROP_HTTP_PROTOBUF(message, path, contentType) \
3249 FutureHttp(message, path, contentType, true)
3252 #define DROP_HTTP_PROTOBUFS(message, path, contentType) \
3253 DropHttpProtobufs(message, path, contentType)
3256 #define EXPECT_NO_FUTURE_HTTP_PROTOBUFS(message, path, contentType) \
3257 ExpectNoFutureHttpProtobufs(message, path, contentType)
3268 #define FUTURE_CALL(message, unionType, from, to) \
3269 FutureUnionProtobuf(message, unionType, from, to)
3272 #define DROP_CALL(message, unionType, from, to) \
3273 FutureUnionProtobuf(message, unionType, from, to, true)
3276 #define DROP_CALLS(message, unionType, from, to) \
3277 DropUnionProtobufs(message, unionType, from, to)
3280 #define EXPECT_NO_FUTURE_CALLS(message, unionType, from, to) \
3281 ExpectNoFutureUnionProtobufs(message, unionType, from, to)
3284 #define FUTURE_CALL_MESSAGE(message, unionType, from, to) \
3285 process::FutureUnionMessage(message, unionType, from, to)
3288 #define DROP_CALL_MESSAGE(message, unionType, from, to) \
3289 process::FutureUnionMessage(message, unionType, from, to, true)
3292 #define FUTURE_HTTP_CALL(message, unionType, path, contentType) \
3293 FutureUnionHttp(message, unionType, path, contentType)
3296 #define DROP_HTTP_CALL(message, unionType, path, contentType) \
3297 FutureUnionHttp(message, unionType, path, contentType, true)
3300 #define DROP_HTTP_CALLS(message, unionType, path, contentType) \
3301 DropUnionHttpProtobufs(message, unionType, path, contentType)
3304 #define EXPECT_NO_FUTURE_HTTP_CALLS(message, unionType, path, contentType) \
3305 ExpectNoFutureUnionHttpProtobufs(message, unionType, path, contentType)
3309 template <
typename T>
3313 template <
typename T,
typename From,
typename To>
3317 { google::protobuf::Message* m = &t; (void) m; }
3324 template <
typename Message,
typename UnionType,
typename From,
typename To>
3326 Message message, UnionType unionType, From from, To to,
bool drop =
false)
3329 { google::protobuf::Message* m = &message; (void) m; }
3332 .then(
lambda::bind(&_FutureProtobuf<Message>, lambda::_1));
3336 template <
typename Message,
typename Path>
3344 { google::protobuf::Message* m = &message; (void) m; }
3347 lambda::bind(&deserialize<Message>, contentType, lambda::_1);
3351 return deserializer(request.
body).get();
3356 template <
typename Message,
typename UnionType,
typename Path>
3359 UnionType unionType,
3365 { google::protobuf::Message* m = &message; (void) m; }
3368 lambda::bind(&deserialize<Message>, contentType, lambda::_1);
3371 message, unionType, path, deserializer, drop)
3373 return deserializer(request.
body).get();
3378 template <
typename T>
3382 t.ParseFromString(message.
body);
3387 template <
typename T,
typename From,
typename To>
3391 { google::protobuf::Message* m = &t; (void) m; }
3397 template <
typename Message,
typename UnionType,
typename From,
typename To>
3401 { google::protobuf::Message* m = &message; (void) m; }
3407 template <
typename Message,
typename Path>
3415 { google::protobuf::Message* m = &message; (void) m; }
3418 lambda::bind(&deserialize<Message>, contentType, lambda::_1);
3424 template <
typename Message,
typename UnionType,
typename Path>
3427 UnionType unionType,
3433 { google::protobuf::Message* m = &message; (void) m; }
3436 lambda::bind(&deserialize<Message>, contentType, lambda::_1);
3442 template <
typename T,
typename From,
typename To>
3446 { google::protobuf::Message* m = &t; (void) m; }
3452 template <
typename Message,
typename UnionType,
typename From,
typename To>
3454 Message message, UnionType unionType, From from, To to)
3457 { google::protobuf::Message* m = &message; (void) m; }
3463 template <
typename Message,
typename Path>
3471 { google::protobuf::Message* m = &message; (void) m; }
3474 lambda::bind(&deserialize<Message>, contentType, lambda::_1);
3480 template <
typename Message,
typename UnionType,
typename Path>
3483 UnionType unionType,
3489 { google::protobuf::Message* m = &message; (void) m; }
3492 lambda::bind(&deserialize<Message>, contentType, lambda::_1);
3495 message, unionType, path, deserializer);
3503 foreach (
const Offer& offer, arg) {
3504 foreach (
const Resource& resource, offer.resources()) {
3519 foreach (
const Offer& offer, arg) {
3520 Resources resources = offer.resources();
3524 if (!resource.has_allocation_info()) {
3528 if (resources.
contains(resource)) {
3540 return arg.task_id() == taskInfo.task_id();
3547 return arg.state() == taskState;
3555 return arg.status().task_id() == taskInfo.task_id();
3563 return arg.status().state() == taskState;
3573 const ::testing::TestParamInfo<ParamExecutorType>& info)
const
3575 switch (info.param.type) {
3577 return "CommandExecutor";
3579 return "DefaultExecutor";
3606 ParamExecutorType(
Type _type) :
type(_type) {}
3615 #endif // __TESTS_MESOS_HPP__
TVolume createVolumeFromDockerImage(const std::string &containerPath, const std::string &imageName, const typename TVolume::Mode &mode)
Definition: mesos.hpp:736
TResource::DiskInfo::Source createDiskSourceBlock(const Option< std::string > &id=None(), const Option< std::string > &profile=None())
Definition: mesos.hpp:1058
std::string generate(const std::string &prefix="")
Returns 'prefix(N)' where N represents the number of instances where the same prefix (wrt...
Definition: mesos.hpp:123
static constexpr uint64_t MEGABYTES
Definition: bytes.hpp:35
void start(process::Owned< mesos::internal::EndpointDetector > detector, ContentType contentType, const Credential &credential)
Definition: mesos.hpp:2940
Future< process::Message > FutureUnionMessage(Message message, UnionType unionType, From from, To to, bool drop=false)
Definition: gmock.hpp:481
#define DEFAULT_FRAMEWORK_INFO
Definition: mesos.hpp:2242
Definition: mesos.hpp:473
const std::string defaultAgentResourcesString
Definition: mesos.hpp:282
Try< Subprocess > subprocess(const std::string &path, std::vector< std::string > argv, const Subprocess::IO &in=Subprocess::FD(STDIN_FILENO), const Subprocess::IO &out=Subprocess::FD(STDOUT_FILENO), const Subprocess::IO &err=Subprocess::FD(STDERR_FILENO), const flags::FlagsBase *flags=nullptr, const Option< std::map< std::string, std::string >> &environment=None(), const Option< lambda::function< pid_t(const lambda::function< int()> &)>> &clone=None(), const std::vector< Subprocess::ParentHook > &parent_hooks={}, const std::vector< Subprocess::ChildHook > &child_hooks={})
Forks a subprocess and execs the specified 'path' with the specified 'argv', redirecting stdin...
TOffer::Operation DESTROY_BLOCK(const TResource &block)
Definition: mesos.hpp:1379
constexpr const char * arg1
Definition: shell.hpp:43
static TFrameworkInfo create()
Definition: mesos.hpp:488
ContentType
Definition: http.hpp:43
Definition: capabilities.hpp:42
Try< bool > update(const std::string &link, const Handle &parent, uint16_t protocol, const action::Mirror &mirror)
TOffer::Operation LAUNCH(const std::vector< TTaskInfo > &tasks)
Definition: mesos.hpp:1319
process::Owned< EndpointDetector > createEndpointDetector(const process::UPID &pid)
Definition: mesos.hpp:3127
Try< Bytes > size(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:100
Definition: executor.hpp:146
Future< Response > request(const Request &request, bool streamedResponse=false)
Asynchronously sends an HTTP request to the process and returns the HTTP response once the entire res...
TOffer::Operation CREATE_BLOCK(const TResource &source)
Definition: mesos.hpp:1369
const T & get() const
Definition: future.hpp:1310
void removeDockerIPv6UserNetwork()
Definition: mesos.hpp:2202
network::inet::Address address
Definition: pid.hpp:177
TNetworkInfo createNetworkInfo(const std::string &networkName)
Definition: mesos.hpp:750
void setAgentID(TaskInfo *task, const SlaveID &slaveId)
Definition: mesos.hpp:780
void connectedDefault()
Definition: mesos.hpp:2993
process::http::Headers createBasicAuthHeaders(const TCredential &credential)
Definition: mesos.hpp:1215
mesos::v1::scheduler::Call createCallSubscribe(const mesos::v1::FrameworkInfo &frameworkInfo, const Option< mesos::v1::FrameworkID > &frameworkId=None())
Definition: mesos.hpp:2139
void events(std::queue< Event > events)
Definition: mesos.hpp:2905
void DropHttpProtobufs(Message message, Path path, ContentType contentType, bool drop=false)
Definition: mesos.hpp:3408
TVolume createVolumeHostPath(const std::string &containerPath, const std::string &hostPath, const typename TVolume::Mode &mode, const Option< MountPropagation::Mode > &mountPropagationMode=None())
Definition: mesos.hpp:710
static void TearDownTestCase()
MesosTest(const Option< zookeeper::URL > &url=None())
virtual Try< process::Owned< cluster::Master > > StartMaster(const Option< master::Flags > &flags=None())
mesos::v1::executor::Event Event
Definition: mesos.hpp:2730
mesos::v1::resource_provider::Event Event
Definition: mesos.hpp:3157
void ExpectNoFutureUnionMessages(Message message, UnionType unionType, From from, To to)
Definition: gmock.hpp:630
Definition: message.hpp:22
Result< std::string > user(Option< uid_t > uid=None())
Definition: su.hpp:277
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
const std::string defaultTaskResourcesString
Definition: mesos.hpp:290
static IO PATH(const std::string &path)
virtual Status launchTasks(const std::vector< OfferID > &offerIds, const std::vector< TaskInfo > &tasks, const Filters &filters=Filters())=0
mesos::v1::scheduler::Call Call
Definition: mesos.hpp:2583
TOffer::Operation DESTROY_VOLUME(const TResource &volume)
Definition: mesos.hpp:1359
Definition: resources.hpp:79
Definition: mesos.hpp:2701
ResourceProviderInfo info
Definition: mesos.hpp:3120
Definition: scheduler.hpp:346
std::string encode(const std::string &s)
Encode a string to Base64 with the standard Base64 alphabet.
Definition: base64.hpp:159
static void SetUpTestCase()
Definition: mesos.hpp:2454
bool isCommandExecutor() const
Definition: mesos.hpp:3596
TestMesos(ContentType contentType, const std::shared_ptr< MockHTTPExecutor< Mesos, Event >> &executor)
Definition: mesos.hpp:2704
static void SetUpTestCase()
ACTION_P3(SendUpdateFromTask, frameworkId, executorId, state)
Definition: mesos.hpp:2754
void DropUnionHttpRequests(Message message, UnionType unionType, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:563
Definition: scheduler.hpp:65
Operation
Definition: cgroups.hpp:441
virtual void TearDown()
Definition: utils.hpp:52
mesos::v1::scheduler::Mesos Mesos
Definition: mesos.hpp:2585
TOffer::Operation CREATE_VOLUME(const TResource &source, const TTargetType &type)
Definition: mesos.hpp:1346
tests::executor::MockHTTPExecutor< mesos::v1::executor::Mesos, mesos::v1::executor::Event > MockHTTPExecutor
Definition: mesos.hpp:2799
T _FutureProtobuf(const process::Message &message)
Definition: mesos.hpp:3379
Mode
Definition: paths.hpp:80
TResource createReservedResource(const std::string &name, const std::string &value, const TReservationInfos &...reservations)
Definition: mesos.hpp:942
void DropUnionProtobufs(Message message, UnionType unionType, From from, To to)
Definition: mesos.hpp:3398
hashmap< std::string, double > convertToHashmap(const google::protobuf::RepeatedPtrField< TWeightInfo > weightInfos)
Definition: mesos.hpp:1249
bool isSome() const
Definition: option.hpp:115
constexpr const char * arg0
Definition: shell.hpp:42
TResource::ReservationInfo createDynamicReservationInfo(const std::string &role, const Option< std::string > &principal=None(), const Option< TLabels > &labels=None())
Definition: mesos.hpp:916
TContainerInfo createContainerInfo(const Option< std::string > &imageName=None(), const std::vector< TVolume > &volumes={})
Definition: mesos.hpp:760
mesos::v1::scheduler::Event Event
Definition: mesos.hpp:2584
static Try< Resource > parse(const std::string &name, const std::string &value, const std::string &role)
Returns a Resource with the given name, value, and role.
Resource provider driver.
Definition: resource_provider.hpp:56
void DropHttpRequests(Message message, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:544
TestingMesosSchedulerDriver(Scheduler *scheduler, mesos::master::detector::MasterDetector *_detector, const FrameworkInfo &framework, bool implicitAcknowledgements, const Credential &credential)
Definition: mesos.hpp:2429
Definition: resource_estimator.hpp:37
Environment * environment
process::Future< Message > FutureUnionHttp(Message message, UnionType unionType, Path path, ContentType contentType, bool drop=false)
Definition: mesos.hpp:3357
std::vector< std::string > tokenize(const std::string &s, const std::string &delims, const Option< size_t > &maxTokens=None())
Definition: strings.hpp:138
This interface is used to enable an identity service or any other back end to check authorization pol...
Definition: authorizer.hpp:243
TExecutorInfo createExecutorInfo(const TExecutorID &executorId, const Option< TCommandInfo > &command, const Option< TResources > &resources, const Option< typename TExecutorInfo::Type > &type, const Option< TFrameworkID > &frameworkId)
Definition: mesos.hpp:553
Definition: scheduler.hpp:185
#define CHECK_SOME(expression)
Definition: check.hpp:44
Definition: mesos.hpp:2392
Definition: containerizer.hpp:57
static UUID random()
Definition: uuid.hpp:38
Resources pushReservation(const Resource::ReservationInfo &reservation) const
TOffer::Operation DESTROY(const TResources &volumes)
Definition: mesos.hpp:1309
void DropUnionMessages(Message message, UnionType unionType, From from, To to)
Definition: gmock.hpp:532
An "untyped" PID, used to encapsulate the process ID for lower-layer abstractions (eg...
Definition: pid.hpp:39
Option< int_fd > err() const
Definition: subprocess.hpp:268
mesos::v1::scheduler::Call createCallAccept(const mesos::v1::FrameworkID &frameworkId, const mesos::v1::Offer &offer, const std::vector< mesos::v1::Offer::Operation > &operations)
Definition: mesos.hpp:2072
const ExecutorID id
Definition: mesos.hpp:2388
#define AWAIT_READY(actual)
Definition: gtest.hpp:281
process::PID< master::Master > launch(const Flags &flags, mesos::allocator::Allocator *_allocator=nullptr)
Try< std::vector< Info > > infos(int familiy, int states)
void events(Mesos *mesos, std::queue< Event > events)
Definition: mesos.hpp:2477
Result< std::vector< Filter< Classifier > > > filters(const std::string &_link, const Handle &parent)
Definition: internal.hpp:776
TResource::DiskInfo::Source createDiskSourcePath(const Option< std::string > &root=None(), const Option< std::string > &id=None(), const Option< std::string > &profile=None())
Definition: mesos.hpp:1004
#define DEFAULT_CREDENTIAL
Definition: mesos.hpp:2238
Represents a POSIX or Windows file system path and offers common path manipulations.
Definition: path.hpp:145
constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[]
Definition: mesos.hpp:107
Definition: mesos.hpp:3570
virtual slave::Flags CreateSlaveFlags()
Try< long > cpus()
Definition: os.hpp:280
Iterable< V > map(F &&f, const Iterable< U, Us...> &input)
Definition: lambda.hpp:45
void ExpectNoFutureUnionProtobufs(Message message, UnionType unionType, From from, To to)
Definition: mesos.hpp:3453
Definition: mesos.hpp:486
TTaskInfo createTask(const TSlaveID &slaveId, const TResources &resources, const TCommandInfo &command, const Option< TExecutorID > &executorId=None(), const std::string &name="test-task", const std::string &id=id::UUID::random().toString())
Definition: mesos.hpp:802
Definition: mesos.hpp:459
Definition: mesos.hpp:3193
constexpr char READONLY_HTTP_AUTHENTICATION_REALM[]
Definition: mesos.hpp:106
TVolume createVolumeSandboxPath(const std::string &containerPath, const std::string &sandboxPath, const typename TVolume::Mode &mode)
Definition: mesos.hpp:693
virtual Status declineOffer(const OfferID &offerId, const Filters &filters=Filters())=0
uint16_t port
Definition: address.hpp:135
static Option< T > none()
Definition: option.hpp:31
constexpr char DEFAULT_TEST_ROLE[]
Definition: mesos.hpp:108
std::string operator()(const ::testing::TestParamInfo< ParamExecutorType > &info) const
Definition: mesos.hpp:3572
Resources toUnreserved() const
Try< ImageManifest > parse(const std::string &value)
Definition: parse.hpp:36
void DropProtobufs(T t, From from, To to)
Definition: mesos.hpp:3388
Definition: mesos.hpp:3567
const T & get() const &
Definition: option.hpp:118
TOffer::Operation UNRESERVE(const TResources &resources)
Definition: mesos.hpp:1289
Definition: resources.hpp:79
#define foreachpair(KEY, VALUE, ELEMS)
Definition: foreach.hpp:51
static ParamExecutorType defaultExecutor()
Definition: mesos.hpp:3591
The SecretGenerator interface represents a mechanism to create a secret from a principal.
Definition: secret_generator.hpp:34
const int UNKNOWN
Definition: diagnosis.hpp:39
TResource::ReservationInfo createStaticReservationInfo(const std::string &role)
Definition: mesos.hpp:905
Try< int_fd > accept(int_fd s)
Definition: network.hpp:31
Definition: scheduler.hpp:69
static Try< URL > parse(const std::string &url)
Definition: url.hpp:75
Definition: executor.hpp:74
TParameters parameterize(const ACLs &acls)
Definition: mesos.hpp:1389
process::Future< Message > FutureHttp(Message message, Path path, ContentType contentType, bool drop=false)
Definition: mesos.hpp:3337
Definition: executor.hpp:54
mesos::v1::resource_provider::Call Call
Definition: mesos.hpp:3156
Definition: detector.hpp:36
bool isDefaultExecutor() const
Definition: mesos.hpp:3597
TestMesos(const std::string &master, ContentType contentType, const std::shared_ptr< MockHTTPScheduler< Mesos, Event >> &scheduler, const Option< std::shared_ptr< mesos::master::detector::MasterDetector >> &detector=None())
Definition: mesos.hpp:2532
JSON::Proxy jsonify(const T &)
Definition: jsonify.hpp:779
#define UNREACHABLE()
Definition: unreachable.hpp:22
static ParamExecutorType commandExecutor()
Definition: mesos.hpp:3586
Basic model of an allocator: resources are allocated to a framework in the form of offers...
Definition: allocator.hpp:55
mesos::v1::executor::Call Call
Definition: mesos.hpp:2729
Future< Message > FutureMessage(Name name, From from, To to, bool drop=false)
Definition: gmock.hpp:462
void events(Mesos *mesos, std::queue< Event > events)
Definition: mesos.hpp:2658
void operationDefault(const typename Event::ApplyOperation &operation)
Definition: mesos.hpp:3027
void ExpectNoFutureUnionHttpRequests(Message message, UnionType unionType, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:600
Definition: protobuf.hpp:692
#define flags
Definition: decoder.hpp:18
process::Future< Message > FutureUnionProtobuf(Message message, UnionType unionType, From from, To to, bool drop=false)
Definition: mesos.hpp:3325
Definition: mesos.hpp:2529
URI image(const std::string &repository, const std::string &reference, const std::string ®istry, const Option< std::string > &scheme=None(), const Option< int > &port=None())
Definition: docker.hpp:30
TResource::DiskInfo::Source createDiskSourceMount(const Option< std::string > &root=None(), const Option< std::string > &id=None(), const Option< std::string > &profile=None())
Definition: mesos.hpp:1031
Contains information associated with an authenticated principal.
Definition: authenticator.hpp:41
process::Future< Nothing > send(const Call &call)
Definition: mesos.hpp:2934
void ExpectNoFutureMessages(Name name, From from, To to)
Definition: gmock.hpp:618
TResource::DiskInfo createDiskInfo(const Option< std::string > &persistenceId, const Option< std::string > &containerPath, const Option< typename TVolume::Mode > &mode=None(), const Option< std::string > &hostPath=None(), const Option< typename TResource::DiskInfo::Source > &source=None(), const Option< std::string > &principal=None())
Definition: mesos.hpp:964
bool block(int signal)
Definition: signals.hpp:61
TestingMesosSchedulerDriver(Scheduler *scheduler, mesos::master::detector::MasterDetector *_detector, const FrameworkInfo &framework, bool implicitAcknowledgements=true)
Definition: mesos.hpp:2411
std::string error(const std::string &msg, uint32_t code)
void ExpectNoFutureUnionHttpProtobufs(Message message, UnionType unionType, Path path, ContentType contentType, bool drop=false)
Definition: mesos.hpp:3481
void ExpectNoFutureHttpProtobufs(Message message, Path path, ContentType contentType, bool drop=false)
Definition: mesos.hpp:3464
Type
Definition: capabilities.hpp:79
mesos::v1::scheduler::Call createCallKill(const mesos::v1::FrameworkID &frameworkId, const mesos::v1::TaskID &taskId, const Option< mesos::v1::AgentID > &agentId=None(), const Option< mesos::v1::KillPolicy > &killPolicy=None())
Definition: mesos.hpp:2114
Definition: mesos.hpp:301
MockResourceProvider(const ResourceProviderInfo &_info, const Option< Resources > &_resources=None())
Definition: mesos.hpp:2820
std::string body
Definition: http.hpp:563
uint64_t bytes() const
Definition: bytes.hpp:79
TDomainInfo createDomainInfo(const std::string ®ionName, const std::string &zoneName)
Definition: mesos.hpp:1264
Definition: mesos.hpp:3177
constexpr char DOCKER_IPv6_NETWORK[]
Definition: mesos.hpp:114
TResource createPersistentVolume(const Bytes &size, const std::string &role, const std::string &persistenceId, const std::string &containerPath, const Option< std::string > &reservationPrincipal=None(), const Option< typename TResource::DiskInfo::Source > &source=None(), const Option< std::string > &creatorPrincipal=None(), bool isShared=false)
Definition: mesos.hpp:1133
void publishDefault(const typename Event::PublishResources &publish)
Definition: mesos.hpp:3104
std::string body
Definition: message.hpp:27
Future< http::Request > FutureUnionHttpRequest(Message message, UnionType unionType, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:438
Option< zookeeper::URL > zookeeperUrl
Definition: mesos.hpp:269
An abstraction of a Master detector which can be used to detect the leading master from a group...
Definition: detector.hpp:38
Try< uint32_t > type(const std::string &path)
TResource::DiskInfo::Source createDiskSourceRaw(const Option< std::string > &id=None(), const Option< std::string > &profile=None())
Definition: mesos.hpp:1080
google::protobuf::RepeatedPtrField< TWeightInfo > createWeightInfos(const std::string &weightsFlag)
Definition: mesos.hpp:1228
TResource createDiskResource(const std::string &value, const std::string &role, const Option< std::string > &persistenceID, const Option< std::string > &containerPath, const Option< typename TResource::DiskInfo::Source > &source=None(), bool isShared=false)
Definition: mesos.hpp:1102
Definition: mesos.hpp:2817
TOffer::Operation LAUNCH_GROUP(const TExecutorInfo &executorInfo, const TTaskGroupInfo &taskGroup)
Definition: mesos.hpp:1333
void createDockerIPv6UserNetwork()
Definition: mesos.hpp:2171
Future< size_t > read(int_fd fd, void *data, size_t size)
Performs a single non-blocking read by polling on the specified file descriptor until any data can be...
Try< mode_t > mode(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:126
ACTION_P5(LaunchTasks, executor, tasks, cpus, mem, role)
Definition: mesos.hpp:2281
static TCredential create()
Definition: mesos.hpp:475
void allocate(const std::string &role)
virtual void SetUp()
Definition: utils.hpp:35
void ExpectNoFutureProtobufs(T t, From from, To to)
Definition: mesos.hpp:3443
virtual ~TestMesos()
Definition: mesos.hpp:2554
process::Future< T > FutureProtobuf(T t, From from, To to, bool drop=false)
Definition: mesos.hpp:3314
TTaskGroupInfo createTaskGroupInfo(const std::vector< TTaskInfo > &tasks)
Definition: mesos.hpp:894
Option< Resources > find(const Resources &targets) const
Try< std::string > format(const std::string &s, const T &...t)
Definition: format.hpp:58
Definition: mesos.hpp:2370
Try< Nothing > kill(const std::string &hierarchy, const std::string &cgroup, int signal)
void subscribedDefault(const typename Event::Subscribed &subscribed)
Definition: mesos.hpp:3002
Try< Nothing > bind(int_fd s, const Address &address)
Definition: network.hpp:46
TOffer::Operation RESERVE(const TResources &resources)
Definition: mesos.hpp:1279
struct process::UPID::ID id
Definition: qos_controller.hpp:44
Definition: zookeeper_test_server.hpp:36
ACTION_P2(InvokeRecoverResourcesWithFilters, allocator, timeout)
Definition: allocator.hpp:172
static void pause()
Pauses the clock e.g.
#define ASSERT_SOME(actual)
Definition: gtest.hpp:128
constexpr char DEFAULT_JWT_SECRET_KEY[]
Definition: mesos.hpp:109
std::string stringify(int flags)
net::IP ip
Definition: address.hpp:134
bool contains(const Resources &that) const
ACTION_P(InvokeInitialize, allocator)
Definition: allocator.hpp:46
tests::scheduler::MockHTTPScheduler< mesos::v1::scheduler::Mesos, mesos::v1::scheduler::Event > MockHTTPScheduler
Definition: mesos.hpp:2634
Definition: mesos.hpp:2643
TestingMesosSchedulerDriver(Scheduler *scheduler, mesos::master::detector::MasterDetector *_detector)
Definition: mesos.hpp:2395
static bool paused()
Check whether clock is currently running.
static TCredential create()
Definition: mesos.hpp:461
TOffer::Operation CREATE(const TResources &volumes)
Definition: mesos.hpp:1299
void ExpectNoFutureHttpRequests(Message message, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:581
ACTION(DeclineOffers)
Definition: mesos.hpp:2332
TCommandInfo createCommandInfo(const Option< std::string > &value=None(), const std::vector< std::string > &arguments={})
Definition: mesos.hpp:530
Future< http::Request > FutureHttpRequest(Message message, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:412
TImage createDockerImage(const std::string &imageName)
Definition: mesos.hpp:683
const T & get() const
Definition: try.hpp:73
constexpr const char * name
Definition: shell.hpp:41
Future< Option< int > > status() const
Exit status of this subprocess captured as a Future (completed when the subprocess exits)...
Definition: subprocess.hpp:294
void DropUnionHttpProtobufs(Message message, UnionType unionType, Path path, ContentType contentType, bool drop=false)
Definition: mesos.hpp:3425
mesos::slave::ContainerConfig createContainerConfig(const Option< TaskInfo > &taskInfo, const ExecutorInfo &executorInfo, const std::string &sandboxDirectory, const Option< std::string > &user=None())
Definition: mesos.hpp:1426
mesos::v1::scheduler::Call createCallAcknowledge(const mesos::v1::FrameworkID &frameworkId, const mesos::v1::AgentID &agentId, const mesos::v1::scheduler::Event::Update &update)
Definition: mesos.hpp:2092
Try< std::set< std::string > > subsystems()
Definition: mesos.hpp:2249
void filter(Filter *filter)
virtual master::Flags CreateMasterFlags()
virtual Try< process::Owned< cluster::Slave > > StartSlave(mesos::master::detector::MasterDetector *detector, const Option< slave::Flags > &flags=None())
MATCHER_P(OffersHaveAnyResource, filter,"")
Definition: mesos.hpp:3501
void DropMessages(Name name, From from, To to)
Definition: gmock.hpp:520
Definition: future.hpp:57
mesos::Environment createEnvironment(const hashmap< std::string, std::string > &map)
Definition: mesos.hpp:2158