diff --git data/conf/hive-site.xml data/conf/hive-site.xml index 7a69711..62364fe 100644 --- data/conf/hive-site.xml +++ data/conf/hive-site.xml @@ -70,7 +70,7 @@ javax.jdo.option.ConnectionURL - jdbc:derby:;databaseName=${test.tmp.dir}/junit_metastore_db;create=true + jdbc:derby:memory:${test.tmp.dir}/junit_metastore_db;create=true diff --git ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java index 2d1ecb5..bbed591 100644 --- ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java +++ ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java @@ -17,6 +17,7 @@ */ package org.apache.hadoop.hive.ql.txn.compactor; +import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; @@ -66,6 +67,7 @@ import java.io.EOFException; import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -96,10 +98,11 @@ protected CompactorTest() throws Exception { TxnDbUtil.cleanDb(); ms = new HiveMetaStoreClient(conf); txnHandler = TxnUtils.getTxnStore(conf); - tmpdir = new File(System.getProperty("java.io.tmpdir") + - System.getProperty("file.separator") + "compactor_test_tables"); - tmpdir.mkdir(); - tmpdir.deleteOnExit(); + tmpdir = new File (Files.createTempDirectory("compactor_test_table_").toString()); + } + + protected void compactorTestCleanup() throws IOException { + FileUtils.deleteDirectory(tmpdir); } protected void startInitiator() throws Exception { diff --git ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java index 44dd99b..0acf71b 100644 --- ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java +++ ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java @@ -37,6 +37,7 @@ import org.apache.hadoop.hive.metastore.api.UnlockRequest; import org.apache.hadoop.hive.metastore.txn.CompactionInfo; import org.apache.hadoop.hive.metastore.txn.TxnStore; +import org.junit.After; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -517,4 +518,9 @@ public void droppedPartition() throws Exception { boolean useHive130DeltaDirName() { return false; } + + @After + public void tearDown() throws Exception { + compactorTestCleanup(); + } } diff --git ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java index a11fe86..f75a1be 100644 --- ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java +++ ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java @@ -35,6 +35,7 @@ import org.apache.hadoop.hive.metastore.api.ShowCompactResponseElement; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.txn.TxnStore; +import org.junit.After; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -752,4 +753,8 @@ boolean useHive130DeltaDirName() { return false; } + @After + public void tearDown() throws Exception { + compactorTestCleanup(); + } } diff --git ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java index e85f49c..efd6ed8 100644 --- ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java +++ ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java @@ -33,6 +33,7 @@ import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.txn.TxnStore; import org.apache.hadoop.hive.ql.io.AcidUtils; +import org.junit.After; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -977,4 +978,9 @@ public void droppedPartition() throws Exception { Assert.assertEquals(1, compacts.size()); Assert.assertTrue(TxnStore.SUCCEEDED_RESPONSE.equals(rsp.getCompacts().get(0).getState())); } + + @After + public void tearDown() throws Exception { + compactorTestCleanup(); + } }