wait

package
v0.18.3-beta.rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinerMempoolTimeout is the max time we will wait for a transaction
	// to propagate to the mining node's mempool.
	MinerMempoolTimeout = time.Minute

	// 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 * 2

	// NodeStartTimeout is the timeout value when waiting for a node to
	// become fully started.
	NodeStartTimeout = time.Minute * 2

	// SqliteBusyTimeout is the maximum time that a call to the sqlite db
	// will wait for the connection to become available.
	SqliteBusyTimeout = time.Second * 10

	// PaymentTimeout is the timeout used when sending payments.
	PaymentTimeout = time.Second * 60
)
View Source
const PollInterval = 200 * time.Millisecond

PollInterval is a constant specifying a 200 ms interval.

Variables

This section is empty.

Functions

func Invariant

func Invariant(statement func() bool, timeout time.Duration) error

Invariant is a helper test function that will wait for a timeout period of time, verifying that a statement remains true for the entire duration. This function is helpful as timing doesn't always line up well when running integration tests with several running lnd nodes. This function gives callers a way to assert that some property is maintained over a particular time frame.

func InvariantNoError

func InvariantNoError(f func() error, timeout time.Duration) error

InvariantNoError is a wrapper around Invariant that waits out the duration specified by timeout. It fails if the predicate ever returns an error during that time.

func NoError

func NoError(f func() error, timeout time.Duration) error

NoError is a wrapper around Predicate that waits for the passed method f to execute without error, and returns the last error encountered if this doesn't happen within the timeout.

func Predicate

func Predicate(pred func() bool, timeout time.Duration) error

Predicate is a helper test function that will wait for a timeout period of time until the passed predicate returns true. This function is helpful as timing doesn't always line up well when running integration tests with several running lnd nodes. This function gives callers a way to assert that some property is upheld within a particular time frame.

TODO(yy): build a counter here so we know how many times we've tried the `pred`.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL