diff --git itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java index 85e3bda..380426a 100644 --- itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java +++ itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java @@ -537,10 +537,11 @@ public void clearPostTestEffects() throws Exception { /** * 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()) { @@ -590,6 +591,18 @@ public void clearTestSideEffects() throws Exception { 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 +619,8 @@ public void cleanUp() throws Exception { return; } + clearTablesCreatedDuringTests(); + SessionState.get().getConf().setBoolean("hive.test.shutdown.phase", true); String cleanupCommands = readEntireFileIntoString(new File(cleanupScript));