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 2014/11/15 23:20:50 UTC

svn commit: r1639931 - /hive/trunk/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java

Author: hashutosh
Date: Sat Nov 15 22:20:50 2014
New Revision: 1639931

URL: http://svn.apache.org/r1639931
Log:
HIVE-8812 : TestMinimrCliDriver failure if run in the same command as TestHBaseNegativeCliDriver (Jason Dere via Thejas Nair)

Modified:
    hive/trunk/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java

Modified: hive/trunk/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
URL: http://svn.apache.org/viewvc/hive/trunk/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java?rev=1639931&r1=1639930&r2=1639931&view=diff
==============================================================================
--- hive/trunk/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java (original)
+++ hive/trunk/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java Sat Nov 15 22:20:50 2014
@@ -537,10 +537,11 @@ public class QTestUtil {
   /**
    * Clear out any side effects of running tests
    */
-  public void clearTestSideEffects() throws Exception {
+  public void clearTablesCreatedDuringTests() throws Exception {
     if (System.getenv(QTEST_LEAVE_FILES) != null) {
       return;
     }
+
     // Delete any tables other than the source tables
     // and any databases other than the default database.
     for (String dbName : db.getAllDatabases()) {
@@ -574,9 +575,11 @@ public class QTestUtil {
     try {
       Path p = new Path(testWarehouse);
       FileSystem fileSystem = p.getFileSystem(conf);
-      for (FileStatus status : fileSystem.listStatus(p)) {
-        if (status.isDir() && !srcTables.contains(status.getPath().getName())) {
-          fileSystem.delete(status.getPath(), true);
+      if (fileSystem.exists(p)) {
+        for (FileStatus status : fileSystem.listStatus(p)) {
+          if (status.isDir() && !srcTables.contains(status.getPath().getName())) {
+            fileSystem.delete(status.getPath(), true);
+          }
         }
       }
     } catch (IllegalArgumentException e) {
@@ -590,6 +593,18 @@ public class QTestUtil {
           db.dropRole(roleName);
         }
     }
+  }
+
+  /**
+   * Clear out any side effects of running tests
+   */
+  public void clearTestSideEffects() throws Exception {
+    if (System.getenv(QTEST_LEAVE_FILES) != null) {
+      return;
+    }
+
+    clearTablesCreatedDuringTests();
+
     // allocate and initialize a new conf since a test can
     // modify conf by using 'set' commands
     conf = new HiveConf (Driver.class);
@@ -606,6 +621,8 @@ public class QTestUtil {
       return;
     }
 
+    clearTablesCreatedDuringTests();
+
     SessionState.get().getConf().setBoolean("hive.test.shutdown.phase", true);
 
     String cleanupCommands = readEntireFileIntoString(new File(cleanupScript));