hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vvasu...@apache.org
Subject [33/50] [abbrv] hadoop git commit: MAPREDUCE-5155. Race condition in test case TestFetchFailure cause it to fail (Contributed by Haibo Chen via Daniel Templeton)
Date Wed, 04 Jan 2017 08:04:07 GMT
MAPREDUCE-5155. Race condition in test case TestFetchFailure cause it to fail (Contributed
by Haibo Chen via Daniel Templeton)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/95c2c24c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/95c2c24c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/95c2c24c

Branch: refs/heads/YARN-5673
Commit: 95c2c24cd0007ece9d7cd0fbe4c5932828e639d4
Parents: e769957
Author: Daniel Templeton <templedf@apache.org>
Authored: Thu Dec 29 10:49:29 2016 -0800
Committer: Daniel Templeton <templedf@apache.org>
Committed: Thu Dec 29 10:50:47 2016 -0800

----------------------------------------------------------------------
 .../hadoop/mapreduce/v2/app/TestFetchFailure.java  | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/95c2c24c/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestFetchFailure.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestFetchFailure.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestFetchFailure.java
index 8d25079..cb2a29e 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestFetchFailure.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestFetchFailure.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 
+import com.google.common.base.Supplier;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.mapred.TaskCompletionEvent;
 import org.apache.hadoop.mapreduce.Counters;
@@ -45,6 +46,7 @@ import org.apache.hadoop.mapreduce.v2.app.job.event.JobTaskAttemptFetchFailureEv
 import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptEvent;
 import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptEventType;
 import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptStatusUpdateEvent;
+import org.apache.hadoop.test.GenericTestUtils;
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.junit.Assert;
 import org.junit.Test;
@@ -79,8 +81,19 @@ public class TestFetchFailure {
     
     // wait for map success
     app.waitForState(mapTask, TaskState.SUCCEEDED);
-    
-    TaskAttemptCompletionEvent[] events = 
+
+    final int checkIntervalMillis = 10;
+    final int waitForMillis = 800;
+    GenericTestUtils.waitFor(new Supplier<Boolean>() {
+      @Override
+      public Boolean get() {
+        TaskAttemptCompletionEvent[] events = job
+            .getTaskAttemptCompletionEvents(0, 100);
+        return events.length >= 1;
+      }
+    }, checkIntervalMillis, waitForMillis);
+
+    TaskAttemptCompletionEvent[] events =
       job.getTaskAttemptCompletionEvents(0, 100);
     Assert.assertEquals("Num completion events not correct",
         1, events.length);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message