Documentation ¶
Overview ¶
Package test provides helpers to test the various pion transports implementations. The tests are standardized around the io.ReadWriteCloser interface. This package is meant to be used in addition to golang.org/x/net/nettest.
Index ¶
- func CheckRoutines(t *testing.T) func()
- func FlattenErrs(errs []error) error
- func GatherErrs(c chan error) []error
- func Stress(ca io.Writer, cb io.Reader, opt Options) error
- func StressContext(ctx context.Context, ca netctx.Writer, cb netctx.Reader, opt Options) error
- func StressDuplex(ca io.ReadWriter, cb io.ReadWriter, opt Options) error
- func StressDuplexContext(ctx context.Context, ca netctx.ReadWriter, cb netctx.ReadWriter, opt Options) error
- func TimeOut(t time.Duration) *time.Timer
- type Bridge
- func (br *Bridge) Drop(fromID, offset, n int)
- func (br *Bridge) DropNextNWrites(fromID, n int)
- func (br *Bridge) Filter(fromID int, cb func([]byte) bool)
- func (br *Bridge) GetConn0() net.Conn
- func (br *Bridge) GetConn1() net.Conn
- func (br *Bridge) Len(fromID int) int
- func (br *Bridge) Process()
- func (br *Bridge) Push(packet []byte, fromID int) bool
- func (br *Bridge) Reorder(fromID int) error
- func (br *Bridge) ReorderNextNWrites(fromID, n int)
- func (br *Bridge) SetLossChance(chance int) error
- func (br *Bridge) Tick() int
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRoutines ¶
CheckRoutines is used to check for leaked go-routines
func FlattenErrs ¶
FlattenErrs flattens a slice of errors into a single error
func GatherErrs ¶
GatherErrs gathers all errors returned by a channel. It blocks until the channel is closed.
func Stress ¶
Stress enables stress testing of a io.ReadWriter. It checks that packets are received correctly and in order.
func StressContext ¶
StressContext enables stress testing of a io.ReadWriter. It checks that packets are received correctly and in order.
func StressDuplex ¶
func StressDuplex(ca io.ReadWriter, cb io.ReadWriter, opt Options) error
StressDuplex enables duplex stress testing of a io.ReadWriter. It checks that packets are received correctly and in order.
func StressDuplexContext ¶
func StressDuplexContext(ctx context.Context, ca netctx.ReadWriter, cb netctx.ReadWriter, opt Options) error
StressDuplexContext enables duplex stress testing of a io.ReadWriter. It checks that packets are received correctly and in order.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge represents a network between the two endpoints.
func (*Bridge) Drop ¶
Drop drops the specified number of packets from the given offset index of the specified queue.
func (*Bridge) DropNextNWrites ¶
DropNextNWrites drops the next n packets that will be written to the specified queue.
func (*Bridge) Process ¶
func (br *Bridge) Process()
Process repeats tick() calls until no more outstanding packet in the queues.
func (*Bridge) ReorderNextNWrites ¶
ReorderNextNWrites drops the next n packets that will be written to the specified queue.
func (*Bridge) SetLossChance ¶
SetLossChance sets the probability of writes being discard (to introduce artificial loss)