You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2017/10/17 00:44:27 UTC

[08/14] mesos git commit: Cleaned up reservation endpoint tests.

Cleaned up reservation endpoint tests.

Review: https://reviews.apache.org/r/63009


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/67a98ccc
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/67a98ccc
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/67a98ccc

Branch: refs/heads/master
Commit: 67a98ccc2398174a97f2437b158063290d5b8dd8
Parents: 7fa534b
Author: Alexander Rukletsov <al...@apache.org>
Authored: Sat Oct 14 00:25:59 2017 -0700
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Oct 16 17:42:43 2017 -0700

----------------------------------------------------------------------
 src/tests/reservation_endpoints_tests.cpp | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/67a98ccc/src/tests/reservation_endpoints_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_endpoints_tests.cpp b/src/tests/reservation_endpoints_tests.cpp
index 0733dca..e70dd0d 100644
--- a/src/tests/reservation_endpoints_tests.cpp
+++ b/src/tests/reservation_endpoints_tests.cpp
@@ -975,13 +975,9 @@ TEST_F(ReservationEndpointsTest, GoodReserveAndUnreserveACL)
   unreserve->mutable_reserver_principals()->add_values(
       DEFAULT_CREDENTIAL.principal());
 
-  FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
-  frameworkInfo.set_role("role");
-
   // Create a master.
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
-  masterFlags.roles = frameworkInfo.role();
 
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
@@ -1005,7 +1001,7 @@ TEST_F(ReservationEndpointsTest, GoodReserveAndUnreserveACL)
   Resources unreserved = Resources::parse("cpus:1;mem:512").get();
   Resources dynamicallyReserved =
     unreserved.pushReservation(createDynamicReservationInfo(
-        frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+        createFrameworkInfo().role(), DEFAULT_CREDENTIAL.principal()));
 
   // Reserve the resources.
   Future<Response> response = process::http::post(
@@ -1093,13 +1089,9 @@ TEST_F(ReservationEndpointsTest, BadReserveACL)
   reserve->mutable_principals()->set_type(mesos::ACL::Entity::ANY);
   reserve->mutable_roles()->set_type(mesos::ACL::Entity::NONE);
 
-  FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
-  frameworkInfo.set_role("role");
-
   // Create a master.
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
-  masterFlags.roles = frameworkInfo.role();
 
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
@@ -1123,7 +1115,7 @@ TEST_F(ReservationEndpointsTest, BadReserveACL)
   Resources unreserved = Resources::parse("cpus:1;mem:512").get();
   Resources dynamicallyReserved =
     unreserved.pushReservation(createDynamicReservationInfo(
-        frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+        createFrameworkInfo().role(), DEFAULT_CREDENTIAL.principal()));
 
   // Attempt to reserve the resources.
   Future<Response> response = process::http::post(
@@ -1149,13 +1141,9 @@ TEST_F(ReservationEndpointsTest, BadUnreserveACL)
   unreserve->mutable_principals()->set_type(mesos::ACL::Entity::ANY);
   unreserve->mutable_reserver_principals()->set_type(mesos::ACL::Entity::NONE);
 
-  FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
-  frameworkInfo.set_role("role");
-
   // Create a master.
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
-  masterFlags.roles = frameworkInfo.role();
 
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
@@ -1179,7 +1167,7 @@ TEST_F(ReservationEndpointsTest, BadUnreserveACL)
   Resources unreserved = Resources::parse("cpus:1;mem:512").get();
   Resources dynamicallyReserved =
     unreserved.pushReservation(createDynamicReservationInfo(
-        frameworkInfo.role(), DEFAULT_CREDENTIAL.principal()));
+        createFrameworkInfo().role(), DEFAULT_CREDENTIAL.principal()));
 
   // Reserve the resources.
   Future<Response> response = process::http::post(
@@ -1364,8 +1352,7 @@ TEST_F(ReservationEndpointsTest, NonMatchingPrincipal)
 // and no ACLs are set in the master.
 TEST_F(ReservationEndpointsTest, ReserveAndUnreserveNoAuthentication)
 {
-  FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
-  frameworkInfo.set_role("role");
+  FrameworkInfo frameworkInfo = createFrameworkInfo();
 
   // Create a master.
   master::Flags masterFlags = CreateMasterFlags();