You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2016/05/07 16:45:05 UTC

hive git commit: HIVE-13352 : Seems unnecessary for HBase tests to call QTestUtil.tearDown to close zookeeper and others. (Balint Molnar via Ashutosh Chauhan)

Repository: hive
Updated Branches:
  refs/heads/master 3f3aa2a1b -> 98479c300


HIVE-13352 :  Seems unnecessary for HBase tests to call QTestUtil.tearDown to close zookeeper and others. (Balint Molnar via Ashutosh Chauhan)

Signed-off-by: Ashutosh Chauhan <ha...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/98479c30
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/98479c30
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/98479c30

Branch: refs/heads/master
Commit: 98479c3008a4b42359ca672cc6b3c53bf332cd12
Parents: 3f3aa2a
Author: Balint Molnar <mo...@gmail.com>
Authored: Thu May 5 03:05:00 2016 -0800
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Sat May 7 09:43:56 2016 -0700

----------------------------------------------------------------------
 .../clientnegative/case_with_row_sequence.q.out |  1 -
 .../src/test/templates/TestHBaseCliDriver.vm    | 52 +++++++++++++++-----
 .../hadoop/hive/hbase/HBaseQTestUtil.java       | 11 ++++-
 ql/src/test/templates/TestCliDriver.vm          |  1 +
 4 files changed, 50 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/98479c30/contrib/src/test/results/clientnegative/case_with_row_sequence.q.out
----------------------------------------------------------------------
diff --git a/contrib/src/test/results/clientnegative/case_with_row_sequence.q.out b/contrib/src/test/results/clientnegative/case_with_row_sequence.q.out
index afc492c..31fb030 100644
--- a/contrib/src/test/results/clientnegative/case_with_row_sequence.q.out
+++ b/contrib/src/test/results/clientnegative/case_with_row_sequence.q.out
@@ -26,5 +26,4 @@ Task ID:
 
 Logs:
 
-#### A masked pattern was here ####
 FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask

