Github user vanzin commented on a diff in the pull request: https://github.com/apache/spark/pull/5664#discussion_r29176597 --- Diff: core/src/test/scala/org/apache/spark/ui/UISuite.scala --- @@ -88,6 +88,30 @@ class UISuite extends FunSuite { server.close() } + test("jetty with https selects different port under contention") { + val server = new ServerSocket(0) + val startPort = server.getLocalPort + + val sparkConf = new SparkConf() + .set("spark.ui.https.enabled", "true") + .set("spark.ui.https.keyStore", "./src/test/resources/spark.keystore") + .set("spark.ui.https.keyStorePassword", "123456") + .set("spark.ui.https.keyPassword", "123456") + val serverInfo1 = JettyUtils.startJettyServer( + "0.0.0.0", startPort, Seq[ServletContextHandler](), sparkConf, "server1") + val serverInfo2 = JettyUtils.startJettyServer( + "0.0.0.0", startPort, Seq[ServletContextHandler](), sparkConf, "server2") + // Allow some wiggle room in case ports on the machine are under contention + val boundPort1 = serverInfo1.boundPort + val boundPort2 = serverInfo2.boundPort + assert(boundPort1 != startPort) + assert(boundPort2 != startPort) + assert(boundPort1 != boundPort2) + serverInfo1.server.stop() --- End diff -- All these `stop` calls should be in a `finally` block.
--- 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