Bitcoind spawn tweaks (#221)

* Test for single node creation

* Passes parameters explicitly to bitcoind
This commit is contained in:
Torkel Rogstad 2018-10-17 23:49:40 +02:00 committed by Chris Stewart
parent f4aaa0b2cd
commit fc6498c0fb

View File

@ -3,11 +3,14 @@ package org.bitcoins.rpc
import java.io.File
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import org.bitcoins.core.util.BitcoinSLogger
import org.bitcoins.rpc.client.BitcoindRpcClient
import org.scalatest.{ AsyncFlatSpec, BeforeAndAfterAll }
import scala.concurrent.{ Await, Future }
import scala.concurrent.duration.DurationInt
import scala.util.Success
import scala.util.{ Success, Try }
class RpcUtilTest extends AsyncFlatSpec with BeforeAndAfterAll {
@ -88,6 +91,23 @@ class RpcUtilTest extends AsyncFlatSpec with BeforeAndAfterAll {
assert(!dir.exists)
}
it should "be able to create a single node, wait for it to start and then delete it" in {
implicit val m: ActorMaterializer = ActorMaterializer.create(system)
implicit val ec = m.executionContext
val instance = TestUtil.instance()
val client = new BitcoindRpcClient(instance)
client.start()
RpcUtil.awaitCondition(client.isStarted)
assert(client.isStarted)
client.stop()
RpcUtil.awaitServerShutdown(client)
assert(!client.isStarted)
val t = Try(Await.result(client.getNetworkInfo, 1000.milliseconds))
assert(t.isFailure)
}
"TestUtil" should "be able to create a connected node pair with 100 blocks and then delete them" in {
TestUtil.createNodePair().flatMap {
case (client1, client2) =>