From 1acbfbde1f0f3e7a656bd343c7000c24f48d15d4 Mon Sep 17 00:00:00 2001 From: Jim Kellerman Date: Fri, 5 Oct 2007 03:26:32 +0000 Subject: [PATCH] HADOOP-1996 TestHStoreFile fails on windows if run multiple times git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@582066 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + src/test/org/apache/hadoop/hbase/TestHStoreFile.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 41db22bc16c..b07117b73a2 100644 --- a/CHANGES.txt +++ b/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 diff --git a/src/test/org/apache/hadoop/hbase/TestHStoreFile.java b/src/test/org/apache/hadoop/hbase/TestHStoreFile.java index 37db97e68d9..035f4d8a378 100644 --- a/src/test/org/apache/hadoop/hbase/TestHStoreFile.java +++ b/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(); }