mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
Use Await.result() in DataMessageHandlerTest to avoid test cases that never complete (#5159)
This commit is contained in:
parent
2032b16620
commit
878dce7945
@ -20,7 +20,7 @@ import org.bitcoins.testkit.node.fixture.NeutrinoNodeConnectedWithBitcoind
|
|||||||
import org.scalatest.{FutureOutcome, Outcome}
|
import org.scalatest.{FutureOutcome, Outcome}
|
||||||
|
|
||||||
import scala.concurrent.duration.DurationInt
|
import scala.concurrent.duration.DurationInt
|
||||||
import scala.concurrent.{Future, Promise}
|
import scala.concurrent.{Await, Future, Promise}
|
||||||
|
|
||||||
class DataMessageHandlerTest extends NodeTestWithCachedBitcoindNewest {
|
class DataMessageHandlerTest extends NodeTestWithCachedBitcoindNewest {
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class DataMessageHandlerTest extends NodeTestWithCachedBitcoindNewest {
|
|||||||
|
|
||||||
for {
|
for {
|
||||||
hash <- bitcoind.generateToAddress(blocks = 1, junkAddress).map(_.head)
|
hash <- bitcoind.generateToAddress(blocks = 1, junkAddress).map(_.head)
|
||||||
result <- resultP.future
|
result = Await.result(resultP.future, 30.seconds)
|
||||||
} yield assert(result.blockHeader.hashBE == hash)
|
} yield assert(result.blockHeader.hashBE == hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ class DataMessageHandlerTest extends NodeTestWithCachedBitcoindNewest {
|
|||||||
_ = node.nodeAppConfig.addCallbacks(nodeCallbacks)
|
_ = node.nodeAppConfig.addCallbacks(nodeCallbacks)
|
||||||
hash <- bitcoind.generateToAddress(blocks = 1, junkAddress).map(_.head)
|
hash <- bitcoind.generateToAddress(blocks = 1, junkAddress).map(_.head)
|
||||||
header <- bitcoind.getBlockHeaderRaw(hash)
|
header <- bitcoind.getBlockHeaderRaw(hash)
|
||||||
result <- resultP.future
|
result = Await.result(resultP.future, 30.seconds)
|
||||||
} yield assert(result == Vector(header))
|
} yield assert(result == Vector(header))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ class DataMessageHandlerTest extends NodeTestWithCachedBitcoindNewest {
|
|||||||
_ <- AsyncUtil.nonBlockingSleep(2.seconds)
|
_ <- AsyncUtil.nonBlockingSleep(2.seconds)
|
||||||
hash <- bitcoind.generateToAddress(blocks = 1, junkAddress).map(_.head)
|
hash <- bitcoind.generateToAddress(blocks = 1, junkAddress).map(_.head)
|
||||||
filter <- bitcoind.getBlockFilter(hash, FilterType.Basic)
|
filter <- bitcoind.getBlockFilter(hash, FilterType.Basic)
|
||||||
result <- resultP.future
|
result = Await.result(resultP.future, 30.seconds)
|
||||||
} yield assert(result == Vector((hash.flip, filter.filter)))
|
} yield assert(result == Vector((hash.flip, filter.filter)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ class DataMessageHandlerTest extends NodeTestWithCachedBitcoindNewest {
|
|||||||
_ = node.nodeAppConfig.addCallbacks(nodeCallbacks)
|
_ = node.nodeAppConfig.addCallbacks(nodeCallbacks)
|
||||||
txId <- bitcoind.sendToAddress(junkAddress, 1.bitcoin)
|
txId <- bitcoind.sendToAddress(junkAddress, 1.bitcoin)
|
||||||
tx <- bitcoind.getRawTransactionRaw(txId)
|
tx <- bitcoind.getRawTransactionRaw(txId)
|
||||||
result <- resultP.future
|
result = Await.result(resultP.future, 30.seconds)
|
||||||
} yield assert(result == tx)
|
} yield assert(result == tx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user