Repository: mesos Updated Branches: refs/heads/master 061632cb5 -> 6c628d4a3
Fixed the flaky test case `AgentAPITest.GetState`. This test case is flaky because we didn't wait for the agent receives and properly handles the ACK of `TASK_KILLED`. Then the agent may have not yet marked the task completed when we perform the query. Review: https://reviews.apache.org/r/50016/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6c628d4a Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6c628d4a Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6c628d4a Branch: refs/heads/master Commit: 6c628d4a38663001324d7f5a8878fbb06541a2a9 Parents: 061632c Author: haosdent huang <[email protected]> Authored: Mon Jul 18 17:58:53 2016 -0700 Committer: Vinod Kone <[email protected]> Committed: Mon Jul 18 17:58:53 2016 -0700 ---------------------------------------------------------------------- src/tests/api_tests.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/6c628d4a/src/tests/api_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp index 37bf286..b4bee76 100644 --- a/src/tests/api_tests.cpp +++ b/src/tests/api_tests.cpp @@ -3091,16 +3091,26 @@ TEST_P(AgentAPITest, GetState) ASSERT_EQ(0u, getState.get_executors().completed_executors_size()); } + Clock::pause(); + // Kill the task. Future<TaskStatus> statusKilled; EXPECT_CALL(sched, statusUpdate(&driver, _)) .WillOnce(FutureArg<1>(&statusKilled)); + Future<Nothing> _statusUpdateAcknowledgement = + FUTURE_DISPATCH(slave.get()->pid, &Slave::_statusUpdateAcknowledgement); + driver.killTask(statusRunning->task_id()); AWAIT_READY(statusKilled); EXPECT_EQ(TASK_KILLED, statusKilled->state()); + // Make sure the agent receives and properly handles the ACK of `TASK_KILLED`. + AWAIT_READY(_statusUpdateAcknowledgement); + Clock::settle(); + Clock::resume(); + // Make sure the executor terminated. Future<Nothing> executorTerminated = FUTURE_DISPATCH(_, &Slave::executorTerminated);
