1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-22 14:22:39 +01:00

Make Electrum tests pass on windows (#932)

There was an obscure Docker error when trying to start an Electrum
server in tests. [1]

It appears that there is a conflict between Docker and Hyper-V on some
range of ports.

A workaround is to just change the port we were using.

[1] https://github.com/docker/for-win/issues/3171
This commit is contained in:
Pierre-Marie Padiou 2019-04-04 11:38:11 +02:00 committed by GitHub
parent 2aa088e0e6
commit fa5d0235cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -88,7 +88,7 @@ class ElectrumWalletSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
} }
test("wait until wallet is ready") { test("wait until wallet is ready") {
electrumClient = system.actorOf(Props(new ElectrumClientPool(Set(ElectrumServerAddress(new InetSocketAddress("localhost", 50001), SSL.OFF))))) electrumClient = system.actorOf(Props(new ElectrumClientPool(Set(ElectrumServerAddress(new InetSocketAddress("localhost", electrumPort), SSL.OFF)))))
wallet = system.actorOf(Props(new ElectrumWallet(seed, electrumClient, WalletParameters(Block.RegtestGenesisBlock.hash, new SqliteWalletDb(DriverManager.getConnection("jdbc:sqlite::memory:")), minimumFee = Satoshi(5000)))), "wallet") wallet = system.actorOf(Props(new ElectrumWallet(seed, electrumClient, WalletParameters(Block.RegtestGenesisBlock.hash, new SqliteWalletDb(DriverManager.getConnection("jdbc:sqlite::memory:")), minimumFee = Satoshi(5000)))), "wallet")
val probe = TestProbe() val probe = TestProbe()
awaitCond({ awaitCond({

View file

@ -50,7 +50,7 @@ class ElectrumWatcherSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
TestKit.shutdownActorSystem(system) TestKit.shutdownActorSystem(system)
} }
val electrumAddress = ElectrumServerAddress(new InetSocketAddress("localhost", 50001), SSL.OFF) val electrumAddress = ElectrumServerAddress(new InetSocketAddress("localhost", electrumPort), SSL.OFF)
test("watch for confirmed transactions") { test("watch for confirmed transactions") {
val probe = TestProbe() val probe = TestProbe()

View file

@ -25,19 +25,21 @@ import org.scalatest.Suite
trait ElectrumxService extends DockerTestKit { trait ElectrumxService extends DockerTestKit {
self: Suite => self: Suite =>
val electrumPort = 47000
val electrumxContainer = if (System.getProperty("os.name").startsWith("Linux")) { val electrumxContainer = if (System.getProperty("os.name").startsWith("Linux")) {
// "host" mode will let the container access the host network on linux // "host" mode will let the container access the host network on linux
// we use our own docker image because other images on Docker lag behind and don't yet support 1.4 // we use our own docker image because other images on Docker lag behind and don't yet support 1.4
DockerContainer("acinq/electrumx") DockerContainer("acinq/electrumx")
.withNetworkMode("host") .withNetworkMode("host")
.withEnv("DAEMON_URL=http://foo:bar@localhost:28332", "COIN=BitcoinSegwit", "NET=regtest") .withEnv("DAEMON_URL=http://foo:bar@localhost:28332", "COIN=BitcoinSegwit", "NET=regtest", s"TCP_PORT=$electrumPort")
//.withLogLineReceiver(LogLineReceiver(true, println)) //.withLogLineReceiver(LogLineReceiver(true, println))
} else { } else {
// on windows or oxs, host mode is not available, but from docker 18.03 on host.docker.internal can be used instead // on windows or oxs, host mode is not available, but from docker 18.03 on host.docker.internal can be used instead
// host.docker.internal is not (yet ?) available on linux though // host.docker.internal is not (yet ?) available on linux though
DockerContainer("acinq/electrumx") DockerContainer("acinq/electrumx")
.withPorts(50001 -> Some(50001)) .withPorts(electrumPort -> Some(electrumPort))
.withEnv("DAEMON_URL=http://foo:bar@host.docker.internal:28332", "COIN=BitcoinSegwit", "NET=regtest", "TCP_PORT=50001") .withEnv("DAEMON_URL=http://foo:bar@host.docker.internal:28332", "COIN=BitcoinSegwit", "NET=regtest", s"TCP_PORT=$electrumPort")
//.withLogLineReceiver(LogLineReceiver(true, println)) //.withLogLineReceiver(LogLineReceiver(true, println))
} }