Skip to content

Commit 2f1e201

Browse files
committed
Cleanup 'stdout' file within FileAppenderSuite
1 parent 889f7b7 commit 2f1e201

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core/src/test/scala/org/apache/spark/util/FileAppenderSuite.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class FileAppenderSuite extends FunSuite with BeforeAndAfter with Logging {
120120
// on SparkConf settings.
121121

122122
def testAppenderSelection[ExpectedAppender: ClassTag, ExpectedRollingPolicy](
123-
properties: Seq[(String, String)], expectedRollingPolicyParam: Long = -1): FileAppender = {
123+
properties: Seq[(String, String)], expectedRollingPolicyParam: Long = -1): Unit = {
124124

125125
// Set spark conf properties
126126
val conf = new SparkConf
@@ -130,7 +130,8 @@ class FileAppenderSuite extends FunSuite with BeforeAndAfter with Logging {
130130

131131
// Create and test file appender
132132
val inputStream = new PipedInputStream(new PipedOutputStream())
133-
val appender = FileAppender(inputStream, new File("stdout"), conf)
133+
val outFile = new File("stdout")
134+
val appender = FileAppender(inputStream, outFile, conf)
134135
assert(appender.isInstanceOf[ExpectedAppender])
135136
assert(appender.getClass.getSimpleName ===
136137
classTag[ExpectedAppender].runtimeClass.getSimpleName)
@@ -144,7 +145,9 @@ class FileAppenderSuite extends FunSuite with BeforeAndAfter with Logging {
144145
}
145146
assert(policyParam === expectedRollingPolicyParam)
146147
}
147-
appender
148+
appender.stop()
149+
appender.awaitTermination
150+
assert(outFile.delete())
148151
}
149152

150153
import RollingFileAppender._

0 commit comments

Comments
 (0)