浏览代码

HDFS-682. Fix bugs in TestBlockUnderConstruction.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hdfs/trunk@825218 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze 15 年之前
父节点
当前提交
e514d8a589
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 2 0
      CHANGES.txt
  2. 6 5
      src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestBlockUnderConstruction.java

+ 2 - 0
CHANGES.txt

@@ -402,6 +402,8 @@ Release 0.21.0 - Unreleased
     HDFS-673. BlockReceiver#PacketResponder should not remove a packet from
     the ack queue before its ack is sent. (hairong)
 
+    HDFS-682. Fix bugs in TestBlockUnderConstruction.  (szetszwo)
+
 Release 0.20.2 - Unreleased
 
   BUG FIXES

+ 6 - 5
src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestBlockUnderConstruction.java

@@ -115,12 +115,13 @@ public class TestBlockUnderConstruction {
           ns.blockManager.getStoredBlock(curBlock) == curBlock);
     }
 
-    // the last block is under construction if the file is not closed
+    // The last block is complete if the file is closed.
+    // If the file is open, the last block may be complete or not. 
     curBlock = blocks[idx]; // last block
-    assertEquals("Block " + curBlock +
-        " isComplete = " + curBlock.isComplete() +
-        " expected to be " + isFileOpen,
-        isFileOpen, !curBlock.isComplete());
+    if (!isFileOpen) {
+      assertTrue("Block " + curBlock + ", isFileOpen = " + isFileOpen,
+          curBlock.isComplete());
+    }
     assertTrue("Block is not in BlocksMap: " + curBlock,
         ns.blockManager.getStoredBlock(curBlock) == curBlock);
   }