Skip to content

Commit

Permalink
Changed integration tests to start from a star topology
Browse files Browse the repository at this point in the history
  • Loading branch information
phearnot committed Aug 28, 2017
1 parent 192b542 commit 32ab5dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/it/resources/template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ waves {
network {
known-peers = []
black-list-residence-time = 30s
peers-broadcast-interval = 5s
peers-broadcast-interval = 2s
connection-timeout = 30s
}
blockchain {
Expand Down
8 changes: 5 additions & 3 deletions src/it/scala/com/wavesplatform/it/Docker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ class Docker(suiteConfig: Config = ConfigFactory.empty) extends AutoCloseable wi

private val client = DefaultDockerClient.fromEnv().build()
private var nodes = Map.empty[String, Node]
private var seedAddress = Option.empty[String]
private val isStopped = new AtomicBoolean(false)

sys.addShutdownHook {
close()
}

private def knownPeers = nodes.values.zipWithIndex.map {
case (n, index) => s"-Dwaves.network.known-peers.$index=${n.nodeInfo.networkIpAddress}:${n.nodeInfo.containerNetworkPort}"
} mkString " "
private def knownPeers = seedAddress.fold("")(sa => s"-Dwaves.network.known-peers.0=$sa")

private val networkName = "waves-" + this.##.toLong.toHexString

Expand Down Expand Up @@ -100,6 +99,9 @@ class Docker(suiteConfig: Config = ConfigFactory.empty) extends AutoCloseable wi
containerId,
extractHostPort(ports, matcherApiPort))
val node = new Node(actualConfig, nodeInfo, http)
if (seedAddress.isEmpty) {
seedAddress = Some(s"${nodeInfo.networkIpAddress}:${nodeInfo.containerNetworkPort}")
}
nodes += containerId -> node
Await.result(node.lastBlock, Duration.Inf)
node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.net.InetSocketAddress
import java.util.concurrent.ConcurrentHashMap

import com.wavesplatform.Version
import com.wavesplatform.network.{Handshake, HandshakeHandler, PeerInfo, PeerKey}
import com.wavesplatform.network.{Handshake, HandshakeHandler, PeerInfo}
import com.wavesplatform.settings._
import io.netty.bootstrap.Bootstrap
import io.netty.channel._
Expand All @@ -27,12 +27,9 @@ class NetworkClient(
Handshake(Constants.ApplicationName + chainId, Version.VersionTuple, nodeName,
nonce, None)

private val peerUniqueness = new ConcurrentHashMap[PeerKey, Channel]()

private val channels = new ConcurrentHashMap[InetSocketAddress, Channel]

private val clientHandshakeHandler =
new HandshakeHandler.Client(handshake, peerInfo, peerUniqueness, NopPeerDatabase)
private val clientHandshakeHandler = new HandshakeHandler.Client(handshake, peerInfo, NopPeerDatabase)

private val bootstrap = new Bootstrap()
.group(workerGroup)
Expand Down

0 comments on commit 32ab5dc

Please sign in to comment.