-
- Downloads
[SPARK-17740] Spark tests should mock / interpose HDFS to ensure that streams are closed
## What changes were proposed in this pull request? As a followup to SPARK-17666, ensure filesystem connections are not leaked at least in unit tests. This is done here by intercepting filesystem calls as suggested by JoshRosen . At the end of each test, we assert no filesystem streams are left open. This applies to all tests using SharedSQLContext or SharedSparkContext. ## How was this patch tested? I verified that tests in sql and core are indeed using the filesystem backend, and fixed the detected leaks. I also checked that reverting https://github.com/apache/spark/pull/15245 causes many actual test failures due to connection leaks. Author: Eric Liang <ekl@databricks.com> Author: Eric Liang <ekhliang@gmail.com> Closes #15306 from ericl/sc-4672.
Showing
- core/src/test/scala/org/apache/spark/DebugFilesystem.scala 114 additions, 0 deletionscore/src/test/scala/org/apache/spark/DebugFilesystem.scala
- core/src/test/scala/org/apache/spark/SharedSparkContext.scala 14 additions, 3 deletions.../src/test/scala/org/apache/spark/SharedSparkContext.scala
- sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetEncodingSuite.scala 1 addition, 0 deletions.../execution/datasources/parquet/ParquetEncodingSuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/HDFSMetadataLogSuite.scala 2 additions, 1 deletion.../spark/sql/execution/streaming/HDFSMetadataLogSuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/test/SharedSQLContext.scala 16 additions, 3 deletions...st/scala/org/apache/spark/sql/test/SharedSQLContext.scala
Please register or sign in to comment