This is an automated email from the ASF dual-hosted git repository.

maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 946ebb9df08 [SPARK-41004][CONNECT][TESTS] Check error classes in 
InterceptorRegistrySuite
946ebb9df08 is described below

commit 946ebb9df080d3d7c86399375c8cc968ff48a01c
Author: panbingkun <pbk1...@gmail.com>
AuthorDate: Fri Nov 4 09:30:30 2022 +0300

    [SPARK-41004][CONNECT][TESTS] Check error classes in 
InterceptorRegistrySuite
    
    ### What changes were proposed in this pull request?
    This PR aims to replace 'intercept' with 'Check error classes' in 
InterceptorRegistrySuite, include:
    1. CONNECT.INTERCEPTOR_CTOR_MISSING
    2. CONNECT.INTERCEPTOR_RUNTIME_ERROR
    
    ### Why are the changes needed?
    The changes improve the error framework.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    By running the modified test suite:
    ```
    $./build/sbt "connect/testOnly *InterceptorRegistrySuite"
    ```
    
    Closes #38494 from panbingkun/CONNECT_TEST.
    
    Authored-by: panbingkun <pbk1...@gmail.com>
    Signed-off-by: Max Gekk <max.g...@gmail.com>
---
 .../connect/service/InterceptorRegistrySuite.scala | 29 +++++++++++++++-------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git 
a/connector/connect/src/test/scala/org/apache/spark/sql/connect/service/InterceptorRegistrySuite.scala
 
b/connector/connect/src/test/scala/org/apache/spark/sql/connect/service/InterceptorRegistrySuite.scala
index bac02ec7af6..fb1b3bb9df1 100644
--- 
a/connector/connect/src/test/scala/org/apache/spark/sql/connect/service/InterceptorRegistrySuite.scala
+++ 
b/connector/connect/src/test/scala/org/apache/spark/sql/connect/service/InterceptorRegistrySuite.scala
@@ -114,9 +114,13 @@ class InterceptorRegistrySuite extends SharedSparkSession {
       Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key ->
         
"org.apache.spark.sql.connect.service.TestingInterceptorNoTrivialCtor") {
       val sb = NettyServerBuilder.forPort(9999)
-      assertThrows[SparkException] {
-        SparkConnectInterceptorRegistry.chainInterceptors(sb)
-      }
+      checkError(
+        exception = intercept[SparkException] {
+          SparkConnectInterceptorRegistry.chainInterceptors(sb)
+        },
+        errorClass = "CONNECT.INTERCEPTOR_CTOR_MISSING",
+        parameters =
+          Map("cls" -> 
"org.apache.spark.sql.connect.service.TestingInterceptorNoTrivialCtor"))
     }
   }
 
@@ -124,17 +128,24 @@ class InterceptorRegistrySuite extends SharedSparkSession 
{
     withSparkConf(
       Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key ->
         
"org.apache.spark.sql.connect.service.TestingInterceptorNoTrivialCtor") {
-      assertThrows[SparkException] {
-        SparkConnectInterceptorRegistry.createConfiguredInterceptors
-      }
+      checkError(
+        exception = intercept[SparkException] {
+          SparkConnectInterceptorRegistry.createConfiguredInterceptors
+        },
+        errorClass = "CONNECT.INTERCEPTOR_CTOR_MISSING",
+        parameters =
+          Map("cls" -> 
"org.apache.spark.sql.connect.service.TestingInterceptorNoTrivialCtor"))
     }
 
     withSparkConf(
       Connect.CONNECT_GRPC_INTERCEPTOR_CLASSES.key ->
         
"org.apache.spark.sql.connect.service.TestingInterceptorInstantiationError") {
-      assertThrows[SparkException] {
-        SparkConnectInterceptorRegistry.createConfiguredInterceptors
-      }
+      checkError(
+        exception = intercept[SparkException] {
+          SparkConnectInterceptorRegistry.createConfiguredInterceptors
+        },
+        errorClass = "CONNECT.INTERCEPTOR_RUNTIME_ERROR",
+        parameters = Map("msg" -> "Bad Error"))
     }
   }
 


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

Reply via email to