Github user vanzin commented on a diff in the pull request: https://github.com/apache/spark/pull/5664#discussion_r29176745 --- Diff: core/src/test/scala/org/apache/spark/ui/UISuite.scala --- @@ -101,6 +125,25 @@ class UISuite extends FunSuite { } } + test("jetty with https binds to port 0 correctly") { + val sparkConf = new SparkConf() + .set("spark.ui.https.enabled", "false") + .set("spark.ui.https.keyStore", "./src/test/resources/spark.keystore") + .set("spark.ui.https.keyStorePassword", "123456") + .set("spark.ui.https.keyPassword", "123456") + val serverInfo = JettyUtils.startJettyServer( + "0.0.0.0", 0, Seq[ServletContextHandler](), sparkConf) + val server = serverInfo.server + val boundPort = serverInfo.boundPort + assert(server.getState === "STARTED") + assert(boundPort != 0) + Try { new ServerSocket(boundPort) } match { --- End diff -- Using `intercept` here might be cleaner. And in case of failure, you need to close the server socket you're creating.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org