Skip to content

Commit

Permalink
Do not explicitly provide address for ServerSocket in tests (#1766)
Browse files Browse the repository at this point in the history
  • Loading branch information
pm47 authored Apr 14, 2021
1 parent ccae92d commit eb834e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions eclair-core/src/test/scala/fr/acinq/eclair/io/PeerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import org.scalatest.funsuite.FixtureAnyFunSuiteLike
import org.scalatest.{Outcome, ParallelTestExecution, Tag}
import scodec.bits.ByteVector

import java.net.{InetAddress, ServerSocket, Socket}
import java.net.{ServerSocket, Socket}
import java.util.concurrent.Executors
import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, Future}
Expand Down Expand Up @@ -113,7 +113,7 @@ class PeerSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with Paralle
system.actorOf(ClientSpawner.props(nodeParams.keyPair, nodeParams.socksProxy_opt, nodeParams.peerConnectionConf, TestProbe().ref, TestProbe().ref))

// we create a dummy tcp server and update bob's announcement to point to it
val mockServer = new ServerSocket(0, 1, InetAddress.getLocalHost) // port will be assigned automatically
val mockServer = new ServerSocket(0, 1) // port will be assigned automatically
val mockAddress = HostAndPort.fromParts(mockServer.getInetAddress.getHostAddress, mockServer.getLocalPort)

val probe = TestProbe()
Expand All @@ -139,7 +139,7 @@ class PeerSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with Paralle
system.actorOf(ClientSpawner.props(nodeParams.keyPair, nodeParams.socksProxy_opt, nodeParams.peerConnectionConf, TestProbe().ref, TestProbe().ref))

// we create a dummy tcp server and update bob's announcement to point to it
val mockServer = new ServerSocket(0, 1, InetAddress.getLocalHost) // port will be assigned automatically
val mockServer = new ServerSocket(0, 1) // port will be assigned automatically
val mockAddress = NodeAddress.fromParts(mockServer.getInetAddress.getHostAddress, mockServer.getLocalPort).get

// we put the server address in the node db
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import fr.acinq.eclair.wire.protocol.{Color, NodeAddress, NodeAnnouncement}
import org.scalatest.funsuite.FixtureAnyFunSuiteLike
import org.scalatest.{Outcome, ParallelTestExecution, Tag}

import java.net.{InetAddress, ServerSocket}
import java.net.ServerSocket
import scala.concurrent.duration._

class ReconnectionTaskSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with ParallelTestExecution {
Expand Down Expand Up @@ -222,7 +222,7 @@ class ReconnectionTaskSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike
import f._

// we create a dummy tcp server and update bob's announcement to point to it
val mockServer = new ServerSocket(0, 1, InetAddress.getLocalHost) // port will be assigned automatically
val mockServer = new ServerSocket(0, 1) // port will be assigned automatically
val mockAddress = NodeAddress.fromParts(mockServer.getInetAddress.getHostAddress, mockServer.getLocalPort).get
val bobAnnouncement = NodeAnnouncement(randomBytes64, Features.empty, 1, remoteNodeId, Color(100.toByte, 200.toByte, 300.toByte), "node-alias", mockAddress :: Nil)
nodeParams.db.network.addNode(bobAnnouncement)
Expand Down

0 comments on commit eb834e2

Please sign in to comment.