hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r1182116 [1/2] - in /hadoop/common/branches/branch-0.22/hdfs: CHANGES.txt build.xml src/test/hdfs/org/apache/hadoop/cli/TestHDFSCLI.java src/test/hdfs/org/apache/hadoop/cli/testConfCluster.xml
Date Tue, 11 Oct 2011 22:02:35 GMT
Author: cos
Date: Tue Oct 11 22:02:35 2011
New Revision: 1182116

URL: http://svn.apache.org/viewvc?rev=1182116&view=rev
Log:
HDFS-1762. Allow TestHDFSCLI to be run against a cluster. Contributed by Tom White, Konstantin
Boudnik.

Added:
    hadoop/common/branches/branch-0.22/hdfs/src/test/hdfs/org/apache/hadoop/cli/testConfCluster.xml
Modified:
    hadoop/common/branches/branch-0.22/hdfs/CHANGES.txt
    hadoop/common/branches/branch-0.22/hdfs/build.xml
    hadoop/common/branches/branch-0.22/hdfs/src/test/hdfs/org/apache/hadoop/cli/TestHDFSCLI.java

Modified: hadoop/common/branches/branch-0.22/hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/hdfs/CHANGES.txt?rev=1182116&r1=1182115&r2=1182116&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/hdfs/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.22/hdfs/CHANGES.txt Tue Oct 11 22:02:35 2011
@@ -640,6 +640,8 @@ Release 0.22.0 - Unreleased
 
     HDFS-2383. Remove TestDfsOverAvroRpc for 0.22 branch. (shv)
 
+    HDFS-1762. Allow TestHDFSCLI to be run against a cluster (cos)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/common/branches/branch-0.22/hdfs/build.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/hdfs/build.xml?rev=1182116&r1=1182115&r2=1182116&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/hdfs/build.xml (original)
+++ hadoop/common/branches/branch-0.22/hdfs/build.xml Tue Oct 11 22:02:35 2011
@@ -636,6 +636,9 @@
         <syspropertyset id="FaultProbabilityProperties">
           <propertyref regex="fi.*"/>
         </syspropertyset>
+        <syspropertyset id="TestCLIProperties">
+          <propertyref regex="test.cli.*" />
+        </syspropertyset>
         <sysproperty key="test.system.hdrc.deployed.hadoopconfdir"
                      value="@{hadoop.conf.dir.deployed}" />
         <formatter type="${test.junit.output.format}" />

Modified: hadoop/common/branches/branch-0.22/hdfs/src/test/hdfs/org/apache/hadoop/cli/TestHDFSCLI.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/hdfs/src/test/hdfs/org/apache/hadoop/cli/TestHDFSCLI.java?rev=1182116&r1=1182115&r2=1182116&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/hdfs/src/test/hdfs/org/apache/hadoop/cli/TestHDFSCLI.java
(original)
+++ hadoop/common/branches/branch-0.22/hdfs/src/test/hdfs/org/apache/hadoop/cli/TestHDFSCLI.java
Tue Oct 11 22:02:35 2011
@@ -21,6 +21,7 @@ package org.apache.hadoop.cli;
 import org.apache.hadoop.cli.util.CLITestData.TestCmd;
 import org.apache.hadoop.cli.util.CommandExecutor.Result;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.DFSConfigKeys;
 import org.apache.hadoop.hdfs.DistributedFileSystem;
 import org.apache.hadoop.hdfs.HDFSPolicyProvider;
@@ -36,7 +37,7 @@ public class TestHDFSCLI extends CLITest
   protected MiniDFSCluster dfsCluster = null;
   protected DistributedFileSystem dfs = null;
   protected String namenode = null;
-  
+
   @Before
   @Override
   public void setUp() throws Exception {
@@ -52,16 +53,24 @@ public class TestHDFSCLI extends CLITest
                         "/rack2", "/rack3", "/rack4", "/rack4" };
     String [] hosts = {"host1", "host2", "host3", "host4",
                        "host5", "host6", "host7", "host8" };
-    dfsCluster = new MiniDFSCluster.Builder(conf).numDataNodes(8)
-                                                 .racks(racks)
-                                                 .hosts(hosts)
-                                                 .build();
-    
-    namenode = conf.get(DFSConfigKeys.FS_DEFAULT_NAME_KEY, "file:///");
-    
+
+    FileSystem fs;
+    namenode = System.getProperty("test.cli.fs.default.name");
+    if (namenode == null) {
+      // Start up the mini dfs cluster
+      dfsCluster = new MiniDFSCluster.Builder(conf).numDataNodes(8)
+                                                   .racks(racks)
+                                                   .hosts(hosts)
+                                                   .build();
+      namenode = conf.get(DFSConfigKeys.FS_DEFAULT_NAME_KEY, "file:///");
+      fs = dfsCluster.getFileSystem();
+    } else {
+      conf.set(DFSConfigKeys.FS_DEFAULT_NAME_KEY, namenode);
+      fs = FileSystem.get(conf);
+    }
+
     username = System.getProperty("user.name");
 
-    FileSystem fs = dfsCluster.getFileSystem();
     assertTrue("Not a HDFS: "+fs.getUri(),
                fs instanceof DistributedFileSystem);
     dfs = (DistributedFileSystem) fs;
@@ -75,10 +84,16 @@ public class TestHDFSCLI extends CLITest
   @After
   @Override
   public void tearDown() throws Exception {
-    dfs.close();
-    dfsCluster.shutdown();
-    Thread.sleep(2000);
-    super.tearDown();
+    dfs.delete(new Path(testDirAbsolute), true);
+    if (dfsCluster != null) {
+      boolean success = false;
+      dfs.close();
+      dfsCluster.shutdown();
+      success = true;
+      Thread.sleep(2000);
+      assertTrue("Error tearing down Mini DFS cluster", success);
+      super.tearDown();
+    }
   }
 
   @Override



Mime
View raw message