mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
itest: add default context timeout to all itests
This commit is contained in:
parent
c578280c7c
commit
8e6ef3f567
4 changed files with 17 additions and 11 deletions
|
|
@ -378,8 +378,8 @@ func assertStatusErr(t *testing.T, err error, code codes.Code) {
|
|||
|
||||
// testFirewallRules tests that the various firewall rules are enforced
|
||||
// correctly.
|
||||
func testFirewallRules(net *NetworkHarness, t *harnessTest) {
|
||||
ctx := context.Background()
|
||||
func testFirewallRules(ctx context.Context, net *NetworkHarness,
|
||||
t *harnessTest) {
|
||||
|
||||
// Some very basic functionality tests to make sure lnd is working fine
|
||||
// in integrated mode.
|
||||
|
|
@ -1142,8 +1142,8 @@ func testPeerAndChannelRestrictRules(net *NetworkHarness, t *harnessTest) {
|
|||
require.NoError(t.t, err)
|
||||
}
|
||||
|
||||
func testLargeHttpHeader(net *NetworkHarness, t *harnessTest) {
|
||||
ctx := context.Background()
|
||||
func testLargeHttpHeader(ctx context.Context, net *NetworkHarness,
|
||||
t *harnessTest) {
|
||||
|
||||
// First we add all LND's permissions so that any call we make to LND to
|
||||
// test that the connection is working will succeed.
|
||||
|
|
|
|||
|
|
@ -259,8 +259,8 @@ var (
|
|||
|
||||
// testModeIntegrated makes sure that in integrated mode all daemons work
|
||||
// correctly.
|
||||
func testModeIntegrated(net *NetworkHarness, t *harnessTest) {
|
||||
ctx := context.Background()
|
||||
func testModeIntegrated(ctx context.Context, net *NetworkHarness,
|
||||
t *harnessTest) {
|
||||
|
||||
// Some very basic functionality tests to make sure lnd is working fine
|
||||
// in integrated mode.
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ import (
|
|||
)
|
||||
|
||||
// testModeRemote makes sure that in remote mode all daemons work correctly.
|
||||
func testModeRemote(net *NetworkHarness, t *harnessTest) {
|
||||
ctx := context.Background()
|
||||
|
||||
func testModeRemote(ctx context.Context, net *NetworkHarness, t *harnessTest) {
|
||||
// Some very basic functionality tests to make sure lnd is working fine
|
||||
// in remote mode.
|
||||
net.SendCoins(t.t, btcutil.SatoshiPerBitcoin, net.Bob)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package itest
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
|
@ -25,6 +26,8 @@ var (
|
|||
)
|
||||
|
||||
slowMineDelay = 20 * time.Millisecond
|
||||
|
||||
defaultITestTimeout = 10 * time.Minute
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -92,7 +95,12 @@ func (h *harnessTest) RunTestCase(testCase *testCase) {
|
|||
}
|
||||
}()
|
||||
|
||||
testCase.test(h.lndHarness, h)
|
||||
ctxt, cancel := context.WithTimeout(
|
||||
context.Background(), defaultITestTimeout,
|
||||
)
|
||||
defer cancel()
|
||||
|
||||
testCase.test(ctxt, h.lndHarness, h)
|
||||
}
|
||||
|
||||
func (h *harnessTest) Logf(format string, args ...interface{}) {
|
||||
|
|
@ -118,7 +126,7 @@ func getLitdBinary() string {
|
|||
|
||||
type testCase struct {
|
||||
name string
|
||||
test func(net *NetworkHarness, t *harnessTest)
|
||||
test func(ctx context.Context, net *NetworkHarness, t *harnessTest)
|
||||
}
|
||||
|
||||
// waitForNTxsInMempool polls until finding the desired number of transactions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue