本文整理汇总了C++中ACLs::add_teardown_frameworks方法的典型用法代码示例。如果您正苦于以下问题:C++ ACLs::add_teardown_frameworks方法的具体用法?C++ ACLs::add_teardown_frameworks怎么用?C++ ACLs::add_teardown_frameworks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACLs
的用法示例。
在下文中一共展示了ACLs::add_teardown_frameworks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: driver
// Testing route with good ACLs.
TEST_F(TeardownTest, TeardownEndpointGoodACLs)
{
// Setup ACLs so that the default principal can teardown the
// framework.
ACLs acls;
mesos::ACL::TeardownFramework* acl = acls.add_teardown_frameworks();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
acl->mutable_framework_principals()->add_values(
DEFAULT_CREDENTIAL.principal());
master::Flags flags = CreateMasterFlags();
flags.acls = acls;
Try<PID<Master> > master = StartMaster(flags);
ASSERT_SOME(master);
MockScheduler sched;
MesosSchedulerDriver driver(
&sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
Future<FrameworkID> frameworkId;
EXPECT_CALL(sched, registered(&driver, _, _))
.WillOnce(FutureArg<1>(&frameworkId));
ASSERT_EQ(DRIVER_RUNNING, driver.start());
AWAIT_READY(frameworkId);
process::http::Headers headers;
headers["Authorization"] = "Basic " +
base64::encode(DEFAULT_CREDENTIAL.principal() +
":" + DEFAULT_CREDENTIAL.secret());
Future<Response> response = process::http::post(
master.get(),
"teardown",
headers,
"frameworkId=" + frameworkId.get().value());
AWAIT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
driver.stop();
driver.join();
Shutdown();
}
示例2: driver
// Testing route with bad ACLs.
TEST_F(TeardownTest, BadACLs)
{
// Setup ACLs so that no principal can teardown the framework.
ACLs acls;
mesos::ACL::TeardownFramework* acl = acls.add_teardown_frameworks();
acl->mutable_principals()->set_type(mesos::ACL::Entity::NONE);
acl->mutable_framework_principals()->add_values(
DEFAULT_CREDENTIAL.principal());
master::Flags flags = CreateMasterFlags();
flags.acls = acls;
Try<Owned<cluster::Master>> master = StartMaster(flags);
ASSERT_SOME(master);
MockScheduler sched;
MesosSchedulerDriver driver(
&sched, DEFAULT_FRAMEWORK_INFO, master.get()->pid, DEFAULT_CREDENTIAL);
Future<FrameworkID> frameworkId;
EXPECT_CALL(sched, registered(&driver, _, _))
.WillOnce(FutureArg<1>(&frameworkId));
ASSERT_EQ(DRIVER_RUNNING, driver.start());
AWAIT_READY(frameworkId);
Future<Response> response = process::http::post(
master.get()->pid,
"teardown",
createBasicAuthHeaders(DEFAULT_CREDENTIAL),
"frameworkId=" + frameworkId.get().value());
AWAIT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(Forbidden().status, response);
driver.stop();
driver.join();
}