Merge pull request #4827 from halseth/link-test-timeouts

[test] Increase link test timeouts
This commit is contained in:
Conner Fromknecht 2020-12-04 02:34:34 -08:00 committed by GitHub
commit 26da2b2c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 38 deletions

@ -35,6 +35,7 @@ import (
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/ticker"
"github.com/stretchr/testify/require"
)
const (
@ -1139,7 +1140,7 @@ func TestChannelLinkMultiHopUnknownPaymentHash(t *testing.T) {
if !ok {
t.Fatalf("unexpected shutdown")
}
case <-time.After(5 * time.Second):
case <-time.After(10 * time.Second):
t.Fatalf("no result arrive")
}
@ -1148,27 +1149,25 @@ func TestChannelLinkMultiHopUnknownPaymentHash(t *testing.T) {
)
// Wait for Alice to receive the revocation.
time.Sleep(100 * time.Millisecond)
require.Eventually(t, func() bool {
if n.aliceChannelLink.Bandwidth() != aliceBandwidthBefore {
return false
}
if n.aliceChannelLink.Bandwidth() != aliceBandwidthBefore {
t.Fatal("the bandwidth of alice channel link which handles " +
"alice->bob channel should be the same")
}
if n.firstBobChannelLink.Bandwidth() != firstBobBandwidthBefore {
return false
}
if n.firstBobChannelLink.Bandwidth() != firstBobBandwidthBefore {
t.Fatal("the bandwidth of bob channel link which handles " +
"alice->bob channel should be the same")
}
if n.secondBobChannelLink.Bandwidth() != secondBobBandwidthBefore {
return false
}
if n.secondBobChannelLink.Bandwidth() != secondBobBandwidthBefore {
t.Fatal("the bandwidth of bob channel link which handles " +
"bob->carol channel should be the same")
}
if n.carolChannelLink.Bandwidth() != carolBandwidthBefore {
return false
}
if n.carolChannelLink.Bandwidth() != carolBandwidthBefore {
t.Fatal("the bandwidth of carol channel link which handles " +
"bob->carol channel should be the same")
}
return true
}, 10*time.Second, 100*time.Millisecond)
}
// TestChannelLinkMultiHopUnknownNextHop construct the chain of hops
@ -3779,32 +3778,29 @@ func TestChannelLinkUpdateCommitFee(t *testing.T) {
t.Fatalf("alice didn't query for the new network fee")
}
// Give the links some time to process the fee update.
time.Sleep(time.Second)
// Record the fee rates after the links have processed the fee
// update and ensure they are correct based on whether a fee
// update should have been triggered.
aliceAfter := channels.aliceToBob.CommitFeeRate()
bobAfter := channels.bobToAlice.CommitFeeRate()
require.Eventually(t, func() bool {
aliceAfter := channels.aliceToBob.CommitFeeRate()
bobAfter := channels.bobToAlice.CommitFeeRate()
switch {
case shouldUpdate && aliceAfter != newFeeRate:
t.Fatalf("alice's fee rate didn't change: expected %v, "+
"got %v", newFeeRate, aliceAfter)
switch {
case shouldUpdate && aliceAfter != newFeeRate:
return false
case shouldUpdate && bobAfter != newFeeRate:
t.Fatalf("bob's fee rate didn't change: expected %v, "+
"got %v", newFeeRate, bobAfter)
case shouldUpdate && bobAfter != newFeeRate:
return false
case !shouldUpdate && aliceAfter != aliceBefore:
t.Fatalf("alice's fee rate shouldn't have changed: "+
"expected %v, got %v", aliceAfter, aliceAfter)
case !shouldUpdate && aliceAfter != aliceBefore:
return false
case !shouldUpdate && bobAfter != bobBefore:
t.Fatalf("bob's fee rate shouldn't have changed: "+
"expected %v, got %v", bobBefore, bobAfter)
}
case !shouldUpdate && bobAfter != bobBefore:
return false
}
return true
}, 10*time.Second, time.Second)
}
// Triggering the link to update the fee of the channel with the same

@ -1412,7 +1412,7 @@ func timeout(t *testing.T) func() {
done := make(chan struct{})
go func() {
select {
case <-time.After(10 * time.Second):
case <-time.After(20 * time.Second):
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
panic("test timeout")