hltcswitch: increase timeout for bi-di payment test due to travis slowness

This commit temporary increases the timeout for the
TestChannelLinkBidirectionalOneHopPayments test in order to account for
the slowness of the travis instances that our tests are run on.
This commit is contained in:
Olaoluwa Osuntokun 2017-08-01 12:53:07 -07:00
parent 09719626e5
commit b6057abe93
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
3 changed files with 8 additions and 9 deletions

@ -181,8 +181,8 @@ func TestChannelLinkBidirectionalOneHopPayments(t *testing.T) {
// Send max available payment number in both sides, thereby testing
// the property of channel link to cope with overflowing.
resultChan := make(chan *result)
count := 2 * lnwallet.MaxHTLCNumber
resultChan := make(chan *result, count)
for i := 0; i < count/2; i++ {
go func(i int) {
r := &result{
@ -236,7 +236,7 @@ func TestChannelLinkBidirectionalOneHopPayments(t *testing.T) {
}
averageDelay += delay
case <-time.After(30 * time.Second):
case <-time.After(5 * time.Minute):
t.Fatalf("timeout: (%v/%v)", i+1, count)
}
}

@ -181,7 +181,7 @@ func TestSwitchCancel(t *testing.T) {
case <-aliceChannelLink.packets:
break
case <-time.After(time.Second):
t.Fatal("request was not propogated to channelPoint")
t.Fatal("request was not propagated to channelPoint")
}
if s.circuits.pending() != 0 {

@ -2,8 +2,8 @@ package htlcswitch
import (
"bytes"
"crypto/rand"
"crypto/sha256"
"math/rand"
"testing"
"time"
@ -65,6 +65,9 @@ func mockGetChanUpdateMessage() (*lnwire.ChannelUpdate, error) {
func generateRandomBytes(n int) ([]byte, error) {
b := make([]byte, n)
// TODO(roasbeef): should use counter in tests (atomic) rather than
// this
_, err := rand.Read(b[:])
// Note that Err == nil only if we read len(b) bytes.
if err != nil {
@ -273,10 +276,6 @@ func getChanID(msg lnwire.Message) lnwire.ChannelID {
func generatePayment(invoiceAmt, htlcAmt btcutil.Amount, timelock uint32,
blob [lnwire.OnionPacketSize]byte) (*channeldb.Invoice, *lnwire.UpdateAddHTLC, error) {
// Initialize random seed with unix time in order to generate random
// preimage every time.
rand.Seed(time.Now().UTC().UnixNano())
var preimage [sha256.Size]byte
r, err := generateRandomBytes(sha256.Size)
if err != nil {
@ -451,7 +450,7 @@ func (n *threeHopNetwork) makePayment(sendingPeer, receivingPeer Peer,
select {
case err := <-errChan:
return invoice, err
case <-time.After(50 * time.Second):
case <-time.After(5 * time.Minute):
return invoice, errors.New("htlc was not settled in time")
}
}