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 2015/12/10 12:22:36 UTC
[1/2] mesos git commit: Modified
`ReservationTest.ACLMultipleOperations` to better capture the intended
testing scnearios.
Repository: mesos
Updated Branches:
refs/heads/master 07725b5f0 -> 9ab2e6f60
Modified `ReservationTest.ACLMultipleOperations` to better capture
the intended testing scnearios.
Review: https://reviews.apache.org/r/41001
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6007a1ac
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6007a1ac
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6007a1ac
Branch: refs/heads/master
Commit: 6007a1ac756b3d82744272ad5be738d2cdd68005
Parents: 07725b5
Author: Greg Mann <gr...@mesosphere.io>
Authored: Thu Dec 10 05:50:07 2015 -0500
Committer: Michael Park <mp...@apache.org>
Committed: Thu Dec 10 06:12:56 2015 -0500
----------------------------------------------------------------------
src/tests/reservation_tests.cpp | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6007a1ac/src/tests/reservation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_tests.cpp b/src/tests/reservation_tests.cpp
index 3405b47..54a1b23 100644
--- a/src/tests/reservation_tests.cpp
+++ b/src/tests/reservation_tests.cpp
@@ -1545,10 +1545,10 @@ TEST_F(ReservationTest, ACLMultipleOperations)
reserve->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
reserve->mutable_resources()->set_type(mesos::ACL::Entity::ANY);
- // This principal can unreserve any resources.
+ // This principal cannot unreserve any resources.
mesos::ACL::UnreserveResources* unreserve = acls.add_unreserve_resources();
unreserve->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
- unreserve->mutable_reserver_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");
@@ -1641,7 +1641,7 @@ TEST_F(ReservationTest, ACLMultipleOperations)
.WillOnce(FutureArg<1>(&offers));
// Create a task to launch with the resources of `dynamicallyReserved2`.
- TaskInfo taskInfo =
+ TaskInfo taskInfo1 =
createTask(offer.slave_id(), dynamicallyReserved2, "exit 1", exec.id);
EXPECT_CALL(exec, registered(_, _, _, _));
@@ -1654,12 +1654,12 @@ TEST_F(ReservationTest, ACLMultipleOperations)
EXPECT_CALL(sched, statusUpdate(_, _))
.WillOnce(FutureArg<1>(&statusUpdateAcknowledgement));
- // Attempt to unreserve an invalid set of resources (not dynamically
- // reserved), reserve the second set, and launch a task.
+ // Attempt to unreserve a set of resources,
+ // reserve a second set, and launch a task.
driver.acceptOffers({offer.id()},
- {UNRESERVE(unreserved1),
+ {UNRESERVE(dynamicallyReserved1),
RESERVE(dynamicallyReserved2),
- LAUNCH({taskInfo})},
+ LAUNCH({taskInfo1})},
filters);
// Wait for TASK_FINISHED update ack.
@@ -1687,35 +1687,41 @@ TEST_F(ReservationTest, ACLMultipleOperations)
.WillOnce(FutureArg<1>(&offers));
// Create a task to launch with the resources of `dynamicallyReserved1`.
- taskInfo =
+ TaskInfo taskInfo2 =
createTask(offer.slave_id(), dynamicallyReserved1, "exit 1", exec.id);
+ EXPECT_CALL(exec, launchTask(_, _))
+ .WillOnce(SendStatusUpdateFromTask(TASK_FINISHED));
+
Future<TaskStatus> failedTaskStatus;
EXPECT_CALL(sched, statusUpdate(_, _))
.WillOnce(FutureArg<1>(&failedTaskStatus));
- // Unreserve all the dynamically reserved resources and attempt to launch a
- // task on `dynamicallyReserved1`. This attempt should fail.
+ // Attempt to unreserve all the dynamically reserved resources
+ // and launch a task on `dynamicallyReserved1`.
driver.acceptOffers({offer.id()},
{UNRESERVE(dynamicallyReserved1),
UNRESERVE(dynamicallyReserved2),
- LAUNCH({taskInfo})},
+ LAUNCH({taskInfo2})},
filters);
process::Clock::settle();
process::Clock::advance(masterFlags.allocation_interval);
- // In the next offer, expect to find no reserved resources.
+ // In the next offer, expect to find the reserved resources.
AWAIT_READY(offers);
ASSERT_EQ(1u, offers.get().size());
offer = offers.get()[0];
EXPECT_TRUE(
- Resources(offer.resources()).contains(unreserved1 + unreserved1));
+ Resources(offer.resources()).contains(
+ dynamicallyReserved1 +
+ dynamicallyReserved2 +
+ unreserved2));
- // Check that the task failed to launch as expected.
- EXPECT_EQ(TASK_ERROR, failedTaskStatus.get().state());
+ // Check that the task launched as expected.
+ EXPECT_EQ(TASK_FINISHED, failedTaskStatus.get().state());
driver.stop();
driver.join();
[2/2] mesos git commit: Corrected a comment in reservation endpoint
tests.
Posted by mp...@apache.org.
Corrected a comment in reservation endpoint tests.
Review: https://reviews.apache.org/r/41159
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9ab2e6f6
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9ab2e6f6
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9ab2e6f6
Branch: refs/heads/master
Commit: 9ab2e6f60855cd894540471047caba256a857281
Parents: 6007a1a
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Thu Dec 10 06:13:50 2015 -0500
Committer: Michael Park <mp...@apache.org>
Committed: Thu Dec 10 06:13:50 2015 -0500
----------------------------------------------------------------------
src/tests/reservation_endpoints_tests.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/9ab2e6f6/src/tests/reservation_endpoints_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_endpoints_tests.cpp b/src/tests/reservation_endpoints_tests.cpp
index c3833d0..d5d2aa7 100644
--- a/src/tests/reservation_endpoints_tests.cpp
+++ b/src/tests/reservation_endpoints_tests.cpp
@@ -954,8 +954,8 @@ TEST_F(ReservationEndpointsTest, BadUnreserveACL)
TestAllocator<> allocator;
ACLs acls;
- // This ACL asserts that ANY principal can reserve NONE,
- // i.e. no principals can reserve anything.
+ // This ACL asserts that ANY principal can unreserve NONE,
+ // i.e. no principals can unreserve anything.
mesos::ACL::UnreserveResources* unreserve = acls.add_unreserve_resources();
unreserve->mutable_principals()->set_type(mesos::ACL::Entity::ANY);
unreserve->mutable_reserver_principals()->set_type(mesos::ACL::Entity::NONE);