fundingmanager tests: run tests in parallel

This commit is contained in:
Johan T. Halseth 2019-07-11 13:14:35 +02:00
parent 452ee6aad4
commit 78da62c6f7
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -682,6 +682,8 @@ func assertErrorSent(t *testing.T, msgChan chan lnwire.Message) {
func assertFundingMsgSent(t *testing.T, msgChan chan lnwire.Message, func assertFundingMsgSent(t *testing.T, msgChan chan lnwire.Message,
msgType string) lnwire.Message { msgType string) lnwire.Message {
t.Helper()
var msg lnwire.Message var msg lnwire.Message
select { select {
case msg = <-msgChan: case msg = <-msgChan:
@ -1037,6 +1039,8 @@ func assertHandleFundingLocked(t *testing.T, alice, bob *testNode) {
} }
func TestFundingManagerNormalWorkflow(t *testing.T) { func TestFundingManagerNormalWorkflow(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1110,6 +1114,8 @@ func TestFundingManagerNormalWorkflow(t *testing.T) {
} }
func TestFundingManagerRestartBehavior(t *testing.T) { func TestFundingManagerRestartBehavior(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1248,6 +1254,8 @@ func TestFundingManagerRestartBehavior(t *testing.T) {
// server to notify when the peer comes online, in case sending the // server to notify when the peer comes online, in case sending the
// fundingLocked message fails the first time. // fundingLocked message fails the first time.
func TestFundingManagerOfflinePeer(t *testing.T) { func TestFundingManagerOfflinePeer(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1382,6 +1390,8 @@ func TestFundingManagerOfflinePeer(t *testing.T) {
// will properly clean up a zombie reservation that times out after the // will properly clean up a zombie reservation that times out after the
// initFundingMsg has been handled. // initFundingMsg has been handled.
func TestFundingManagerPeerTimeoutAfterInitFunding(t *testing.T) { func TestFundingManagerPeerTimeoutAfterInitFunding(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1442,6 +1452,8 @@ func TestFundingManagerPeerTimeoutAfterInitFunding(t *testing.T) {
// will properly clean up a zombie reservation that times out after the // will properly clean up a zombie reservation that times out after the
// fundingOpenMsg has been handled. // fundingOpenMsg has been handled.
func TestFundingManagerPeerTimeoutAfterFundingOpen(t *testing.T) { func TestFundingManagerPeerTimeoutAfterFundingOpen(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1511,6 +1523,8 @@ func TestFundingManagerPeerTimeoutAfterFundingOpen(t *testing.T) {
// will properly clean up a zombie reservation that times out after the // will properly clean up a zombie reservation that times out after the
// fundingAcceptMsg has been handled. // fundingAcceptMsg has been handled.
func TestFundingManagerPeerTimeoutAfterFundingAccept(t *testing.T) { func TestFundingManagerPeerTimeoutAfterFundingAccept(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1585,6 +1599,8 @@ func TestFundingManagerPeerTimeoutAfterFundingAccept(t *testing.T) {
} }
func TestFundingManagerFundingTimeout(t *testing.T) { func TestFundingManagerFundingTimeout(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1629,6 +1645,7 @@ func TestFundingManagerFundingTimeout(t *testing.T) {
// TestFundingManagerFundingNotTimeoutInitiator checks that if the user was // TestFundingManagerFundingNotTimeoutInitiator checks that if the user was
// the channel initiator, that it does not timeout when the lnd restarts. // the channel initiator, that it does not timeout when the lnd restarts.
func TestFundingManagerFundingNotTimeoutInitiator(t *testing.T) { func TestFundingManagerFundingNotTimeoutInitiator(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1697,6 +1714,8 @@ func TestFundingManagerFundingNotTimeoutInitiator(t *testing.T) {
// continues to operate as expected in case we receive a duplicate fundingLocked // continues to operate as expected in case we receive a duplicate fundingLocked
// message. // message.
func TestFundingManagerReceiveFundingLockedTwice(t *testing.T) { func TestFundingManagerReceiveFundingLockedTwice(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1789,6 +1808,8 @@ func TestFundingManagerReceiveFundingLockedTwice(t *testing.T) {
// handles receiving a fundingLocked after the its own fundingLocked and channel // handles receiving a fundingLocked after the its own fundingLocked and channel
// announcement is sent and gets restarted. // announcement is sent and gets restarted.
func TestFundingManagerRestartAfterChanAnn(t *testing.T) { func TestFundingManagerRestartAfterChanAnn(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1866,6 +1887,8 @@ func TestFundingManagerRestartAfterChanAnn(t *testing.T) {
// fundingManager continues to operate as expected after it has received // fundingManager continues to operate as expected after it has received
// fundingLocked and then gets restarted. // fundingLocked and then gets restarted.
func TestFundingManagerRestartAfterReceivingFundingLocked(t *testing.T) { func TestFundingManagerRestartAfterReceivingFundingLocked(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -1939,6 +1962,8 @@ func TestFundingManagerRestartAfterReceivingFundingLocked(t *testing.T) {
// (a channel not supposed to be announced to the rest of the network), // (a channel not supposed to be announced to the rest of the network),
// the announcementSignatures nor the nodeAnnouncement messages are sent. // the announcementSignatures nor the nodeAnnouncement messages are sent.
func TestFundingManagerPrivateChannel(t *testing.T) { func TestFundingManagerPrivateChannel(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -2041,6 +2066,8 @@ func TestFundingManagerPrivateChannel(t *testing.T) {
// announcement signatures nor the node announcement messages are sent upon // announcement signatures nor the node announcement messages are sent upon
// restart. // restart.
func TestFundingManagerPrivateRestart(t *testing.T) { func TestFundingManagerPrivateRestart(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -2163,6 +2190,8 @@ func TestFundingManagerPrivateRestart(t *testing.T) {
// TestFundingManagerCustomChannelParameters checks that custom requirements we // TestFundingManagerCustomChannelParameters checks that custom requirements we
// specify during the channel funding flow is preserved correcly on both sides. // specify during the channel funding flow is preserved correcly on both sides.
func TestFundingManagerCustomChannelParameters(t *testing.T) { func TestFundingManagerCustomChannelParameters(t *testing.T) {
t.Parallel()
alice, bob := setupFundingManagers(t) alice, bob := setupFundingManagers(t)
defer tearDownFundingManagers(t, alice, bob) defer tearDownFundingManagers(t, alice, bob)
@ -2391,6 +2420,8 @@ func TestFundingManagerCustomChannelParameters(t *testing.T) {
// TestFundingManagerMaxPendingChannels checks that trying to open another // TestFundingManagerMaxPendingChannels checks that trying to open another
// channel with the same peer when MaxPending channels are pending fails. // channel with the same peer when MaxPending channels are pending fails.
func TestFundingManagerMaxPendingChannels(t *testing.T) { func TestFundingManagerMaxPendingChannels(t *testing.T) {
t.Parallel()
const maxPending = 4 const maxPending = 4
alice, bob := setupFundingManagers( alice, bob := setupFundingManagers(
@ -2556,6 +2587,8 @@ func TestFundingManagerMaxPendingChannels(t *testing.T) {
// TestFundingManagerRejectPush checks behaviour of 'rejectpush' // TestFundingManagerRejectPush checks behaviour of 'rejectpush'
// option, namely that non-zero incoming push amounts are disabled. // option, namely that non-zero incoming push amounts are disabled.
func TestFundingManagerRejectPush(t *testing.T) { func TestFundingManagerRejectPush(t *testing.T) {
t.Parallel()
// Enable 'rejectpush' option and initialize funding managers. // Enable 'rejectpush' option and initialize funding managers.
alice, bob := setupFundingManagers( alice, bob := setupFundingManagers(
t, func(cfg *fundingConfig) { t, func(cfg *fundingConfig) {