You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sr...@apache.org on 2016/08/09 08:45:47 UTC
spark git commit: [SPARK-16940][SQL] `checkAnswer` should raise
`TestFailedException` for wrong results
Repository: spark
Updated Branches:
refs/heads/master af710e5bd -> 2154345b6
[SPARK-16940][SQL] `checkAnswer` should raise `TestFailedException` for wrong results
## What changes were proposed in this pull request?
This PR fixes the following to make `checkAnswer` raise `TestFailedException` again instead of `java.util.NoSuchElementException: key not found: TZ` in the environments without `TZ` variable. Also, this PR adds `QueryTestSuite` class for testing `QueryTest` itself.
```scala
- |Timezone Env: ${sys.env("TZ")}
+ |Timezone Env: ${sys.env.getOrElse("TZ", "")}
```
## How was this patch tested?
Pass the Jenkins tests with a new test suite.
Author: Dongjoon Hyun <do...@apache.org>
Closes #14528 from dongjoon-hyun/SPARK-16940.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/2154345b
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/2154345b
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/2154345b
Branch: refs/heads/master
Commit: 2154345b6a1cb193b1380ab386912e478928c6b2
Parents: af710e5
Author: Dongjoon Hyun <do...@apache.org>
Authored: Tue Aug 9 09:45:46 2016 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Tue Aug 9 09:45:46 2016 +0100
----------------------------------------------------------------------
.../src/test/scala/org/apache/spark/sql/QueryTest.scala | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/2154345b/sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala b/sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala
index 3437586..304881d 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala
@@ -402,7 +402,7 @@ object QueryTest {
s"""
|Results do not match for query:
|Timezone: ${TimeZone.getDefault}
- |Timezone Env: ${sys.env("TZ")}
+ |Timezone Env: ${sys.env.getOrElse("TZ", "")}
|
|${df.queryExecution}
|== Results ==
@@ -483,3 +483,11 @@ object QueryTest {
}
}
}
+
+class QueryTestSuite extends QueryTest with test.SharedSQLContext {
+ test("SPARK-16940: checkAnswer should raise TestFailedException for wrong results") {
+ intercept[org.scalatest.exceptions.TestFailedException] {
+ checkAnswer(sql("SELECT 1"), Row(2) :: Nil)
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org