From b2608dd292ab7fade12ad97cfda38e071ee46e76 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 13 Mar 2018 12:20:58 +0100 Subject: [PATCH] htlcswitch/link_test: increase timeout for message sends This commit increases the time we wait for a message to be sent for several test cases, aiming to decrease the false negative rate on Travis. --- htlcswitch/link_test.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index 886164d9..7babeb2a 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -1538,7 +1538,7 @@ func handleStateUpdate(link *channelLink, var msg lnwire.Message select { case msg = <-sentMsgs: - case <-time.After(20 * time.Second): + case <-time.After(60 * time.Second): return fmt.Errorf("did not receive CommitSig from Alice") } @@ -1575,7 +1575,7 @@ func handleStateUpdate(link *channelLink, // This should make the link respond with a revocation. select { case msg = <-sentMsgs: - case <-time.After(20 * time.Second): + case <-time.After(60 * time.Second): return fmt.Errorf("did not receive RevokeAndAck from Alice") } @@ -1628,7 +1628,7 @@ func updateState(batchTick chan time.Time, link *channelLink, var msg lnwire.Message select { case msg = <-sentMsgs: - case <-time.After(20 * time.Second): + case <-time.After(60 * time.Second): return fmt.Errorf("did not receive RevokeAndAck from Alice") } @@ -1644,7 +1644,7 @@ func updateState(batchTick chan time.Time, link *channelLink, } select { case msg = <-sentMsgs: - case <-time.After(20 * time.Second): + case <-time.After(60 * time.Second): return fmt.Errorf("did not receive CommitSig from Alice") } @@ -1761,7 +1761,7 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) { var msg lnwire.Message select { case msg = <-aliceMsgs: - case <-time.After(2 * time.Second): + case <-time.After(15 * time.Second): t.Fatalf("did not receive message") } @@ -1839,7 +1839,7 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) { // Alice will send the HTLC to Bob. select { case msg = <-aliceMsgs: - case <-time.After(2 * time.Second): + case <-time.After(15 * time.Second): t.Fatalf("did not receive message") } @@ -1975,7 +1975,7 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) { select { case msg = <-aliceMsgs: - case <-time.After(2 * time.Second): + case <-time.After(15 * time.Second): t.Fatalf("did not receive message") } @@ -2076,7 +2076,7 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) { // Message should be sent to Bob. select { case msg = <-aliceMsgs: - case <-time.After(2 * time.Second): + case <-time.After(15 * time.Second): t.Fatalf("did not receive message") } failMsg, ok = msg.(*lnwire.UpdateFailHTLC) @@ -2172,7 +2172,7 @@ func TestChannelLinkBandwidthConsistencyOverflow(t *testing.T) { for i := 0; i < numHTLCs; i++ { select { case msg = <-aliceMsgs: - case <-time.After(5 * time.Second): + case <-time.After(15 * time.Second): t.Fatalf("did not receive message %d", i) } @@ -2281,7 +2281,7 @@ func TestChannelLinkBandwidthConsistencyOverflow(t *testing.T) { var msg lnwire.Message select { case msg = <-aliceMsgs: - case <-time.After(2 * time.Second): + case <-time.After(15 * time.Second): t.Fatalf("did not receive message") } @@ -2386,7 +2386,7 @@ func TestChannelLinkBandwidthChanReserve(t *testing.T) { var msg lnwire.Message select { case msg = <-aliceMsgs: - case <-time.After(2 * time.Second): + case <-time.After(15 * time.Second): t.Fatalf("did not receive message") }