Repository: spark
Updated Branches:
  refs/heads/master 387024874 -> 4cbeea83e


SPARK-2158 Clean up core/stdout file from FileAppenderSuite

@tdas

Author: Mark Hamstra <[email protected]>

Closes #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


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/4cbeea83
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/4cbeea83
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/4cbeea83

Branch: refs/heads/master
Commit: 4cbeea83e086bbbb1898bf796a5e5b789bc4cc06
Parents: 3870248
Author: Mark Hamstra <[email protected]>
Authored: Wed Jun 18 14:56:41 2014 -0700
Committer: Tathagata Das <[email protected]>
Committed: Wed Jun 18 14:56:41 2014 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/util/FileAppenderSuite.scala   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/4cbeea83/core/src/test/scala/org/apache/spark/util/FileAppenderSuite.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/util/FileAppenderSuite.scala 
b/core/src/test/scala/org/apache/spark/util/FileAppenderSuite.scala
index 53d7f5c..02e2289 100644
--- a/core/src/test/scala/org/apache/spark/util/FileAppenderSuite.scala
+++ b/core/src/test/scala/org/apache/spark/util/FileAppenderSuite.scala
@@ -120,7 +120,7 @@ class FileAppenderSuite extends FunSuite with 
BeforeAndAfter with Logging {
     // on SparkConf settings.
 
     def testAppenderSelection[ExpectedAppender: ClassTag, 
ExpectedRollingPolicy](
-        properties: Seq[(String, String)], expectedRollingPolicyParam: Long = 
-1): FileAppender = {
+        properties: Seq[(String, String)], expectedRollingPolicyParam: Long = 
-1): Unit = {
 
       // Set spark conf properties
       val conf = new SparkConf
@@ -129,8 +129,9 @@ class FileAppenderSuite extends FunSuite with 
BeforeAndAfter with Logging {
       }
 
       // Create and test file appender
-      val inputStream = new PipedInputStream(new PipedOutputStream())
-      val appender = FileAppender(inputStream, new File("stdout"), conf)
+      val testOutputStream = new PipedOutputStream()
+      val testInputStream = new PipedInputStream(testOutputStream)
+      val appender = FileAppender(testInputStream, testFile, conf)
       assert(appender.isInstanceOf[ExpectedAppender])
       assert(appender.getClass.getSimpleName ===
         classTag[ExpectedAppender].runtimeClass.getSimpleName)
@@ -144,7 +145,8 @@ class FileAppenderSuite extends FunSuite with 
BeforeAndAfter with Logging {
         }
         assert(policyParam === expectedRollingPolicyParam)
       }
-      appender
+      testOutputStream.close()
+      appender.awaitTermination()
     }
 
     import RollingFileAppender._

Reply via email to