aboutsummaryrefslogtreecommitdiff
path: root/sql/hive-thriftserver
diff options
context:
space:
mode:
authorwm624@hotmail.com <wm624@hotmail.com>2016-11-10 10:54:36 +0000
committerSean Owen <sowen@cloudera.com>2016-11-10 10:54:36 +0000
commit22a9d064e95af71f757113f1869f754cc862df35 (patch)
tree84ef9a282f54df6be1e44642863db65d2f4f8512 /sql/hive-thriftserver
parent96a59109a912db9d5f6fc07dedd9d8a3eee97b96 (diff)
downloadspark-22a9d064e95af71f757113f1869f754cc862df35.tar.gz
spark-22a9d064e95af71f757113f1869f754cc862df35.tar.bz2
spark-22a9d064e95af71f757113f1869f754cc862df35.zip
[SPARK-14914][CORE] Fix Resource not closed after using, for unit tests and example
## What changes were proposed in this pull request? This is a follow-up work of #15618. Close file source; For any newly created streaming context outside the withContext, explicitly close the context. ## How was this patch tested? Existing unit tests. Author: wm624@hotmail.com <wm624@hotmail.com> Closes #15818 from wangmiao1981/rtest.
Diffstat (limited to 'sql/hive-thriftserver')
-rw-r--r--sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2Suites.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2Suites.scala b/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2Suites.scala
index 8f2c4fafa0..5d20ec958c 100644
--- a/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2Suites.scala
+++ b/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2Suites.scala
@@ -609,7 +609,12 @@ class HiveThriftBinaryServerSuite extends HiveThriftJdbcTest {
test("SPARK-11043 check operation log root directory") {
val expectedLine =
"Operation log root directory is created: " + operationLogPath.getAbsoluteFile
- assert(Source.fromFile(logPath).getLines().exists(_.contains(expectedLine)))
+ val bufferSrc = Source.fromFile(logPath)
+ Utils.tryWithSafeFinally {
+ assert(bufferSrc.getLines().exists(_.contains(expectedLine)))
+ } {
+ bufferSrc.close()
+ }
}
}