Author: vinodkv
Date: Wed Apr 23 00:02:46 2014
New Revision: 1589316

URL: http://svn.apache.org/r1589316
Log:
MAPREDUCE-5832. Fixed TestJobClient to not fail on JDK7 or on Windows. 
Contributed by Jian He and Vinod Kumar Vavilapalli.
svn merge --ignore-ancestry -c 1589315 ../../trunk/

Modified:
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
    
hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapred/TestJobClient.java

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt?rev=1589316&r1=1589315&r2=1589316&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt 
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt Wed 
Apr 23 00:02:46 2014
@@ -82,6 +82,9 @@ Release 2.4.1 - UNRELEASED
     MAPREDUCE-5833. TestRMContainerAllocator fails ocassionally.
     (Zhijie Shen via cnauroth)
 
+    MAPREDUCE-5832. Fixed TestJobClient to not fail on JDK7 or on Windows. 
(Jian
+    He and Vinod Kumar Vavilapalli via vinodkv)
+
 Release 2.4.0 - 2014-04-07 
 
   INCOMPATIBLE CHANGES

Modified: 
hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapred/TestJobClient.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapred/TestJobClient.java?rev=1589316&r1=1589315&r2=1589316&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapred/TestJobClient.java
 (original)
+++ 
hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapred/TestJobClient.java
 Wed Apr 23 00:02:46 2014
@@ -23,16 +23,24 @@ import java.util.Collection;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.mapred.ClusterStatus.BlackListInfo;
 import org.apache.hadoop.mapreduce.MRConfig;
 import org.apache.hadoop.mapreduce.server.jobtracker.JTConfig;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
 
 public class TestJobClient {
-  final static String TEST_DIR = new File(System.getProperty("test.build.data",
-      "/tmp")).getAbsolutePath();
+
+  final static String TEST_DIR = new File("target",
+    TestJobClient.class.getSimpleName()).getAbsolutePath();
+
+  @After
+  public void tearDown() {
+    FileUtil.fullyDelete(new File(TEST_DIR));
+  }
 
   @Test
   public void testGetClusterStatusWithLocalJobRunner() throws Exception {
@@ -51,11 +59,12 @@ public class TestJobClient {
     Assert.assertEquals(0, blackListedTrackersInfo.size());
   }
 
-  @Test(timeout = 1000)
+  @Test(timeout = 10000)
   public void testIsJobDirValid() throws IOException {
     Configuration conf = new Configuration();
     FileSystem fs = FileSystem.getLocal(conf);
     Path testDir = new Path(TEST_DIR);
+    fs.mkdirs(testDir);
     Assert.assertFalse(JobClient.isJobDirValid(testDir, fs));
 
     Path jobconf = new Path(testDir, "job.xml");
@@ -68,7 +77,7 @@ public class TestJobClient {
     fs.delete(jobsplit, true);
   }
   
-  @Test(timeout = 1000)
+  @Test(timeout = 10000)
   public void testGetStagingAreaDir() throws IOException, InterruptedException 
{
     Configuration conf = new Configuration();
     JobClient client = new JobClient(conf);


Reply via email to