hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r805652 - in /hadoop/hdfs/trunk: CHANGES.txt src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol.java
Date Wed, 19 Aug 2009 03:42:08 GMT
Author: szetszwo
Date: Wed Aug 19 03:42:07 2009
New Revision: 805652

URL: http://svn.apache.org/viewvc?rev=805652&view=rev
Log:
HDFS-552. Change TestFiDataTransferProtocol to junit 4 and add a few new tests.

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=805652&r1=805651&r2=805652&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Wed Aug 19 03:42:07 2009
@@ -87,8 +87,7 @@
     HDFS-530. Refactor TestFileAppend* to remove code duplication.
     (Konstantin Boudnik via szetszwo)
 
-    HDFS-451. Add fault injection tests, Pipeline_Fi_06,07,14,15, for
-    DataTransferProtocol.  (szetszwo)
+    HDFS-451. Add fault injection tests for DataTransferProtocol.  (szetszwo)
 
     HDFS-409. Add more access token tests.  (Kan Zhang via szetszwo)
 
@@ -102,6 +101,9 @@
     HDFS-539. Refactor fault injeciton pipeline test util for future reuse.
     (Konstantin Boudnik via szetszwo)
 
+    HDFS-552. Change TestFiDataTransferProtocol to junit 4 and add a few new
+    tests.  (szetszwo)
+
   BUG FIXES
 
     HDFS-76. Better error message to users when commands fail because of 

Modified: hadoop/hdfs/trunk/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol.java?rev=805652&r1=805651&r2=805652&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol.java
(original)
+++ hadoop/hdfs/trunk/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol.java
Wed Aug 19 03:42:07 2009
@@ -24,6 +24,7 @@
 import org.apache.hadoop.fi.FiTestUtil;
 import org.apache.hadoop.fi.DataTransferTestUtil.DataTransferTest;
 import org.apache.hadoop.fi.DataTransferTestUtil.DoosAction;
+import org.apache.hadoop.fi.DataTransferTestUtil.OomAction;
 import org.apache.hadoop.fi.DataTransferTestUtil.SleepAction;
 import org.apache.hadoop.fi.FiTestUtil.Action;
 import org.apache.hadoop.fs.FSDataInputStream;
@@ -32,9 +33,11 @@
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.protocol.DatanodeID;
+import org.junit.Assert;
+import org.junit.Test;
 
 /** Test DataTransferProtocol with fault injection. */
-public class TestFiDataTransferProtocol extends junit.framework.TestCase {
+public class TestFiDataTransferProtocol {
   static final short REPLICATION = 3;
   static final long BLOCKSIZE = 1L * (1L << 20);
 
@@ -70,7 +73,7 @@
       final FSDataInputStream in = dfs.open(p);
       final int b = in.read();
       in.close();
-      assertEquals(1, b);
+      Assert.assertEquals(1, b);
     }
     finally {
       cluster.shutdown();
@@ -91,7 +94,8 @@
    * Pipeline setup with DN0 very slow but it won't lead to timeout.
    * Client finishes setup successfully.
    */
-  public void testPipelineFi06() throws IOException {
+  @Test
+  public void pipeline_Fi_06() throws IOException {
     final String methodName = FiTestUtil.getMethodName();
     runSlowDatanodeTest(methodName, new SleepAction(methodName, 0, 3000));
   }
@@ -100,11 +104,22 @@
    * Pipeline setup with DN1 very slow but it won't lead to timeout.
    * Client finishes setup successfully.
    */
-  public void testPipelineFi07() throws IOException {
+  @Test
+  public void pipeline_Fi_07() throws IOException {
     final String methodName = FiTestUtil.getMethodName();
     runSlowDatanodeTest(methodName, new SleepAction(methodName, 1, 3000));
   }
 
+  /**
+   * Pipeline setup with DN2 very slow but it won't lead to timeout.
+   * Client finishes setup successfully.
+   */
+  @Test
+  public void pipeline_Fi_08() throws IOException {
+    final String methodName = FiTestUtil.getMethodName();
+    runSlowDatanodeTest(methodName, new SleepAction(methodName, 2, 3000));
+  }
+
   private static void runCallReceivePacketTest(String methodName,
       Action<DatanodeID> a) throws IOException {
     FiTestUtil.LOG.info("Running " + methodName + " ...");
@@ -112,12 +127,31 @@
     write1byte(methodName);
   }
 
+  private static void runStatusReadTest(String methodName, Action<DatanodeID> a
+      ) throws IOException {
+    FiTestUtil.LOG.info("Running " + methodName + " ...");
+    ((DataTransferTest)DataTransferTestUtil.initTest()).fiStatusRead.set(a);
+    write1byte(methodName);
+  }
+
+  /**
+   * Pipeline setup, DN1 throws an OutOfMemoryException right after it
+   * received a setup ack from DN2.
+   * Client gets an IOException and determine DN1 bad.
+   */
+  @Test
+  public void pipeline_Fi_12() throws IOException {
+    final String methodName = FiTestUtil.getMethodName();
+    runStatusReadTest(methodName, new OomAction(methodName, 1));
+  }
+
   /**
    * Streaming: Write a packet, DN0 throws a DiskOutOfSpaceError
    * when it writes the data to disk.
    * Client gets an IOException and determine DN0 bad.
    */
-  public void testPipelineFi14() throws IOException {
+  @Test
+  public void pipeline_Fi_14() throws IOException {
     final String methodName = FiTestUtil.getMethodName();
     runCallReceivePacketTest(methodName, new DoosAction(methodName, 0));
   }
@@ -127,8 +161,20 @@
    * when it writes the data to disk.
    * Client gets an IOException and determine DN1 bad.
    */
-  public void testPipelineFi15() throws IOException {
+  @Test
+  public void pipeline_Fi_15() throws IOException {
     final String methodName = FiTestUtil.getMethodName();
     runCallReceivePacketTest(methodName, new DoosAction(methodName, 1));
   }
+
+  /**
+   * Streaming: Write a packet, DN2 throws a DiskOutOfSpaceError
+   * when it writes the data to disk.
+   * Client gets an IOException and determine DN2 bad.
+   */
+  @Test
+  public void pipeline_Fi_16() throws IOException {
+    final String methodName = FiTestUtil.getMethodName();
+    runCallReceivePacketTest(methodName, new DoosAction(methodName, 2));
+  }
 }
\ No newline at end of file



Mime
View raw message