http://git-wip-us.apache.org/repos/asf/hive/blob/98479c30/hbase-handler/src/test/templates/TestHBaseCliDriver.vm
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/templates/TestHBaseCliDriver.vm b/hbase-handler/src/test/templates/TestHBaseCliDriver.vm
index 6f4a7c1..f513f03 100644
--- a/hbase-handler/src/test/templates/TestHBaseCliDriver.vm
+++ b/hbase-handler/src/test/templates/TestHBaseCliDriver.vm
@@ -22,6 +22,7 @@ import org.apache.hadoop.hive.hbase.HBaseQTestUtil;
 import org.apache.hadoop.hive.hbase.HBaseTestSetup;
 import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -31,19 +32,34 @@ import static org.junit.Assert.fail;
 public class $className {
 
   private static final String HIVE_ROOT = HBaseQTestUtil.ensurePathEndsInSlash(System.getProperty("hive.root"));
-  private HBaseQTestUtil qt;
+  private static HBaseQTestUtil qt;
   private static HBaseTestSetup setup = new HBaseTestSetup();
 
-  @Before
-  public void setUp() {
+  @BeforeClass
+  public static void systemSetUp() {
+        MiniClusterType miniMR = MiniClusterType.valueForString("$clusterMode");
+        String initScript = "$initScript";
+        String cleanupScript = "$cleanupScript";
+
+        try {
+          qt = new HBaseQTestUtil((HIVE_ROOT + "$resultsDir"), (HIVE_ROOT + "$logDir"), miniMR,
+          setup, initScript, cleanupScript);
+          qt.cleanUp(null);
+          qt.createSources(null);
+
+        } catch (Exception e) {
+          System.err.println("Exception: " + e.getMessage());
+          e.printStackTrace();
+          System.err.flush();
+          fail("Unexpected exception in static initialization: "+e.getMessage());
+        }
 
-    MiniClusterType miniMR = MiniClusterType.valueForString("$clusterMode");
-    String initScript = "$initScript";
-    String cleanupScript = "$cleanupScript";
+  }
 
+  @Before
+  public void setUp() {
     try {
-      qt = new HBaseQTestUtil((HIVE_ROOT + "$resultsDir"), (HIVE_ROOT + "$logDir"), miniMR,
-      setup, initScript, cleanupScript);
+      qt.clearTestSideEffects();
     } catch (Exception e) {
       System.err.println("Exception: " + e.getMessage());
       e.printStackTrace();
@@ -51,11 +67,10 @@ public class $className {
       fail("Unexpected exception in setup");
     }
   }
-
   @After
   public void tearDown() {
     try {
-      qt.shutdown();
+      qt.clearPostTestEffects();
     } catch (Exception e) {
       System.err.println("Exception: " + e.getMessage());
       e.printStackTrace();
@@ -65,6 +80,18 @@ public class $className {
   }
 
   @AfterClass
+  public static void shutdown() throws Exception {
+    try {
+      qt.shutdown();
+    } catch (Exception e) {
+      System.err.println("Exception: " + e.getMessage());
+      e.printStackTrace();
+      System.err.flush();
+      fail("Unexpected exception in shutdown");
+    }
+  }
+
+  @AfterClass
   public static void closeHBaseConnections() throws Exception {
     setup.tearDown();
   }
@@ -93,8 +120,8 @@ public class $className {
         return;
       }
 
-      qt.cliInit(fname);
-      qt.clearTestSideEffects();
+      qt.cliInit(fname, false);
+
       int ecode = qt.executeClient(fname);
       if (ecode != 0) {
         qt.failed(ecode, fname, null);
@@ -104,7 +131,6 @@ public class $className {
       if (ecode != 0) {
         qt.failedDiff(ecode, fname, null);
       }
-      qt.clearPostTestEffects();
 
     } catch (Throwable e) {
       qt.failed(e, fname, null);

http://git-wip-us.apache.org/repos/asf/hive/blob/98479c30/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseQTestUtil.java
----------------------------------------------------------------------
diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseQTestUtil.java b/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseQTestUtil.java
index 3ff5742..9d86e57 100644
--- a/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseQTestUtil.java
+++ b/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseQTestUtil.java
@@ -39,13 +39,16 @@ public class HBaseQTestUtil extends QTestUtil {
   /** A handle to this harness's cluster */
   private final HConnection conn;
 
+  private HBaseTestSetup hbaseSetup = null;
+
   public HBaseQTestUtil(
     String outDir, String logDir, MiniClusterType miniMr, HBaseTestSetup setup,
     String initScript, String cleanupScript)
     throws Exception {
 
     super(outDir, logDir, miniMr, null, "0.20", initScript, cleanupScript, false, false);
-    setup.preTest(conf);
+    hbaseSetup = setup;
+    hbaseSetup.preTest(conf);
     this.conn = setup.getConnection();
     super.init();
   }
@@ -112,4 +115,10 @@ public class HBaseQTestUtil extends QTestUtil {
       if (admin != null) admin.close();
     }
   }
+
+  @Override
+  public void clearTestSideEffects() throws Exception {
+    super.clearTestSideEffects();
+    hbaseSetup.preTest(conf);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/98479c30/ql/src/test/templates/TestCliDriver.vm
----------------------------------------------------------------------
diff --git a/ql/src/test/templates/TestCliDriver.vm b/ql/src/test/templates/TestCliDriver.vm
index 72cfab9..0ccedce 100644
--- a/ql/src/test/templates/TestCliDriver.vm
+++ b/ql/src/test/templates/TestCliDriver.vm
@@ -118,6 +118,7 @@ public class $className {
       qt.addFile(fpath);
 
       if (qt.shouldBeSkipped(fname)) {
+        System.err.println("Test " + fname + " skipped");
         return;
       }