فهرست منبع

HADOOP-4403. Make TestLeaseRecovery and TestFileCreation more robust. (szetszwo)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19@704601 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze 17 سال پیش
والد
کامیت
efe90c7d4c
3فایلهای تغییر یافته به همراه6 افزوده شده و 14 حذف شده
  1. 3 0
      CHANGES.txt
  2. 2 14
      src/test/org/apache/hadoop/hdfs/TestFileCreation.java
  3. 1 0
      src/test/org/apache/hadoop/hdfs/TestLeaseRecovery.java

+ 3 - 0
CHANGES.txt

@@ -851,6 +851,9 @@ Release 0.19.0 - Unreleased
     HADOOP-4400. Add "hdfs://" to fs.default.name on quickstart.html.
     (Jeff Hammerbacher via omalley)
 
+    HADOOP-4403. Make TestLeaseRecovery and TestFileCreation more robust.
+    (szetszwo)
+
 Release 0.18.2 - Unreleased
 
   BUG FIXES

+ 2 - 14
src/test/org/apache/hadoop/hdfs/TestFileCreation.java

@@ -226,7 +226,6 @@ public class TestFileCreation extends junit.framework.TestCase {
         assertEquals(SimulatedFSDataset.DEFAULT_CAPACITY-fileSize, dn.getFSDataset().getRemaining());
       }
     } finally {
-      fs.close();
       cluster.shutdown();
     }
   }
@@ -359,7 +358,6 @@ public class TestFileCreation extends junit.framework.TestCase {
       assertTrue("Error blocks were not cleaned up",
                  locations.locatedBlockCount() == 0);
     } finally {
-      fs.close();
       cluster.shutdown();
       client.close();
     }
@@ -595,20 +593,10 @@ public class TestFileCreation extends junit.framework.TestCase {
       // This should close all existing file.
       dfsclient.close();
 
-      try {
-        fs.close();
-        fs = null;
-      } catch (IOException e) {
-      }
-
       // reopen file system and verify that file exists.
-      fs = cluster.getFileSystem();
-      assertTrue(file1 + " does not exist.", fs.exists(file1));
-
+      assertTrue(file1 + " does not exist.", 
+          AppendTestUtil.createHdfsWithDifferentUsername(conf).exists(file1));
     } finally {
-      if (fs != null) {
-        fs.close();
-      }
       cluster.shutdown();
     }
   }

+ 1 - 0
src/test/org/apache/hadoop/hdfs/TestLeaseRecovery.java

@@ -70,6 +70,7 @@ public class TestLeaseRecovery extends junit.framework.TestCase {
       Path filepath = new Path(filestr);
       DFSTestUtil.createFile(dfs, filepath, ORG_FILE_SIZE, REPLICATION_NUM, 0L);
       assertTrue(dfs.dfs.exists(filestr));
+      DFSTestUtil.waitReplication(dfs, filepath, REPLICATION_NUM);
 
       //get block info for the last block
       LocatedBlock locatedblock = TestInterDatanodeProtocol.getLastLocatedBlock(