vinodkc commented on code in PR #57202: URL: https://github.com/apache/spark/pull/57202#discussion_r3566925561
########## sql/connect/server/src/test/scala/org/apache/spark/sql/connect/service/SparkConnectServiceKeepAliveSuite.scala: ########## @@ -0,0 +1,268 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.spark.sql.connect.service + +import java.util.UUID +import java.util.concurrent.TimeUnit + +import scala.collection.mutable +import scala.concurrent.duration.FiniteDuration + +import org.scalatest.concurrent.Eventually + +import org.apache.spark.SparkException +import org.apache.spark.sql.connect.SparkConnectServerTest +import org.apache.spark.sql.connect.client.{RetryPolicy, SparkConnectClient} +import org.apache.spark.sql.connect.config.Connect + +/** + * End-to-end test that the *real* `SparkConnectService.startGRPCService()` wiring actually + * applies the configured gRPC keepalive settings (SPARK-58094). + * + * Unlike the tests in `SparkConnectClientSuite` (sql/connect/client/jvm), which hand-build their + * own `NettyServerBuilder` that only mirrors the production server construction, this suite + * starts the real `SparkConnectService` (via `SparkConnectServerTest`) with the keepalive confs + * tuned to short test values, puts a freezable TCP relay in front of it, and confirms a blocked + * client call fails with a keepalive-triggered `UNAVAILABLE` within a bounded time -- so a future + * refactor of `startGRPCService()` that silently drops the keepalive wiring would be caught here, + * not just in the client-side unit tests. + */ +class SparkConnectServiceKeepAliveSuite extends SparkConnectServerTest { Review Comment: Added a test with a client pinging faster (11s) than the server's keepAlive.time (20s) through the real server wiring. Caveat: I couldn't reproduce the old coupled bug failing this test even after reverting locally, so it's solid coverage but not a proven regression guard. -- 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]
