spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkbrad...@apache.org
Subject spark git commit: [SPARK-23728][BRANCH-2.3] Fix ML tests with expected exceptions running streaming tests
Date Mon, 19 Mar 2018 17:42:16 GMT
Repository: spark
Updated Branches:
  refs/heads/branch-2.3 80e79430f -> 920493949


[SPARK-23728][BRANCH-2.3] Fix ML tests with expected exceptions running streaming tests

## What changes were proposed in this pull request?

The testTransformerByInterceptingException failed to catch the expected message on 2.3 during
streaming tests as the feature generated message is not at the direct caused by exception
but even one level deeper.

## How was this patch tested?

Running the unit tests.

Author: “attilapiros” <piros.attila.zsolt@gmail.com>

Closes #20852 from attilapiros/SPARK-23728.


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

Branch: refs/heads/branch-2.3
Commit: 920493949eba77befd67e32f9e6ede5d594bcd56
Parents: 80e7943
Author: “attilapiros” <piros.attila.zsolt@gmail.com>
Authored: Mon Mar 19 10:42:12 2018 -0700
Committer: Joseph K. Bradley <joseph@databricks.com>
Committed: Mon Mar 19 10:42:12 2018 -0700

----------------------------------------------------------------------
 .../src/test/scala/org/apache/spark/ml/util/MLTest.scala  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/92049394/mllib/src/test/scala/org/apache/spark/ml/util/MLTest.scala
----------------------------------------------------------------------
diff --git a/mllib/src/test/scala/org/apache/spark/ml/util/MLTest.scala b/mllib/src/test/scala/org/apache/spark/ml/util/MLTest.scala
index 795fd0e..23e05ac 100644
--- a/mllib/src/test/scala/org/apache/spark/ml/util/MLTest.scala
+++ b/mllib/src/test/scala/org/apache/spark/ml/util/MLTest.scala
@@ -119,9 +119,15 @@ trait MLTest extends StreamTest with TempDirectory { self: Suite =>
     expectedMessagePart : String,
     firstResultCol: String) {
 
+    def hasExpectedMessageDirectly(exception: Throwable): Boolean =
+      exception.getMessage.contains(expectedMessagePart)
+
     def hasExpectedMessage(exception: Throwable): Boolean =
-      exception.getMessage.contains(expectedMessagePart) ||
-        (exception.getCause != null && exception.getCause.getMessage.contains(expectedMessagePart))
+      hasExpectedMessageDirectly(exception) || (
+        exception.getCause != null && (
+          hasExpectedMessageDirectly(exception.getCause) || (
+            exception.getCause.getCause != null &&
+            hasExpectedMessageDirectly(exception.getCause.getCause))))
 
     withClue(s"""Expected message part "${expectedMessagePart}" is not found in DF test.""")
{
       val exceptionOnDf = intercept[Throwable] {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message