Skip to content

Commit 4cbeea8

Browse files
markhamstratdas
authored andcommitted
SPARK-2158 Clean up core/stdout file from FileAppenderSuite
@tdas Author: Mark Hamstra <[email protected]> Closes apache#1100 from markhamstra/SPARK-2158 and squashes the following commits: ae8e069 [Mark Hamstra] Response to TD's review 2f1e201 [Mark Hamstra] Cleanup 'stdout' file within FileAppenderSuite
1 parent 3870248 commit 4cbeea8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 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
@@ -129,8 +129,9 @@ class FileAppenderSuite extends FunSuite with BeforeAndAfter with Logging {
129129
}
130130

131131
// Create and test file appender
132-
val inputStream = new PipedInputStream(new PipedOutputStream())
133-
val appender = FileAppender(inputStream, new File("stdout"), conf)
132+
val testOutputStream = new PipedOutputStream()
133+
val testInputStream = new PipedInputStream(testOutputStream)
134+
val appender = FileAppender(testInputStream, testFile, conf)
134135
assert(appender.isInstanceOf[ExpectedAppender])
135136
assert(appender.getClass.getSimpleName ===
136137
classTag[ExpectedAppender].runtimeClass.getSimpleName)
@@ -144,7 +145,8 @@ class FileAppenderSuite extends FunSuite with BeforeAndAfter with Logging {
144145
}
145146
assert(policyParam === expectedRollingPolicyParam)
146147
}
147-
appender
148+
testOutputStream.close()
149+
appender.awaitTermination()
148150
}
149151

150152
import RollingFileAppender._

0 commit comments

Comments
 (0)