浏览代码

MAPREDUCE-5073. TestJobStatusPersistency.testPersistency fails on JDK7. (sandyr via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1457093 13f79535-47bb-0310-9956-ffa450edef68
Alejandro Abdelnur 12 年之前
父节点
当前提交
3a116cd236
共有 2 个文件被更改,包括 12 次插入10 次删除
  1. 3 0
      CHANGES.txt
  2. 9 10
      src/test/org/apache/hadoop/mapred/TestJobStatusPersistency.java

+ 3 - 0
CHANGES.txt

@@ -19,6 +19,9 @@ Release 1.3.0 - unreleased
     MAPREDUCE-5072. TestDelegationTokenRenewal.testDTRenewal fails in MR1 
     on jdk7. (sandyr via tucu)
 
+    MAPREDUCE-5073. TestJobStatusPersistency.testPersistency fails on 
+    JDK7. (sandyr via tucu)
+
 Release 1.2.0 - unreleased
 
   INCOMPATIBLE CHANGES

+ 9 - 10
src/test/org/apache/hadoop/mapred/TestJobStatusPersistency.java

@@ -38,6 +38,13 @@ public class TestJobStatusPersistency extends ClusterMapReduceTestCase {
   protected void setUp() throws Exception {
     // Don't start anything by default
   }
+  
+  @Override
+  protected void tearDown() throws Exception {
+    super.tearDown();
+    FileSystem fs = FileSystem.getLocal(new JobConf());
+    fs.delete(TEST_DIR, true);
+  }
 
   private JobID runJob() throws Exception {
     OutputStream os = getFileSystem().create(new Path(getInputDir(), "text.txt"));
@@ -87,7 +94,7 @@ public class TestJobStatusPersistency extends ClusterMapReduceTestCase {
     Properties config = new Properties();
     config.setProperty("mapred.job.tracker.persist.jobstatus.active", "true");
     config.setProperty("mapred.job.tracker.persist.jobstatus.hours", "1");
-    startCluster(false, config);
+    startCluster(true, config);
     JobID jobId = runJob();
     JobClient jc = new JobClient(createJobConf());
     RunningJob rj0 = jc.getJob(jobId);
@@ -118,11 +125,8 @@ public class TestJobStatusPersistency extends ClusterMapReduceTestCase {
   /**
    * Test if the completed job status is persisted to localfs.
    */
-  public void testLocalPersistency() throws Exception {
+  public void testLocalPersistency() throws Exception {    
     FileSystem fs = FileSystem.getLocal(new JobConf());
-    
-    fs.delete(TEST_DIR, true);
-    
     Properties config = new Properties();
     config.setProperty("mapred.job.tracker.persist.jobstatus.active", "true");
     config.setProperty("mapred.job.tracker.persist.jobstatus.hours", "1");
@@ -137,7 +141,6 @@ public class TestJobStatusPersistency extends ClusterMapReduceTestCase {
     // check if the local fs has the data
     Path jobInfo = new Path(TEST_DIR, rj.getID() + ".info");
     assertTrue("Missing job info from the local fs", fs.exists(jobInfo));
-    fs.delete(TEST_DIR, true);
   }
 
   /**
@@ -152,10 +155,6 @@ public class TestJobStatusPersistency extends ClusterMapReduceTestCase {
     try {
       FileSystem fs = FileSystem.getLocal(new JobConf());
 
-      if (fs.exists(TEST_DIR) && !fs.delete(TEST_DIR, true)) {
-        fail("Cannot delete TEST_DIR!");
-      }
-
       if (fs.mkdirs(new Path(TEST_DIR, parent))) {
         if (!(new File(parent.toUri().getPath()).setWritable(false, false))) {
           fail("Cannot chmod parent!");