MAPREDUCE-5155. Race condition in test case TestFetchFailure cause it to fail (Contributed by Haibo Chen via Daniel Templeton)
This commit is contained in:
parent
e769957556
commit
95c2c24cd0
@ -24,6 +24,7 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.mapred.TaskCompletionEvent;
|
import org.apache.hadoop.mapred.TaskCompletionEvent;
|
||||||
import org.apache.hadoop.mapreduce.Counters;
|
import org.apache.hadoop.mapreduce.Counters;
|
||||||
@ -45,6 +46,7 @@
|
|||||||
import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptEvent;
|
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.TaskAttemptEventType;
|
||||||
import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptStatusUpdateEvent;
|
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.apache.hadoop.yarn.event.EventHandler;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -79,8 +81,19 @@ public void testFetchFailure() throws Exception {
|
|||||||
|
|
||||||
// wait for map success
|
// wait for map success
|
||||||
app.waitForState(mapTask, TaskState.SUCCEEDED);
|
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);
|
job.getTaskAttemptCompletionEvents(0, 100);
|
||||||
Assert.assertEquals("Num completion events not correct",
|
Assert.assertEquals("Num completion events not correct",
|
||||||
1, events.length);
|
1, events.length);
|
||||||
|
Loading…
Reference in New Issue
Block a user