You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2017/02/08 00:38:19 UTC
[3/7] mesos git commit: Switched to implicit roles in master quota
tests.
Switched to implicit roles in master quota tests.
Using an explicit role list is deprecated; this change will also make it
easier to write test cases for hierarchical roles.
Review: https://reviews.apache.org/r/56247/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d7f47762
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d7f47762
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d7f47762
Branch: refs/heads/master
Commit: d7f4776235a13fdd4b2421b919071eca396df3f0
Parents: 02a7cf2
Author: Neil Conway <ne...@gmail.com>
Authored: Mon Feb 6 13:05:08 2017 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Tue Feb 7 16:23:11 2017 -0800
----------------------------------------------------------------------
src/tests/master_quota_tests.cpp | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/d7f47762/src/tests/master_quota_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_quota_tests.cpp b/src/tests/master_quota_tests.cpp
index dbf0fdf..c9b7ae4 100644
--- a/src/tests/master_quota_tests.cpp
+++ b/src/tests/master_quota_tests.cpp
@@ -98,12 +98,11 @@ protected:
"cpus:2;gpus:0;mem:1024;disk:1024;ports:[31000-32000]").get()));
}
- // Sets up the master flags with two roles and a short allocation interval.
+ // Returns master flags configured with a short allocation interval.
virtual master::Flags CreateMasterFlags()
{
master::Flags flags = MesosTest::CreateMasterFlags();
flags.allocation_interval = Milliseconds(50);
- flags.roles = strings::join(",", ROLE1, ROLE2);
return flags;
}
@@ -152,7 +151,6 @@ protected:
// while irrelevant fields are not present.
// TODO(alexr): Tests to implement:
-// * Implicit roles are used in the master.
// * Role is absent.
// * Role is an empty string.
// * Role is '*'?
@@ -162,11 +160,15 @@ protected:
// using an explicitly configured list of role names.
TEST_F(MasterQuotaTest, SetForNonExistentRole)
{
- Try<Owned<cluster::Master>> master = StartMaster();
+ master::Flags masterFlags = CreateMasterFlags();
+ masterFlags.roles = strings::join(",", ROLE1, ROLE2);
+
+ Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
- // We do not need an agent since a request should be rejected before we
- // start looking at available resources.
+ // Use the force flag for setting quota that cannot be satisfied in
+ // this empty cluster without any agents.
+ const bool FORCE = true;
Resources quotaResources = Resources::parse("cpus:1;mem:512").get();
@@ -175,7 +177,7 @@ TEST_F(MasterQuotaTest, SetForNonExistentRole)
master.get()->pid,
"quota",
createBasicAuthHeaders(DEFAULT_CREDENTIAL),
- createRequestBody("non-existent-role", quotaResources));
+ createRequestBody("non-existent-role", quotaResources, FORCE));
AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response)
<< response.get().body;