Repository: mesos Updated Branches: refs/heads/master 0fcfa5018 -> 5ccf43e5a
Fixed flaky SlaveTest.KillTaskBetweenRunTaskParts test. Moving EXPECT_CALL(removeFramework) before killTask() removes a race, which made the expected call occur before it is expected. Review: https://reviews.apache.org/r/26929 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5ccf43e5 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5ccf43e5 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5ccf43e5 Branch: refs/heads/master Commit: 5ccf43e5ad037e42b7488da80e61504cc721ae37 Parents: 0fcfa50 Author: Bernd Mathiske <[email protected]> Authored: Tue Oct 21 10:04:54 2014 -0700 Committer: Vinod Kone <[email protected]> Committed: Tue Oct 21 10:05:56 2014 -0700 ---------------------------------------------------------------------- src/tests/slave_tests.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/5ccf43e5/src/tests/slave_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp index 0ded545..759670a 100644 --- a/src/tests/slave_tests.cpp +++ b/src/tests/slave_tests.cpp @@ -1039,13 +1039,15 @@ TEST_F(SlaveTest, PingTimeoutSomePings) AWAIT_READY(slaveReregisteredMessage); } + // This test ensures that a killTask() can happen between runTask() // and _runTask() and then gets "handled properly". This means that // the task never gets started, but also does not get lost. The end // result is status TASK_KILLED. Essentially, killing the task is -// realized while preparing to start it. See MESOS-947. -// Temporarily disabled due to MESOS-1945. -TEST_F(SlaveTest, DISABLED_KillTaskBetweenRunTaskParts) +// realized while preparing to start it. See MESOS-947. This test +// removes the framework and proves that removeFramework() is +// called. See MESOS-1945. +TEST_F(SlaveTest, KillTaskBetweenRunTaskParts) { Try<PID<Master> > master = StartMaster(); ASSERT_SOME(master); @@ -1121,20 +1123,21 @@ TEST_F(SlaveTest, DISABLED_KillTaskBetweenRunTaskParts) AWAIT_READY(_runTask); - Future<Nothing> killTask; - EXPECT_CALL(slave, killTask(_, _, _)) - .WillOnce(DoAll(Invoke(&slave, &MockSlave::unmocked_killTask), - FutureSatisfy(&killTask))); - driver.killTask(task.task_id()); - // Since this is the only task ever for this framework, the - // framework should get removed in Slave::_runTask(). + // framework should get removed in Slave::killTask(). // Thus we can observe that this happens before Shutdown(). Future<Nothing> removeFramework; EXPECT_CALL(slave, removeFramework(_)) .WillOnce(DoAll(Invoke(&slave, &MockSlave::unmocked_removeFramework), FutureSatisfy(&removeFramework))); + Future<Nothing> killTask; + EXPECT_CALL(slave, killTask(_, _, _)) + .WillOnce(DoAll(Invoke(&slave, &MockSlave::unmocked_killTask), + FutureSatisfy(&killTask))); + + driver.killTask(task.task_id()); + AWAIT_READY(killTask); slave.unmocked__runTask( future, frameworkInfo, frameworkId, master.get(), task);
