hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject svn commit: r1514863 - in /hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase: ./ chaos/monkies/ test/
Date Fri, 16 Aug 2013 19:32:11 GMT
Author: eclark
Date: Fri Aug 16 19:32:11 2013
New Revision: 1514863

URL: http://svn.apache.org/r1514863
Log:
HBASE-9237 Integration test cleanup after ChaosMonkey refactor

Modified:
    hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
    hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
    hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java
    hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
    hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java

Modified: hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java?rev=1514863&r1=1514862&r2=1514863&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
(original)
+++ hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
Fri Aug 16 19:32:11 2013
@@ -70,11 +70,11 @@ public abstract class IntegrationTestBas
 
   @Override
   protected int doWork() throws Exception {
-    setUpMonkey();
     setUp();
+    setUpMonkey();
     int result = -1;
     try {
-      runTestFromCommandLine();
+      result = runTestFromCommandLine();
     } finally {
       cleanUpMonkey();
       cleanUp();
@@ -90,6 +90,7 @@ public abstract class IntegrationTestBas
     monkey = fact.setUtil(util)
                  .setTableName(getTablename())
                  .setColumnFamilies(getColumnFamilies()).build();
+    monkey.start();
   }
 
   @After

Modified: hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java?rev=1514863&r1=1514862&r2=1514863&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
(original)
+++ hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
Fri Aug 16 19:32:11 2013
@@ -41,8 +41,6 @@ public class IntegrationTestIngest exten
   private static final int SERVER_COUNT = 4; // number of slaves for the smallest cluster
   private static final long DEFAULT_RUN_TIME = 20 * 60 * 1000;
 
-  protected static String tableName = null;
-
   /** A soft limit on how long we should run */
   private static final String RUN_TIME_KEY = "hbase.%s.runtime";
 
@@ -52,7 +50,6 @@ public class IntegrationTestIngest exten
   private LoadTestTool loadTool;
 
   protected void setUp(int numSlavesBase) throws Exception {
-    tableName = this.getClass().getSimpleName();
     util = getTestingUtil(null);
     LOG.debug("Initializing/checking cluster has " + numSlavesBase + " servers");
     util.initializeCluster(numSlavesBase);
@@ -63,7 +60,7 @@ public class IntegrationTestIngest exten
     loadTool.setConf(util.getConfiguration());
     // Initialize load test tool before we start breaking things;
     // LoadTestTool init, even when it is a no-op, is very fragile.
-    int ret = loadTool.run(new String[] { "-tn", tableName, "-init_only" });
+    int ret = loadTool.run(new String[] { "-tn", getTablename(), "-init_only" });
     Assert.assertEquals("Failed to initialize LoadTestTool", 0, ret);
   }
 
@@ -92,7 +89,7 @@ public class IntegrationTestIngest exten
 
   @Override
   public String getTablename() {
-    return tableName;
+    return this.getClass().getSimpleName();
   }
 
   @Override
@@ -101,8 +98,8 @@ public class IntegrationTestIngest exten
   }
 
   private void deleteTableIfNecessary() throws IOException {
-    if (util.getHBaseAdmin().tableExists(tableName)) {
-      util.deleteTable(Bytes.toBytes(tableName));
+    if (util.getHBaseAdmin().tableExists(getTablename())) {
+      util.deleteTable(Bytes.toBytes(getTablename()));
     }
   }
 
@@ -122,7 +119,7 @@ public class IntegrationTestIngest exten
           ((runtime - (System.currentTimeMillis() - start))/60000) + " min");
 
       int ret = loadTool.run(new String[] {
-          "-tn", tableName,
+          "-tn", getTablename(),
           "-write", String.format("%d:%d:%d", colsPerKey, recordSize, writeThreads),
           "-start_key", String.valueOf(startKey),
           "-num_keys", String.valueOf(numKeys),
@@ -135,7 +132,7 @@ public class IntegrationTestIngest exten
       }
 
       ret = loadTool.run(new String[] {
-          "-tn", tableName,
+          "-tn", getTablename(),
           "-update", String.format("60:%d", writeThreads),
           "-start_key", String.valueOf(startKey),
           "-num_keys", String.valueOf(numKeys),
@@ -148,7 +145,7 @@ public class IntegrationTestIngest exten
       }
 
       ret = loadTool.run(new String[] {
-          "-tn", tableName,
+          "-tn", getTablename(),
           "-read", "100:20",
           "-start_key", String.valueOf(startKey),
           "-num_keys", String.valueOf(numKeys),

Modified: hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java?rev=1514863&r1=1514862&r2=1514863&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java
(original)
+++ hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java
Fri Aug 16 19:32:11 2013
@@ -139,6 +139,10 @@ public class PolicyBasedChaosMonkey exte
 
   @Override
   public void stop(String why) {
+    if (policies == null) {
+      return;
+    }
+
     for (Policy policy : policies) {
       policy.stop(why);
     }
@@ -155,6 +159,9 @@ public class PolicyBasedChaosMonkey exte
    */
   @Override
   public void waitForStop() throws InterruptedException {
+    if (monkeyThreads == null) {
+      return;
+    }
     for (Thread monkeyThread : monkeyThreads) {
       monkeyThread.join();
     }

Modified: hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java?rev=1514863&r1=1514862&r2=1514863&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
(original)
+++ hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
Fri Aug 16 19:32:11 2013
@@ -57,6 +57,7 @@ import org.apache.hadoop.hbase.io.Immuta
 import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
 import org.apache.hadoop.hbase.mapreduce.TableMapper;
 import org.apache.hadoop.hbase.mapreduce.TableRecordReaderImpl;
+import org.apache.hadoop.hbase.util.AbstractHBaseTool;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.BytesWritable;
 import org.apache.hadoop.io.NullWritable;
@@ -494,6 +495,7 @@ public class IntegrationTestBigLinkedLis
 
       job.getConfiguration().setBoolean("mapred.map.tasks.speculative.execution", false);
       TableMapReduceUtil.addDependencyJars(job);
+      TableMapReduceUtil.addDependencyJars(job.getConfiguration(), AbstractHBaseTool.class);
       TableMapReduceUtil.initCredentials(job);
 
       boolean success = job.waitForCompletion(true);
@@ -637,6 +639,7 @@ public class IntegrationTestBigLinkedLis
 
       TableMapReduceUtil.initTableMapperJob(getTableName(getConf()).getName(), scan,
           VerifyMapper.class, BytesWritable.class, BytesWritable.class, job);
+      TableMapReduceUtil.addDependencyJars(job.getConfiguration(), AbstractHBaseTool.class);
 
       job.getConfiguration().setBoolean("mapred.map.tasks.speculative.execution", false);
 

Modified: hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java?rev=1514863&r1=1514862&r2=1514863&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java
(original)
+++ hbase/branches/0.95/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java
Fri Aug 16 19:32:11 2013
@@ -48,6 +48,7 @@ import org.apache.hadoop.hbase.io.Immuta
 import org.apache.hadoop.hbase.mapreduce.NMapInputFormat;
 import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
 import org.apache.hadoop.hbase.mapreduce.TableMapper;
+import org.apache.hadoop.hbase.util.AbstractHBaseTool;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.BytesWritable;
 import org.apache.hadoop.io.NullWritable;
@@ -311,8 +312,8 @@ public class IntegrationTestLoadAndVerif
     FileOutputFormat.setOutputPath(job, outputDir);
 
     TableMapReduceUtil.addDependencyJars(job);
-    TableMapReduceUtil.addDependencyJars(
-        job.getConfiguration(), HTable.class, Lists.class);
+
+    TableMapReduceUtil.addDependencyJars(job.getConfiguration(), AbstractHBaseTool.class);
     TableMapReduceUtil.initCredentials(job);
     assertTrue(job.waitForCompletion(true));
   }
@@ -329,6 +330,7 @@ public class IntegrationTestLoadAndVerif
     TableMapReduceUtil.initTableMapperJob(
         htd.getTableName().getNameAsString(), scan, VerifyMapper.class,
         BytesWritable.class, BytesWritable.class, job);
+    TableMapReduceUtil.addDependencyJars(job.getConfiguration(), AbstractHBaseTool.class);
     int scannerCaching = conf.getInt("verify.scannercaching", SCANNER_CACHING);
     TableMapReduceUtil.setScannerCaching(job, scannerCaching);
 



Mime
View raw message