This is an automated email from the ASF dual-hosted git repository.
gurwls223 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 e3970cc31af [SPARK-41822][CONNECT][TESTS][FOLLOW-UP] Remove the need
of a fixed port to allow parallel running of tests
e3970cc31af is described below
commit e3970cc31af347c47327748a0d65106622fc2fcd
Author: Zhen Li <[email protected]>
AuthorDate: Mon Jul 3 09:36:34 2023 +0900
[SPARK-41822][CONNECT][TESTS][FOLLOW-UP] Remove the need of a fixed port to
allow parallel running of tests
### What changes were proposed in this pull request?
Reusing the same fixed server port in the tests causes some flakiness of
running tests in parallel. Especially on some systems that it is slow to
recycle ports.
This PR makes the test to not use a fixed port and also to not start a
connection unless it is needed.
### Why are the changes needed?
Small test reliability improvements.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Only test changes.
Closes #41776 from zhenlineo/remove-fixed-port-in-tests.
Authored-by: Zhen Li <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
---
.../sql/connect/client/SparkConnectClientSuite.scala | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git
a/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/client/SparkConnectClientSuite.scala
b/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/client/SparkConnectClientSuite.scala
old mode 100755
new mode 100644
index 7e0b687054d..e9a10e27273
---
a/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/client/SparkConnectClientSuite.scala
+++
b/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/client/SparkConnectClientSuite.scala
@@ -110,9 +110,12 @@ class SparkConnectClientSuite extends ConnectFunSuite with
BeforeAndAfterEach {
}
test("SparkSession initialisation with connection string") {
- val testPort = 16002
- client =
SparkConnectClient.builder().connectionString(s"sc://localhost:$testPort").build()
- startDummyServer(testPort)
+ startDummyServer(0)
+ client = SparkConnectClient
+ .builder()
+ .connectionString(s"sc://localhost:${server.getPort}")
+ .build()
+
val session = SparkSession.builder().client(client).create()
val df = session.range(10)
df.analyze // Trigger RPC
@@ -133,11 +136,17 @@ class SparkConnectClientSuite extends ConnectFunSuite
with BeforeAndAfterEach {
TestPackURI(
"sc://localhost:1234/",
isCorrect = true,
- client => testClientConnection(1234)(_ => client)),
+ client => {
+ assert(client.configuration.host == "localhost")
+ assert(client.configuration.port == 1234)
+ }),
TestPackURI(
"sc://localhost/;",
isCorrect = true,
- client =>
testClientConnection(ConnectCommon.CONNECT_GRPC_BINDING_PORT)(_ => client)),
+ client => {
+ assert(client.configuration.host == "localhost")
+ assert(client.configuration.port ==
ConnectCommon.CONNECT_GRPC_BINDING_PORT)
+ }),
TestPackURI("sc://host:123", isCorrect = true),
TestPackURI(
"sc://host:123/;user_id=a94",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]