diff --git a/lnd_test.go b/lnd_test.go index a9612666..f60f4cda 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -8887,7 +8887,7 @@ func testAsyncPayments(net *lntest.NetworkHarness, t *harnessTest) { // Open up a payment stream to Alice that we'll use to send payment to // Bob. We also create a small helper function to send payments to Bob, // consuming the payment hashes we generated above. - ctxt, _ = context.WithTimeout(ctxb, time.Minute) + ctxt, _ = context.WithTimeout(ctxb, lntest.AsyncBenchmarkTimeout) alicePayStream, err := net.Alice.SendPayment(ctxt) if err != nil { t.Fatalf("unable to create payment stream for alice: %v", err) diff --git a/lntest/harness.go b/lntest/harness.go index 78644c7d..6f3351de 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -24,27 +24,8 @@ import ( "github.com/lightningnetwork/lnd/lnwire" ) -const ( - // DefaultCSV is the CSV delay (remotedelay) we will start our test - // nodes with. - DefaultCSV = 4 - - // MinerMempoolTimeout is the max time we will wait for a transaction - // to propagate to the mining node's mempool. - MinerMempoolTimeout = time.Second * 30 - - // ChannelOpenTimeout is the max time we will wait before a channel to - // be considered opened. - ChannelOpenTimeout = time.Second * 30 - - // ChannelCloseTimeout is the max time we will wait before a channel is - // considered closed. - ChannelCloseTimeout = time.Second * 30 - - // DefaultTimeout is a timeout that will be used for various wait - // scenarios where no custom timeout value is defined. - DefaultTimeout = time.Second * 30 -) +// DefaultCSV is the CSV delay (remotedelay) we will start our test nodes with. +const DefaultCSV = 4 // NetworkHarness is an integration testing harness for the lightning network. // The harness by default is created with two active nodes on the network: diff --git a/lntest/timeouts.go b/lntest/timeouts.go new file mode 100644 index 00000000..05213846 --- /dev/null +++ b/lntest/timeouts.go @@ -0,0 +1,27 @@ +// +build !darwin + +package lntest + +import "time" + +const ( + // MinerMempoolTimeout is the max time we will wait for a transaction + // to propagate to the mining node's mempool. + MinerMempoolTimeout = time.Second * 30 + + // ChannelOpenTimeout is the max time we will wait before a channel to + // be considered opened. + ChannelOpenTimeout = time.Second * 30 + + // ChannelCloseTimeout is the max time we will wait before a channel is + // considered closed. + ChannelCloseTimeout = time.Second * 30 + + // DefaultTimeout is a timeout that will be used for various wait + // scenarios where no custom timeout value is defined. + DefaultTimeout = time.Second * 30 + + // AsyncBenchmarkTimeout is the timeout used when running the async + // payments benchmark. + AsyncBenchmarkTimeout = time.Minute +) diff --git a/lntest/timeouts_darwin.go b/lntest/timeouts_darwin.go new file mode 100644 index 00000000..ef21c998 --- /dev/null +++ b/lntest/timeouts_darwin.go @@ -0,0 +1,28 @@ +// +build darwin + +package lntest + +import "time" + +const ( + // MinerMempoolTimeout is the max time we will wait for a transaction + // to propagate to the mining node's mempool. + MinerMempoolTimeout = time.Second * 30 + + // ChannelOpenTimeout is the max time we will wait before a channel to + // be considered opened. + ChannelOpenTimeout = time.Second * 30 + + // ChannelCloseTimeout is the max time we will wait before a channel is + // considered closed. + ChannelCloseTimeout = time.Second * 30 + + // DefaultTimeout is a timeout that will be used for various wait + // scenarios where no custom timeout value is defined. + DefaultTimeout = time.Second * 30 + + // AsyncBenchmarkTimeout is the timeout used when running the async + // payments benchmark. This timeout takes considerably longer on darwin + // after go1.12 corrected its use of fsync. + AsyncBenchmarkTimeout = time.Minute * 3 +)