hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1511060 - in /hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase: HBaseClusterTestCase.java regionserver/TestCompaction.java
Date Tue, 06 Aug 2013 18:18:19 GMT
Author: liyin
Date: Tue Aug  6 18:18:19 2013
New Revision: 1511060

URL: http://svn.apache.org/r1511060
Log:
[Master] Fix more unit tests failures caused by wrong FS

Author: liyintang

Summary:
Several unit tests are failed in the Jenkins due to the wrong fs setting.

==============
Error Message

Wrong FS: hdfs://localhost.localdomain:39190/user/svcscm, expected: file:///

http://ci-builds.fb.com/job/hadoop_baboon_hbase_trunk/776/testReport/junit/org.apache.hadoop.hbase.regionserver.wal/TestLogRolling/testLogRollOnDatanodeDeath/

Test Plan: running all the unit test

Reviewers: manukranthk, rshroff

Reviewed By: manukranthk

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D913921

Modified:
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseClusterTestCase.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseClusterTestCase.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseClusterTestCase.java?rev=1511060&r1=1511059&r2=1511060&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseClusterTestCase.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseClusterTestCase.java
Tue Aug  6 18:18:19 2013
@@ -19,15 +19,8 @@
  */
 package org.apache.hadoop.hbase;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Random;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.client.HConnectionManager;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.util.FSUtils;
@@ -36,6 +29,9 @@ import org.apache.hadoop.util.Reflection
 import org.junit.After;
 import org.junit.Before;
 
+import java.io.File;
+import java.io.PrintWriter;
+
 /**
  * Abstract base class for HBase cluster junit tests.  Spins up an hbase
  * cluster in setup and tears it down again in tearDown.
@@ -126,27 +122,21 @@ public abstract class HBaseClusterTestCa
   protected void setUp() throws Exception {
     try {
       if (this.startDfs) {
-        // This spews a bunch of warnings about missing scheme.
-        try {
-          this.dfsCluster = new HBaseTestingUtility().startMiniDFSCluster(2);
-        } catch (Exception e) {
-          LOG.error("Failed to restart the MiniDFSCluster ", e);
-
-
-        }
-        // mangle the conf so that the fs parameter points to the minidfs we
-        // just started up
-        FileSystem filesystem = dfsCluster.getFileSystem();
-        conf.set("fs.defaultFS", filesystem.getUri().toString());
-        Path parentdir = filesystem.getHomeDirectory();
-        conf.set(HConstants.HBASE_DIR, parentdir.toString());
-        filesystem.mkdirs(parentdir);
-        FSUtils.setVersion(filesystem, parentdir);
-      }
-
-      // do the super setup now. if we had done it first, then we would have
-      // gotten our conf all mangled and a local fs started up.
-      super.setUp();
+        // Start the mini HDFS cluster
+        this.dfsCluster = new HBaseTestingUtility().startMiniDFSCluster(2);
+
+        // Set the filesystem
+        this.fs = dfsCluster.getFileSystem();
+        conf.set("fs.defaultFS", fs.getUri().toString());
+
+        // Set the testDir
+        this.testDir= fs.getHomeDirectory();
+        conf.set(HConstants.HBASE_DIR, testDir.toString());
+        fs.mkdirs(testDir);
+        FSUtils.setVersion(fs, testDir);
+      }
+
+      // super.setup(); The current class has already reset the fs and testDir.
 
       // run the pre-cluster setup
       preHBaseClusterSetup();
@@ -179,7 +169,7 @@ public abstract class HBaseClusterTestCa
         // open the META table now to ensure cluster is running before shutdown.
         new HTable(conf, HConstants.META_TABLE_NAME);
       }
-      super.tearDown();
+
       HConnectionManager.deleteConnectionInfo(conf, true);
     } catch (Exception e) {
       LOG.error("Unexpected exception during shutdown ", e);

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java?rev=1511060&r1=1511059&r2=1511060&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java
Tue Aug  6 18:18:19 2013
@@ -19,49 +19,41 @@
  */
 package org.apache.hadoop.hbase.regionserver;
 
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.spy;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.HBaseTestCase;
+import org.apache.hadoop.hbase.HBaseClusterTestCase;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.*;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
 import org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder;
 import org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoderImpl;
 import org.apache.hadoop.hbase.io.hfile.HFileScanner;
 import org.apache.hadoop.hbase.regionserver.wal.HLog;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hdfs.DistributedFileSystem;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
-import org.apache.hadoop.hdfs.DistributedFileSystem;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.Map.Entry;
+
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.spy;
 
 
 
 /**
  * Test compactions
  */
-public class TestCompaction extends HBaseTestCase {
+public class TestCompaction extends HBaseClusterTestCase {
   static final Log LOG = LogFactory.getLog(TestCompaction.class.getName());
   private HRegion r = null;
   private HTableDescriptor htd = null;



Mime
View raw message