You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jk...@apache.org on 2014/07/12 21:50:13 UTC
git commit: KAFKA-1258 Automatically delete temporary directories
with a shutdown hook during tests to avoid leaking temp files. Patch by
Manikumar Reddy.
Repository: kafka
Updated Branches:
refs/heads/trunk 83a9aa55d -> 4b3d03e8e
KAFKA-1258 Automatically delete temporary directories with a shutdown hook during tests to avoid leaking temp files. Patch by Manikumar Reddy.
Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/4b3d03e8
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/4b3d03e8
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/4b3d03e8
Branch: refs/heads/trunk
Commit: 4b3d03e8e0d660b27c7823c03dde075d6ce8348b
Parents: 83a9aa5
Author: Jay Kreps <ja...@gmail.com>
Authored: Sat Jul 12 12:49:04 2014 -0700
Committer: Jay Kreps <ja...@gmail.com>
Committed: Sat Jul 12 12:49:04 2014 -0700
----------------------------------------------------------------------
core/src/test/scala/unit/kafka/utils/TestUtils.scala | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kafka/blob/4b3d03e8/core/src/test/scala/unit/kafka/utils/TestUtils.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/utils/TestUtils.scala b/core/src/test/scala/unit/kafka/utils/TestUtils.scala
index 57b2bd5..3faa884 100644
--- a/core/src/test/scala/unit/kafka/utils/TestUtils.scala
+++ b/core/src/test/scala/unit/kafka/utils/TestUtils.scala
@@ -84,6 +84,13 @@ object TestUtils extends Logging {
val f = new File(IoTmpDir, "kafka-" + random.nextInt(1000000))
f.mkdirs()
f.deleteOnExit()
+
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ override def run() = {
+ Utils.rm(f)
+ }
+ })
+
f
}