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:
parent
09719626e5
commit
b6057abe93
@ -181,8 +181,8 @@ func TestChannelLinkBidirectionalOneHopPayments(t *testing.T) {
|
|||||||
|
|
||||||
// Send max available payment number in both sides, thereby testing
|
// Send max available payment number in both sides, thereby testing
|
||||||
// the property of channel link to cope with overflowing.
|
// the property of channel link to cope with overflowing.
|
||||||
resultChan := make(chan *result)
|
|
||||||
count := 2 * lnwallet.MaxHTLCNumber
|
count := 2 * lnwallet.MaxHTLCNumber
|
||||||
|
resultChan := make(chan *result, count)
|
||||||
for i := 0; i < count/2; i++ {
|
for i := 0; i < count/2; i++ {
|
||||||
go func(i int) {
|
go func(i int) {
|
||||||
r := &result{
|
r := &result{
|
||||||
@ -236,7 +236,7 @@ func TestChannelLinkBidirectionalOneHopPayments(t *testing.T) {
|
|||||||
}
|
}
|
||||||
averageDelay += delay
|
averageDelay += delay
|
||||||
|
|
||||||
case <-time.After(30 * time.Second):
|
case <-time.After(5 * time.Minute):
|
||||||
t.Fatalf("timeout: (%v/%v)", i+1, count)
|
t.Fatalf("timeout: (%v/%v)", i+1, count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ func TestSwitchCancel(t *testing.T) {
|
|||||||
case <-aliceChannelLink.packets:
|
case <-aliceChannelLink.packets:
|
||||||
break
|
break
|
||||||
case <-time.After(time.Second):
|
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 {
|
if s.circuits.pending() != 0 {
|
||||||
|
@ -2,8 +2,8 @@ package htlcswitch
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"crypto/rand"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"math/rand"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -65,6 +65,9 @@ func mockGetChanUpdateMessage() (*lnwire.ChannelUpdate, error) {
|
|||||||
func generateRandomBytes(n int) ([]byte, error) {
|
func generateRandomBytes(n int) ([]byte, error) {
|
||||||
b := make([]byte, n)
|
b := make([]byte, n)
|
||||||
|
|
||||||
|
// TODO(roasbeef): should use counter in tests (atomic) rather than
|
||||||
|
// this
|
||||||
|
|
||||||
_, err := rand.Read(b[:])
|
_, err := rand.Read(b[:])
|
||||||
// Note that Err == nil only if we read len(b) bytes.
|
// Note that Err == nil only if we read len(b) bytes.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -273,10 +276,6 @@ func getChanID(msg lnwire.Message) lnwire.ChannelID {
|
|||||||
func generatePayment(invoiceAmt, htlcAmt btcutil.Amount, timelock uint32,
|
func generatePayment(invoiceAmt, htlcAmt btcutil.Amount, timelock uint32,
|
||||||
blob [lnwire.OnionPacketSize]byte) (*channeldb.Invoice, *lnwire.UpdateAddHTLC, error) {
|
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
|
var preimage [sha256.Size]byte
|
||||||
r, err := generateRandomBytes(sha256.Size)
|
r, err := generateRandomBytes(sha256.Size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -451,7 +450,7 @@ func (n *threeHopNetwork) makePayment(sendingPeer, receivingPeer Peer,
|
|||||||
select {
|
select {
|
||||||
case err := <-errChan:
|
case err := <-errChan:
|
||||||
return invoice, err
|
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")
|
return invoice, errors.New("htlc was not settled in time")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user