gaurav-narula commented on code in PR #15289:
URL: https://github.com/apache/kafka/pull/15289#discussion_r1511199142


##########
core/src/test/scala/unit/kafka/utils/TestUtils.scala:
##########
@@ -137,7 +137,9 @@ object TestUtils extends Logging {
     val parentFile = new File(parent)
     parentFile.mkdirs()
 
-    JTestUtils.tempDirectory(parentFile.toPath, null)
+    val result = JTestUtils.tempDirectory(parentFile.toPath, null)

Review Comment:
   Note that `JTestUtils.tempDirectory` is overloaded with `parentFile` 
possibly being null. In those cases, the cleanup works as intended.
   
   This is however a special case where `parentFile != null`, because the test 
create a logdir in a "relative location". `JTestUtils.tempDirectory` does 
handle the removal of everything it creates under `parentFile` but it doesn't 
remove the `parentFile` though.
   
   I feel it's semantically better for the function that creates `parentFile` 
to handle its deletion rather than delegating it to `JTestUtils.tempDirectory` 
since it might not be very obvious to callers of `JTestUtils.tempDirectory` 
otherwise.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to