Github user aarondav commented on a diff in the pull request:
https://github.com/apache/spark/pull/5575#discussion_r28721339
--- Diff:
core/src/test/scala/org/apache/spark/network/netty/NettyBlockTransferServiceSuite.scala
---
@@ -0,0 +1,78 @@
+/*
+ * 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.network.netty
+
+import org.apache.spark.network.BlockDataManager
+import org.apache.spark.{SecurityManager, SparkConf}
+import org.mockito.Mockito.mock
+import org.scalatest._
+
+class NettyBlockTransferServiceSuite extends FunSuite with
BeforeAndAfterEach with ShouldMatchers {
+ private var service0: NettyBlockTransferService = _
+ private var service1: NettyBlockTransferService = _
+
+ override def afterEach() {
+ if (service0 != null) {
+ service0.close()
+ service0 = null
+ }
+
+ if (service1 != null) {
+ service1.close()
+ service1 = null
+ }
+ }
+
+ test("can bind to a random port") {
+ service0 = createService(port = 0)
+ service0.port should not be 0
+ }
+
+ test("can bind to two random ports") {
+ service0 = createService(port = 0)
+ service1 = createService(port = 0)
+ service0.port should not be service1.port
+ }
+
+ test("can bind to a specific port") {
+ val port = 17634
+ service0 = createService(port)
+ service0.port should be >= port
+ service0.port should be <= (port + 10) // avoid testing equality in
case of simultaneous tests
--- End diff --
I can increase the number no problem, though I guess we should use
`Utils.portMaxRetries` instead. However, note that even 10 should be very
unlikely to be hit, that would mean there's 5-10 concurrently running tests at
this exact part of the build, or else we're very, very unlucky.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]