From bc4ce6c0181891190d7f49cd859c28805319f87a Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Wed, 14 Mar 2018 15:05:24 -0500 Subject: [PATCH] MAPREDUCE-7064. Flaky test TestTaskAttempt#testReducerCustomResourceTypes. Contributed by Peter Bacsko (cherry picked from commit 2626ec35e997c06cda975fbfb2b95da740270059) --- .../v2/app/job/impl/TestTaskAttempt.java | 132 +++++++++++------- 1 file changed, 79 insertions(+), 53 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java index 43571a9b824..609923f6a14 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java @@ -187,77 +187,103 @@ public class TestTaskAttempt{ @Test public void testMRAppHistoryForMap() throws Exception { - MRApp app = new FailingAttemptsMRApp(1, 0); - testMRAppHistory(app); + MRApp app = null; + try { + app = new FailingAttemptsMRApp(1, 0); + testMRAppHistory(app); + } finally { + app.close(); + } } @Test public void testMRAppHistoryForReduce() throws Exception { - MRApp app = new FailingAttemptsMRApp(0, 1); - testMRAppHistory(app); + MRApp app = null; + try { + app = new FailingAttemptsMRApp(0, 1); + testMRAppHistory(app); + } finally { + app.close(); + } } @Test public void testMRAppHistoryForTAFailedInAssigned() throws Exception { // test TA_CONTAINER_LAUNCH_FAILED for map - FailingAttemptsDuringAssignedMRApp app = - new FailingAttemptsDuringAssignedMRApp(1, 0, - TaskAttemptEventType.TA_CONTAINER_LAUNCH_FAILED); - testTaskAttemptAssignedFailHistory(app); + FailingAttemptsDuringAssignedMRApp app = null; - // test TA_CONTAINER_LAUNCH_FAILED for reduce - app = - new FailingAttemptsDuringAssignedMRApp(0, 1, - TaskAttemptEventType.TA_CONTAINER_LAUNCH_FAILED); - testTaskAttemptAssignedFailHistory(app); + try { + app = + new FailingAttemptsDuringAssignedMRApp(1, 0, + TaskAttemptEventType.TA_CONTAINER_LAUNCH_FAILED); + testTaskAttemptAssignedFailHistory(app); + app.close(); - // test TA_CONTAINER_COMPLETED for map - app = - new FailingAttemptsDuringAssignedMRApp(1, 0, - TaskAttemptEventType.TA_CONTAINER_COMPLETED); - testTaskAttemptAssignedFailHistory(app); + // test TA_CONTAINER_LAUNCH_FAILED for reduce + app = + new FailingAttemptsDuringAssignedMRApp(0, 1, + TaskAttemptEventType.TA_CONTAINER_LAUNCH_FAILED); + testTaskAttemptAssignedFailHistory(app); + app.close(); - // test TA_CONTAINER_COMPLETED for reduce - app = - new FailingAttemptsDuringAssignedMRApp(0, 1, - TaskAttemptEventType.TA_CONTAINER_COMPLETED); - testTaskAttemptAssignedFailHistory(app); + // test TA_CONTAINER_COMPLETED for map + app = + new FailingAttemptsDuringAssignedMRApp(1, 0, + TaskAttemptEventType.TA_CONTAINER_COMPLETED); + testTaskAttemptAssignedFailHistory(app); + app.close(); - // test TA_FAILMSG for map - app = - new FailingAttemptsDuringAssignedMRApp(1, 0, - TaskAttemptEventType.TA_FAILMSG); - testTaskAttemptAssignedFailHistory(app); + // test TA_CONTAINER_COMPLETED for reduce + app = + new FailingAttemptsDuringAssignedMRApp(0, 1, + TaskAttemptEventType.TA_CONTAINER_COMPLETED); + testTaskAttemptAssignedFailHistory(app); + app.close(); - // test TA_FAILMSG for reduce - app = - new FailingAttemptsDuringAssignedMRApp(0, 1, - TaskAttemptEventType.TA_FAILMSG); - testTaskAttemptAssignedFailHistory(app); + // test TA_FAILMSG for map + app = + new FailingAttemptsDuringAssignedMRApp(1, 0, + TaskAttemptEventType.TA_FAILMSG); + testTaskAttemptAssignedFailHistory(app); + app.close(); - // test TA_FAILMSG_BY_CLIENT for map - app = - new FailingAttemptsDuringAssignedMRApp(1, 0, - TaskAttemptEventType.TA_FAILMSG_BY_CLIENT); - testTaskAttemptAssignedFailHistory(app); + // test TA_FAILMSG for reduce + app = + new FailingAttemptsDuringAssignedMRApp(0, 1, + TaskAttemptEventType.TA_FAILMSG); + testTaskAttemptAssignedFailHistory(app); + app.close(); - // test TA_FAILMSG_BY_CLIENT for reduce - app = - new FailingAttemptsDuringAssignedMRApp(0, 1, - TaskAttemptEventType.TA_FAILMSG_BY_CLIENT); - testTaskAttemptAssignedFailHistory(app); + // test TA_FAILMSG_BY_CLIENT for map + app = + new FailingAttemptsDuringAssignedMRApp(1, 0, + TaskAttemptEventType.TA_FAILMSG_BY_CLIENT); + testTaskAttemptAssignedFailHistory(app); + app.close(); - // test TA_KILL for map - app = - new FailingAttemptsDuringAssignedMRApp(1, 0, - TaskAttemptEventType.TA_KILL); - testTaskAttemptAssignedKilledHistory(app); + // test TA_FAILMSG_BY_CLIENT for reduce + app = + new FailingAttemptsDuringAssignedMRApp(0, 1, + TaskAttemptEventType.TA_FAILMSG_BY_CLIENT); + testTaskAttemptAssignedFailHistory(app); + app.close(); - // test TA_KILL for reduce - app = - new FailingAttemptsDuringAssignedMRApp(0, 1, - TaskAttemptEventType.TA_KILL); - testTaskAttemptAssignedKilledHistory(app); + // test TA_KILL for map + app = + new FailingAttemptsDuringAssignedMRApp(1, 0, + TaskAttemptEventType.TA_KILL); + testTaskAttemptAssignedKilledHistory(app); + app.close(); + + // test TA_KILL for reduce + app = + new FailingAttemptsDuringAssignedMRApp(0, 1, + TaskAttemptEventType.TA_KILL); + testTaskAttemptAssignedKilledHistory(app); + app.close(); + } finally { + app.close(); + } } @Test