Fixed example tests which broke due to the new `register_agents` ACL. - With the new `register_agents` ACL, `permissive == false` would lead to the agent unable to register unless explicitly allowed.
Review: https://reviews.apache.org/r/57730 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/13d0591c Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/13d0591c Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/13d0591c Branch: refs/heads/master Commit: 13d0591cddca4a5c9e892e1d84dcde20ddc8b6c3 Parents: f77be68 Author: Jiang Yan Xu <[email protected]> Authored: Thu Mar 16 17:55:20 2017 -0700 Committer: Jiang Yan Xu <[email protected]> Committed: Fri Apr 28 14:55:13 2017 -0700 ---------------------------------------------------------------------- src/tests/script.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/13d0591c/src/tests/script.cpp ---------------------------------------------------------------------- diff --git a/src/tests/script.cpp b/src/tests/script.cpp index 3b68b84..791d331 100644 --- a/src/tests/script.cpp +++ b/src/tests/script.cpp @@ -158,6 +158,14 @@ void execute(const string& script) register_->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal()); register_->mutable_roles()->add_values("*"); + // Allow agents with any principal or no principal to register. + // Currently the agents in the example tests don't have authentication + // enabled so the agent's principal would be none. + // TODO(xujyan): Enable agent authN and authZ by default in example tests. + mesos::ACL::RegisterAgent* registerAgent = acls.add_register_agents(); + registerAgent->mutable_principals()->set_type(mesos::ACL::Entity::ANY); + registerAgent->mutable_agent()->set_type(mesos::ACL::Entity::ANY); + const string& aclsPath = path::join(directory.get(), "acls"); CHECK_SOME(os::write(aclsPath, stringify(JSON::protobuf(acls))))
