MAPREDUCE-6801. Fix flaky TestKill.testKillJob (Haibo Chen via Varun Saxena)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7584fbf4 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7584fbf4 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7584fbf4 Branch: refs/heads/HADOOP-13345 Commit: 7584fbf4cbafd34fac4b362cefe4e06cec16a2af Parents: f6ffa11 Author: Varun Saxena <varunsax...@apache.org> Authored: Sat Nov 19 01:37:59 2016 +0530 Committer: Varun Saxena <varunsax...@apache.org> Committed: Sat Nov 19 01:37:59 2016 +0530 ---------------------------------------------------------------------- .../java/org/apache/hadoop/mapreduce/v2/app/TestKill.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/7584fbf4/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java index aae591e..0714647 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.Map; import java.util.concurrent.CountDownLatch; +import org.apache.hadoop.service.Service; import org.junit.Assert; import org.apache.hadoop.conf.Configuration; @@ -66,8 +67,8 @@ public class TestKill { Job job = app.submit(new Configuration()); //wait and vailidate for Job to become RUNNING - app.waitForState(job, JobState.RUNNING); - + app.waitForInternalState((JobImpl) job, JobStateInternal.RUNNING); + //send the kill signal to Job app.getContext().getEventHandler().handle( new JobEvent(job.getID(), JobEventType.JOB_KILL)); @@ -77,6 +78,10 @@ public class TestKill { //wait and validate for Job to be KILLED app.waitForState(job, JobState.KILLED); + // make sure all events are processed. The AM is stopped + // only when all tasks and task attempts have been killed + app.waitForState(Service.STATE.STOPPED); + Map<TaskId,Task> tasks = job.getTasks(); Assert.assertEquals("No of tasks is not correct", 1, tasks.size()); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org