Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lntest/timeout: split into darwin and non-darwin timeouts #2846

Merged
merged 2 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
lntest/timeouts: split into darwin and non-darwin timeouts
  • Loading branch information
cfromknecht committed Mar 28, 2019
commit f3f4093ef02375c188462e8e0bfaaa86de724540
2 changes: 1 addition & 1 deletion lnd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 2 additions & 21 deletions lntest/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 27 additions & 0 deletions lntest/timeouts.go
Original file line number Diff line number Diff line change
@@ -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
)
28 changes: 28 additions & 0 deletions lntest/timeouts_darwin.go
Original file line number Diff line number Diff line change
@@ -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
)