Removed redundant test. `MasterAuthorizationTest.SlaveDisconnectedLost` was identical to `MasterAuthorizationTest.SlaveRemovedLost`.
Review: https://reviews.apache.org/r/52969/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5082181a Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5082181a Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5082181a Branch: refs/heads/master Commit: 5082181aebf3798484e52792b1fc9a6ff6a4416c Parents: 4eac0b0 Author: Neil Conway <neil.con...@gmail.com> Authored: Wed Oct 19 16:32:10 2016 -0700 Committer: Vinod Kone <vinodk...@gmail.com> Committed: Wed Oct 19 16:32:10 2016 -0700 ---------------------------------------------------------------------- src/tests/master_authorization_tests.cpp | 104 -------------------------- 1 file changed, 104 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/5082181a/src/tests/master_authorization_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/master_authorization_tests.cpp b/src/tests/master_authorization_tests.cpp index 001d4b3..4712361 100644 --- a/src/tests/master_authorization_tests.cpp +++ b/src/tests/master_authorization_tests.cpp @@ -775,110 +775,6 @@ TEST_F(MasterAuthorizationTest, SlaveRemovedDropped) } -// This test verifies that a slave disconnection that comes before -// '_launchTasks()' is called results in TASK_LOST for a framework -// that is not partition-aware. -TEST_F(MasterAuthorizationTest, SlaveDisconnectedLost) -{ - MockAuthorizer authorizer; - Try<Owned<cluster::Master>> master = StartMaster(&authorizer); - ASSERT_SOME(master); - - MockExecutor exec(DEFAULT_EXECUTOR_ID); - TestContainerizer containerizer(&exec); - - Owned<MasterDetector> detector = master.get()->createDetector(); - Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), &containerizer); - ASSERT_SOME(slave); - - MockScheduler sched; - MesosSchedulerDriver driver( - &sched, DEFAULT_FRAMEWORK_INFO, master.get()->pid, DEFAULT_CREDENTIAL); - - EXPECT_CALL(sched, registered(&driver, _, _)) - .Times(1); - - Future<vector<Offer>> offers; - EXPECT_CALL(sched, resourceOffers(&driver, _)) - .WillOnce(FutureArg<1>(&offers)) - .WillRepeatedly(Return()); // Ignore subsequent offers. - - driver.start(); - - AWAIT_READY(offers); - EXPECT_NE(0u, offers.get().size()); - - TaskInfo task = createTask(offers.get()[0], "", DEFAULT_EXECUTOR_ID); - - // Return a pending future from authorizer. - Future<Nothing> authorize; - Promise<bool> promise; - EXPECT_CALL(authorizer, authorized(_)) - .WillOnce(DoAll(FutureSatisfy(&authorize), - Return(promise.future()))); - - driver.launchTasks(offers.get()[0].id(), {task}); - - // Wait until authorization is in progress. - AWAIT_READY(authorize); - - Future<Nothing> slaveLost; - EXPECT_CALL(sched, slaveLost(&driver, _)) - .WillOnce(FutureSatisfy(&slaveLost)); - - // Stop the slave with explicit shutdown message so that the master - // does not wait for it to reconnect. - slave.get()->shutdown(); - slave->reset(); - - // Wait for the slave to be removed by the master. - AWAIT_READY(slaveLost); - - Future<TaskStatus> status; - EXPECT_CALL(sched, statusUpdate(&driver, _)) - .WillOnce(FutureArg<1>(&status)); - - Future<Nothing> recoverResources = - FUTURE_DISPATCH(_, &MesosAllocatorProcess::recoverResources); - - // Now complete authorization. - promise.set(true); - - // Framework should get a TASK_LOST. - AWAIT_READY(status); - - EXPECT_EQ(TASK_LOST, status.get().state()); - EXPECT_EQ(TaskStatus::SOURCE_MASTER, status.get().source()); - EXPECT_EQ(TaskStatus::REASON_SLAVE_REMOVED, status.get().reason()); - - // No task launch should happen resulting in all resources being - // returned to the allocator. - AWAIT_READY(recoverResources); - - // Check metrics. - JSON::Object stats = Metrics(); - EXPECT_EQ(0u, stats.values["master/tasks_dropped"]); - EXPECT_EQ(1u, stats.values["master/tasks_lost"]); - EXPECT_EQ( - 1u, - stats.values["master/task_lost/source_master/reason_slave_removed"]); - - // Make sure the task is not known to master anymore. - EXPECT_CALL(sched, statusUpdate(&driver, _)) - .Times(0); - - driver.reconcileTasks({}); - - // We settle the clock here to ensure any updates sent by the master - // are received. There shouldn't be any updates in this case. - Clock::pause(); - Clock::settle(); - - driver.stop(); - driver.join(); -} - - // This test verifies that a framework removal that comes before // '_accept()' is called results in recovery of resources. TEST_F(MasterAuthorizationTest, FrameworkRemoved)