Explorar o código

Merge -r743418:743419 from trunk to branch-0.20. Fixes HADOOP-5211.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.20@743423 13f79535-47bb-0310-9956-ffa450edef68
Enis Soztutar %!s(int64=16) %!d(string=hai) anos
pai
achega
f875cccd0b

+ 3 - 0
CHANGES.txt

@@ -598,6 +598,9 @@ Release 0.20.0 - Unreleased
     killed tasks by launching special CLEANUP tasks for the same. 
     (Amareshwari Sriramadasu via ddas)
 
+    HADOOP-5211. Fix check for job completion in TestSetupAndCleanupFailure.
+    (enis)
+
 Release 0.19.1 - Unreleased
 
   IMPROVEMENTS

+ 8 - 6
src/test/org/apache/hadoop/mapred/TestSetupAndCleanupFailure.java

@@ -23,21 +23,23 @@ import java.io.IOException;
 import junit.framework.TestCase;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.mapred.lib.IdentityMapper;
 import org.apache.hadoop.mapred.lib.IdentityReducer;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
 
 public class TestSetupAndCleanupFailure extends TestCase {
 
   static class CommitterWithFailSetup extends FileOutputCommitter {
+    @Override
     public void setupJob(JobContext context) throws IOException {
       throw new IOException();
     }
   }
 
   static class CommitterWithFailCleanup extends FileOutputCommitter {
+    @Override
     public void cleanupJob(JobContext context) throws IOException {
       throw new IOException();
     }
@@ -80,10 +82,10 @@ public class TestSetupAndCleanupFailure extends TestCase {
     MiniMRCluster mr = null;
     FileSystem fileSys = null;
     try {
-      final int taskTrackers = 4;
+      final int taskTrackers = 2;
 
       Configuration conf = new Configuration();
-      dfs = new MiniDFSCluster(conf, 4, true, null);
+      dfs = new MiniDFSCluster(conf, 2, true, null);
       fileSys = dfs.getFileSystem();
       mr = new MiniMRCluster(taskTrackers, fileSys.getUri().toString(), 1);
       JobConf jobConf = mr.createJobConf();
@@ -95,13 +97,13 @@ public class TestSetupAndCleanupFailure extends TestCase {
       jobConf.setOutputCommitter(CommitterWithFailSetup.class);
       job = launchJob(jobConf, inDir, outDir, input);
       // wait for the job to finish.
-      while (!job.isComplete()) ;
+      job.waitForCompletion();
       assertEquals(JobStatus.FAILED, job.getJobState());
 
       jobConf.setOutputCommitter(CommitterWithFailCleanup.class);
       job = launchJob(jobConf, inDir, outDir, input);
       // wait for the job to finish.
-      while (!job.isComplete()) ;
+      job.waitForCompletion();
       assertEquals(JobStatus.FAILED, job.getJobState());
     } finally {
       if (dfs != null) { dfs.shutdown(); }