Shekharrajak commented on code in PR #56639:
URL: https://github.com/apache/spark/pull/56639#discussion_r3468718456


##########
sql/connect/server/src/test/scala/org/apache/spark/sql/connect/service/SparkConnectServiceInternalServerSuite.scala:
##########
@@ -261,6 +265,42 @@ class SparkConnectServiceInternalServerSuite extends 
SparkFunSuite with LocalSpa
     endEventSignal.acquire()
   }
 
+  test("The SparkConnectService exposes standard gRPC health checks") {
+    val conf = new SparkConf()
+      .setAppName(getClass().getName())
+      .set(SparkLauncher.SPARK_MASTER, "local[1]")
+    sc = new SparkContext(conf)
+
+    withSparkEnvConfs((CONNECT_GRPC_BINDING_PORT.key, "0")) {
+      SparkConnectService.start(sc)
+    }
+
+    val channel = ManagedChannelBuilder
+      .forAddress("localhost", SparkConnectService.server.getPort)
+      .usePlaintext()
+      .build()
+    try {
+      val healthStub = HealthGrpc.newBlockingStub(channel)
+
+      val overallStatus = healthStub
+        .check(HealthCheckRequest.newBuilder().build())
+        .getStatus
+      assert(overallStatus == HealthCheckResponse.ServingStatus.SERVING)
+
+      val sparkConnectStatus = healthStub
+        .check(
+          HealthCheckRequest
+            .newBuilder()
+            .setService(SparkConnectServiceGrpc.SERVICE_NAME)
+            .build())
+        .getStatus
+      assert(sparkConnectStatus == HealthCheckResponse.ServingStatus.SERVING)
+    } finally {
+      channel.shutdownNow()
+      SparkConnectService.stop()

Review Comment:
   added channel.awaitTermination(10, TimeUnit.SECONDS) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to