Browse Source

HADOOP-1996 TestHStoreFile fails on windows if run multiple times

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@582066 13f79535-47bb-0310-9956-ffa450edef68
Jim Kellerman 18 years ago
parent
commit
39beb459ef

+ 1 - 0
src/contrib/hbase/CHANGES.txt

@@ -65,6 +65,7 @@ Trunk (unreleased changes)
     HADOOP-1966 Make HBase unit tests more reliable in the Hudson environment.
     HADOOP-1975 HBase tests failing with java.lang.NumberFormatException
     HADOOP-1990 Regression test instability affects nightly and patch builds
+    HADOOP-1996 TestHStoreFile fails on windows if run multiple times
 
   IMPROVEMENTS
     HADOOP-1737 Make HColumnDescriptor data publically members settable

+ 8 - 4
src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestHStoreFile.java

@@ -26,6 +26,7 @@ import junit.framework.TestCase;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.dfs.MiniDFSCluster;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
@@ -39,9 +40,10 @@ import org.apache.hadoop.io.WritableComparable;
  */
 public class TestHStoreFile extends TestCase {
   static final Log LOG = LogFactory.getLog(TestHStoreFile.class);
-  private static String DIR = System.getProperty("test.build.data", ".");
+  private static String DIR = "/";
   private static final char FIRST_CHAR = 'a';
   private static final char LAST_CHAR = 'z';
+  private MiniDFSCluster cluster;
   private FileSystem fs;
   private Configuration conf;
   private Path dir = null;
@@ -51,15 +53,17 @@ public class TestHStoreFile extends TestCase {
   public void setUp() throws Exception {
     super.setUp();
     this.conf = new HBaseConfiguration();
-    this.fs = FileSystem.getLocal(this.conf);
+    this.cluster = null;
+    this.cluster = new MiniDFSCluster(this.conf, 2, true, (String[])null);
+    this.fs = cluster.getFileSystem();
     this.dir = new Path(DIR, getName());
   }
   
   /** {@inheritDoc} */
   @Override
   public void tearDown() throws Exception {
-    if (this.fs.exists(this.dir)) {
-      this.fs.delete(this.dir);
+    if (this.cluster != null) {
+      this.cluster.shutdown();
     }
     super.tearDown();
   }