You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by se...@apache.org on 2013/10/24 00:27:00 UTC

svn commit: r1535202 - in /hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase: ./ chaos/factories/ mapreduce/ test/

Author: sershe
Date: Wed Oct 23 22:27:00 2013
New Revision: 1535202

URL: http://svn.apache.org/r1535202
Log:
HBASE-9659 some integration tests can no longer be run using maven

Modified:
    hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
    hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
    hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithTags.java
    hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
    hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestBulkLoad.java
    hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
    hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java

Modified: hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java?rev=1535202&r1=1535201&r2=1535202&view=diff
==============================================================================
--- hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java (original)
+++ hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java Wed Oct 23 22:27:00 2013
@@ -21,6 +21,8 @@ package org.apache.hadoop.hbase;
 import java.util.Set;
 
 import org.apache.commons.cli.CommandLine;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.chaos.factories.MonkeyFactory;
 import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey;
@@ -33,13 +35,14 @@ import org.junit.Before;
  */
 public abstract class IntegrationTestBase extends AbstractHBaseTool {
   public static final String LONG_OPT = "monkey";
+  private static final Log LOG = LogFactory.getLog(IntegrationTestBase.class);
 
   protected IntegrationTestingUtility util;
   protected ChaosMonkey monkey;
   protected String monkeyToUse;
 
   public IntegrationTestBase() {
-    this(MonkeyFactory.CALM);
+    this(null);
   }
 
   public IntegrationTestBase(String monkeyToUse) {
@@ -71,12 +74,10 @@ public abstract class IntegrationTestBas
   @Override
   protected int doWork() throws Exception {
     setUp();
-    setUpMonkey();
     int result = -1;
     try {
       result = runTestFromCommandLine();
     } finally {
-      cleanUpMonkey();
       cleanUp();
     }
 
@@ -84,16 +85,31 @@ public abstract class IntegrationTestBas
   }
 
   @Before
+  public void setUp() throws Exception {
+    setUpCluster();
+    setUpMonkey();
+  }
+
+  @After
+  public void cleanUp() throws Exception {
+    cleanUpMonkey();
+    cleanUpCluster();
+  }
+
   public void setUpMonkey() throws Exception {
     util = getTestingUtil(getConf());
     MonkeyFactory fact = MonkeyFactory.getFactory(monkeyToUse);
+    if (fact == null) {
+      // Run with no monkey in distributed context, with real monkey in local test context.
+      fact = MonkeyFactory.getFactory(
+          util.isDistributedCluster() ? MonkeyFactory.CALM : MonkeyFactory.SLOW_DETERMINISTIC);
+    }
     monkey = fact.setUtil(util)
                  .setTableName(getTablename())
                  .setColumnFamilies(getColumnFamilies()).build();
     monkey.start();
   }
 
-  @After
   public void cleanUpMonkey() throws Exception {
     cleanUpMonkey("Ending test");
   }
@@ -116,9 +132,13 @@ public abstract class IntegrationTestBas
     return util;
   }
 
-  public abstract void setUp() throws Exception;
+  public abstract void setUpCluster() throws Exception;
 
-  public abstract void cleanUp()  throws Exception;
+  public void cleanUpCluster() throws Exception {
+    LOG.debug("Restoring the cluster");
+    util.restoreCluster();
+    LOG.debug("Done restoring the cluster");
+  }
 
   public abstract int runTestFromCommandLine() throws Exception;
 

Modified: hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java?rev=1535202&r1=1535201&r2=1535202&view=diff
==============================================================================
--- hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java (original)
+++ hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java Wed Oct 23 22:27:00 2013
@@ -40,6 +40,7 @@ import org.junit.experimental.categories
 public class IntegrationTestIngest extends IntegrationTestBase {
   private static final int SERVER_COUNT = 4; // number of slaves for the smallest cluster
   private static final long DEFAULT_RUN_TIME = 20 * 60 * 1000;
+  private static final long JUNIT_RUN_TIME = 10 * 60 * 1000;
 
   /** A soft limit on how long we should run */
   private static final String RUN_TIME_KEY = "hbase.%s.runtime";
@@ -49,10 +50,11 @@ public class IntegrationTestIngest exten
   protected HBaseCluster cluster;
   protected LoadTestTool loadTool;
 
-  protected void setUp(int numSlavesBase) throws Exception {
+  @Override
+  public void setUpCluster() throws Exception {
     util = getTestingUtil(null);
-    LOG.debug("Initializing/checking cluster has " + numSlavesBase + " servers");
-    util.initializeCluster(numSlavesBase);
+    LOG.debug("Initializing/checking cluster has " + SERVER_COUNT + " servers");
+    util.initializeCluster(SERVER_COUNT);
     LOG.debug("Done initializing/checking cluster");
     cluster = util.getHBaseClusterInterface();
     deleteTableIfNecessary();
@@ -65,26 +67,18 @@ public class IntegrationTestIngest exten
   }
 
   @Override
-  public void setUp() throws Exception {
-    setUp(SERVER_COUNT);
-  }
-
-  @Override
-  public void cleanUp() throws Exception {
-    LOG.debug("Restoring the cluster");
-    util.restoreCluster();
-    LOG.debug("Done restoring the cluster");
-  }
-
-  @Override
   public int runTestFromCommandLine() throws Exception {
-    internalRunIngestTest();
+    internalRunIngestTest(DEFAULT_RUN_TIME);
     return 0;
   }
 
   @Test
-  public void internalRunIngestTest() throws Exception {
-    runIngestTest(DEFAULT_RUN_TIME, 2500, 10, 1024, 10, false, 10);
+  public void testIngest() throws Exception {
+    runIngestTest(JUNIT_RUN_TIME, 2500, 10, 1024, 10, false, 10);
+  }
+
+  private void internalRunIngestTest(long runTime) throws Exception {
+    runIngestTest(runTime, 2500, 10, 1024, 10, false, 10);
   }
 
   @Override

Modified: hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithTags.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithTags.java?rev=1535202&r1=1535201&r2=1535202&view=diff
==============================================================================
--- hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithTags.java (original)
+++ hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithTags.java Wed Oct 23 22:27:00 2013
@@ -17,16 +17,14 @@
  */
 package org.apache.hadoop.hbase;
 
-import org.junit.Before;
 import org.junit.experimental.categories.Category;
 
 @Category(IntegrationTests.class)
 public class IntegrationTestIngestWithTags extends IntegrationTestIngest {
-  @Before
   @Override
-  public void setUp() throws Exception {
+  public void setUpCluster() throws Exception {
     getTestingUtil(conf).getConfiguration().setInt("hfile.format.version", 3);
-    super.setUp();
+    super.setUpCluster();
   }
 
   @Override

Modified: hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java?rev=1535202&r1=1535201&r2=1535202&view=diff
==============================================================================
--- hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java (original)
+++ hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java Wed Oct 23 22:27:00 2013
@@ -53,6 +53,7 @@ public abstract class MonkeyFactory {
 
 
   public static final String CALM = "calm";
+  // TODO: the name has become a misnomer since the default (not-slow) monkey has been removed
   public static final String SLOW_DETERMINISTIC = "slowDeterministic";
   public static final String UNBALANCE = "unbalance";
 
@@ -63,10 +64,6 @@ public abstract class MonkeyFactory {
     .build();
 
   public static MonkeyFactory getFactory(String factoryName) {
-     MonkeyFactory fact = FACTORIES.get(factoryName);
-    if (fact == null)  {
-      fact = FACTORIES.get(CALM);
-    }
-    return fact;
+    return FACTORIES.get(factoryName);
   }
 }

Modified: hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestBulkLoad.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestBulkLoad.java?rev=1535202&r1=1535201&r2=1535202&view=diff
==============================================================================
--- hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestBulkLoad.java (original)
+++ hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestBulkLoad.java Wed Oct 23 22:27:00 2013
@@ -64,8 +64,6 @@ import org.apache.hadoop.mapreduce.TaskA
 import org.apache.hadoop.mapreduce.lib.input.FileSplit;
 import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
 import org.apache.hadoop.util.ToolRunner;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -561,9 +559,8 @@ public class IntegrationTestBulkLoad ext
     util.getTestFileSystem().delete(p, true);
   }
 
-  @Before
   @Override
-  public void setUp() throws Exception {
+  public void setUpCluster() throws Exception {
     util = getTestingUtil(getConf());
     util.initializeCluster(1);
 
@@ -578,13 +575,6 @@ public class IntegrationTestBulkLoad ext
     }
   }
 
-  @After
-  @Override
-  public void cleanUp() throws Exception {
-    util.restoreCluster();
-    util = null;
-  }
-
   @Override
   public int runTestFromCommandLine() throws Exception {
     runCheck();

Modified: hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java?rev=1535202&r1=1535201&r2=1535202&view=diff
==============================================================================
--- hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java (original)
+++ hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java Wed Oct 23 22:27:00 2013
@@ -89,8 +89,6 @@ import org.apache.hadoop.mapreduce.lib.o
 import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -1044,20 +1042,13 @@ public class IntegrationTestBigLinkedLis
 
   protected IntegrationTestingUtility util;
 
-  @Before
   @Override
-  public void setUp() throws Exception {
+  public void setUpCluster() throws Exception {
     util = getTestingUtil(getConf());
     util.initializeCluster(util.isDistributedCluster() ? 1 : this.NUM_SLAVES_BASE);
     this.setConf(util.getConfiguration());
   }
 
-  @After
-  @Override
-  public void cleanUp() throws Exception {
-    util.restoreCluster();
-  }
-
   @Test
   public void testContinuousIngest() throws IOException, Exception {
     //Loop <num iterations> <num mappers> <num nodes per mapper> <output dir> <num reducers>

Modified: hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java?rev=1535202&r1=1535201&r2=1535202&view=diff
==============================================================================
--- hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java (original)
+++ hbase/trunk/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java Wed Oct 23 22:27:00 2013
@@ -64,8 +64,6 @@ import org.apache.hadoop.mapreduce.Mappe
 import org.apache.hadoop.mapreduce.Reducer;
 import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
 import org.apache.hadoop.util.ToolRunner;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -121,8 +119,7 @@ public class IntegrationTestLoadAndVerif
     REFERENCES_CHECKED
   }
 
-  @Before
-  public void setUp() throws Exception {
+  public void setUpCluster() throws Exception {
     util = getTestingUtil(getConf());
     util.initializeCluster(3);
     this.setConf(util.getConfiguration());
@@ -152,12 +149,6 @@ public class IntegrationTestLoadAndVerif
       ( ( ( value >> 56 ) & 0xff ) << 0 );
   }
 
-  @Override
-  @After
-  public void cleanUp() throws Exception {
-    util.restoreCluster();
-  }
-
   public static class LoadMapper
       extends Mapper<NullWritable, NullWritable, NullWritable, NullWritable>
   {