mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-18 21:34:39 +01:00
CI fixes (#3597)
* CI fixes * fix workflow names * cleanup unused code * fix ServerRunTest * change number attempts to start Node
This commit is contained in:
parent
479f8e249c
commit
4ef1e6bcb6
@ -1,4 +1,4 @@
|
||||
name: Linux 2.12 App, Chain, Node, and Core Tests
|
||||
name: Linux 2.12 App, Chain, and Core Tests
|
||||
env:
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
||||
|
||||
@ -28,4 +28,4 @@ jobs:
|
||||
~/.bitcoin-s/binaries
|
||||
key: ${{ runner.os }}-cache
|
||||
- name: run tests
|
||||
run: sbt ++2.12.14 downloadBitcoind coverage chainTest/test chain/coverageReport chain/coverageAggregate chain/coveralls nodeTest/test node/coverageReport node/coverageAggregate node/coveralls cryptoJVM/test cryptoTestJVM/test cryptoJVM/coverageReport cryptoJVM/coverageAggregate cryptoJVM/coveralls coreTestJVM/test dlcTest/test coreJVM/coverageReport coreJVM/coverageAggregate coreJVM/coveralls secp256k1jni/test zmq/test zmq/coverageReport zmq/coverageAggregate zmq/coveralls appCommonsTest/test appServerTest/test oracleServerTest/test dlcNodeTest/test
|
||||
run: sbt ++2.12.14 downloadBitcoind coverage chainTest/test chain/coverageReport chain/coverageAggregate chain/coveralls cryptoJVM/test cryptoTestJVM/test cryptoJVM/coverageReport cryptoJVM/coverageAggregate cryptoJVM/coveralls coreTestJVM/test dlcTest/test coreJVM/coverageReport coreJVM/coverageAggregate coreJVM/coveralls secp256k1jni/test zmq/test zmq/coverageReport zmq/coverageAggregate zmq/coveralls appCommonsTest/test appServerTest/test oracleServerTest/test
|
31
.github/workflows/Linux_2.12_Node_Tests.yml
vendored
Normal file
31
.github/workflows/Linux_2.12_Node_Tests.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: Linux 2.12 Node Tests
|
||||
env:
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
if: "! contains(github.event.pull_request.labels.*.name, 'documentation')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Scala
|
||||
uses: olafurpg/setup-scala@v10
|
||||
with:
|
||||
java-version: zulu@1.11
|
||||
- name: Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.ivy2/cache
|
||||
~/.sbt
|
||||
~/.bitcoin-s/binaries
|
||||
key: ${{ runner.os }}-cache
|
||||
- name: run tests
|
||||
run: sbt ++2.12.14 downloadBitcoind coverage nodeTest/test node/coverageReport node/coverageAggregate node/coveralls dlcNodeTest/test
|
@ -1,4 +1,4 @@
|
||||
name: Linux 2.13 App, Chain, Node, and Core Tests
|
||||
name: Linux 2.13 App, Chain, and Core Tests
|
||||
env:
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
||||
|
||||
@ -28,4 +28,4 @@ jobs:
|
||||
~/.bitcoin-s/binaries
|
||||
key: ${{ runner.os }}-cache
|
||||
- name: run tests
|
||||
run: sbt ++2.13.6 downloadBitcoind coverage chainTest/test chain/coverageReport chain/coverageAggregate chain/coveralls nodeTest/test node/coverageReport node/coverageAggregate node/coveralls cryptoTestJVM/test cryptoJVM/test cryptoJVM/coverageReport cryptoJVM/coverageAggregate cryptoJVM/coveralls coreTestJVM/test dlcTest/test coreJVM/coverageReport coreJVM/coverageAggregate coreJVM/coveralls secp256k1jni/test zmq/test zmq/coverageReport zmq/coverageAggregate zmq/coveralls appCommonsTest/test appServerTest/test oracleServerTest/test dlcNodeTest/test
|
||||
run: sbt ++2.13.6 downloadBitcoind coverage chainTest/test chain/coverageReport chain/coverageAggregate chain/coveralls cryptoTestJVM/test cryptoJVM/test cryptoJVM/coverageReport cryptoJVM/coverageAggregate cryptoJVM/coveralls coreTestJVM/test dlcTest/test coreJVM/coverageReport coreJVM/coverageAggregate coreJVM/coveralls secp256k1jni/test zmq/test zmq/coverageReport zmq/coverageAggregate zmq/coveralls appCommonsTest/test appServerTest/test oracleServerTest/test
|
31
.github/workflows/Linux_2.13_Node_Tests.yml
vendored
Normal file
31
.github/workflows/Linux_2.13_Node_Tests.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: Linux 2.13 Node Tests
|
||||
env:
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
if: "! contains(github.event.pull_request.labels.*.name, 'documentation')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Scala
|
||||
uses: olafurpg/setup-scala@v10
|
||||
with:
|
||||
java-version: zulu@1.11
|
||||
- name: Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.ivy2/cache
|
||||
~/.sbt
|
||||
~/.bitcoin-s/binaries
|
||||
key: ${{ runner.os }}-cache
|
||||
- name: run tests
|
||||
run: sbt ++2.13.6 downloadBitcoind coverage nodeTest/test node/coverageReport node/coverageAggregate node/coveralls dlcNodeTest/test
|
@ -1,6 +1,5 @@
|
||||
package org.bitcoins.node.networking
|
||||
|
||||
import akka.io.Tcp
|
||||
import akka.testkit.{TestActorRef, TestProbe}
|
||||
import org.bitcoins.core.config.TestNet3
|
||||
import org.bitcoins.core.number.{Int32, UInt32, UInt64}
|
||||
@ -201,7 +200,7 @@ class P2PClientTest
|
||||
isConnectedF.flatMap { _ =>
|
||||
val isDisconnectedF = for {
|
||||
p2pClient <- p2pClientF
|
||||
_ = p2pClient.actor ! Tcp.Abort
|
||||
_ = p2pClient.actor ! P2PClient.CloseCommand
|
||||
isDisconnected <-
|
||||
TestAsyncUtil.retryUntilSatisfiedF(p2pClient.isDisconnected,
|
||||
interval = 1.second,
|
||||
|
@ -170,7 +170,6 @@ trait Node extends NodeApi with ChainQueryApi with P2PLogger {
|
||||
isInitializedF.failed.foreach { err =>
|
||||
logger.error(
|
||||
s"Failed to connect with peer=${peers(idx)} with err=$err")
|
||||
sys.exit(-1)
|
||||
}
|
||||
isInitializedF.map { _ =>
|
||||
nodeAppConfig.nodeType match {
|
||||
|
@ -70,6 +70,8 @@ case class P2PClientActor(
|
||||
extends Actor
|
||||
with P2PLogger {
|
||||
|
||||
private case object ReconnectCommand extends NodeCommand
|
||||
|
||||
private var currentPeerMsgHandlerRecv = initPeerMsgHandlerReceiver
|
||||
|
||||
private var reconnectHandlerOpt: Option[() => Future[Unit]] = None
|
||||
@ -105,12 +107,15 @@ case class P2PClientActor(
|
||||
case payload: NetworkPayload =>
|
||||
val networkMsg = NetworkMessage(network, payload)
|
||||
self.forward(networkMsg)
|
||||
case message: Tcp.Message =>
|
||||
case message: Tcp.Event =>
|
||||
val newUnalignedBytes =
|
||||
handleTcpMessage(message, peerConnection, unalignedBytes)
|
||||
handleEvent(message, peerConnection, unalignedBytes)
|
||||
context.become(awaitNetworkRequest(peerConnection, newUnalignedBytes))
|
||||
case nodeCommand: NodeCommand =>
|
||||
handleNodeCommand(nodeCommand, Some(peerConnection))
|
||||
case P2PClient.CloseCommand =>
|
||||
logger.info(s"disconnecting from peer $peer")
|
||||
currentPeerMsgHandlerRecv =
|
||||
currentPeerMsgHandlerRecv.initializeDisconnect()
|
||||
peerConnection ! Tcp.Close
|
||||
case metaMsg: P2PClient.MetaMsg =>
|
||||
sender() ! handleMetaMsg(metaMsg)
|
||||
case Terminated(actor) if actor == peerConnection =>
|
||||
@ -119,13 +124,13 @@ case class P2PClientActor(
|
||||
|
||||
override def receive: Receive = LoggingReceive {
|
||||
case P2PClient.ConnectCommand =>
|
||||
handleNodeCommand(P2PClient.ConnectCommand, None)
|
||||
connect()
|
||||
case metaMsg: P2PClient.MetaMsg =>
|
||||
sender() ! handleMetaMsgDisconnected(metaMsg)
|
||||
}
|
||||
|
||||
def reconnecting: Receive = LoggingReceive {
|
||||
case P2PClient.ReconnectCommand =>
|
||||
case ReconnectCommand =>
|
||||
logger.info(s"reconnecting to ${peer.socket}")
|
||||
reconnectHandlerOpt = Some(onReconnect)
|
||||
connect()
|
||||
@ -242,32 +247,13 @@ case class P2PClientActor(
|
||||
reconnectionTry = reconnectionTry + 1
|
||||
|
||||
import context.dispatcher
|
||||
context.system.scheduler.scheduleOnce(delay)(
|
||||
self ! P2PClient.ReconnectCommand)
|
||||
context.system.scheduler.scheduleOnce(delay)(self ! ReconnectCommand)
|
||||
|
||||
context.become(reconnecting)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Handles boiler plate [[Tcp.Message]] types.
|
||||
*
|
||||
* @return the unaligned bytes if we haven't received a full Bitcoin P2P message yet
|
||||
*/
|
||||
private def handleTcpMessage(
|
||||
message: Tcp.Message,
|
||||
peerConnection: ActorRef,
|
||||
unalignedBytes: ByteVector): ByteVector = {
|
||||
message match {
|
||||
case event: Tcp.Event =>
|
||||
handleEvent(event, peerConnection, unalignedBytes = unalignedBytes)
|
||||
case command: Tcp.Command =>
|
||||
handleCommand(command, peerConnection)
|
||||
|
||||
unalignedBytes
|
||||
}
|
||||
}
|
||||
|
||||
/** This function is responsible for handling a [[Tcp.Event]] algebraic data type
|
||||
*/
|
||||
private def handleEvent(
|
||||
@ -369,20 +355,6 @@ case class P2PClientActor(
|
||||
}
|
||||
}
|
||||
|
||||
/** This function is responsible for handling a [[Tcp.Command]] algebraic data type
|
||||
*/
|
||||
private def handleCommand(
|
||||
command: Tcp.Command,
|
||||
peerConnection: ActorRef): Unit =
|
||||
command match {
|
||||
case closeCmd @ (Tcp.ConfirmedClose | Tcp.Close | Tcp.Abort) =>
|
||||
peerConnection ! closeCmd
|
||||
case connectCmd: Tcp.Connect =>
|
||||
manager ! connectCmd
|
||||
case bind: Tcp.Bind =>
|
||||
manager ! bind
|
||||
}
|
||||
|
||||
/** Returns the current state of our peer given the [[P2PClient.MetaMsg meta message]]
|
||||
*/
|
||||
private def handleMetaMsg(metaMsg: P2PClient.MetaMsg): Boolean = {
|
||||
@ -412,20 +384,6 @@ case class P2PClientActor(
|
||||
peerConnection ! Tcp.ResumeReading
|
||||
}
|
||||
|
||||
private def handleNodeCommand(
|
||||
command: NodeCommand,
|
||||
peerConnectionOpt: Option[ActorRef]): Unit = command match {
|
||||
case P2PClient.ConnectCommand =>
|
||||
connect()
|
||||
case P2PClient.ReconnectCommand =>
|
||||
reconnect()
|
||||
case P2PClient.CloseCommand =>
|
||||
currentPeerMsgHandlerRecv =
|
||||
currentPeerMsgHandlerRecv.initializeDisconnect()
|
||||
peerConnectionOpt.map(actor => actor.tell(Tcp.Close, self))
|
||||
()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case class P2PClient(actor: ActorRef, peer: Peer) extends P2PLogger {
|
||||
@ -467,9 +425,6 @@ object P2PClient extends P2PLogger {
|
||||
|
||||
sealed trait NodeCommand
|
||||
case object ConnectCommand extends NodeCommand
|
||||
|
||||
case object ReconnectCommand extends NodeCommand
|
||||
|
||||
case object CloseCommand extends NodeCommand
|
||||
|
||||
/** A message hierarchy that canbe sent to [[P2PClientActor P2P Client Actor]]
|
||||
|
@ -39,7 +39,7 @@ class ZMQSubscriberTest extends AsyncFlatSpec with Logging {
|
||||
//and set the bitcoin.conf file to allow for
|
||||
//zmq connections
|
||||
//see: https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md
|
||||
val socket = new InetSocketAddress("tcp://127.0.0.1", 29000)
|
||||
val socket = new InetSocketAddress("127.0.0.1", 29000)
|
||||
|
||||
val zmqSub =
|
||||
new ZMQSubscriber(socket, None, None, rawTxListener, rawBlockListener)
|
||||
|
Loading…
Reference in New Issue
Block a user