package testing

Import Path
	/pkg/helpers/testing (on go.dev)

Dependency Relation
	imports 13 packages, and imported by 2 packages

Involved Source Files Package testing provides testing helpers for state machines using testify.
Package-Level Type Names (only one)
/* sort by: | */
MeteredUDP wraps a net.PacketConn to track bytes and packet counts. PacketConn net.PacketConn Stats getters (*MeteredUDP) BytesOut() uint64 Close closes the connection. Any blocked ReadFrom or WriteTo operations will be unblocked and return errors. LocalAddr returns the local network address, if known. (*MeteredUDP) PacketsIn() uint64 (*MeteredUDP) PacketsOut() uint64 (*MeteredUDP) ReadFrom(p []byte) (int, net.Addr, error) SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline. A deadline is an absolute time after which I/O operations fail instead of blocking. The deadline applies to all future and pending I/O, not just the immediately following call to Read or Write. After a deadline has been exceeded, the connection can be refreshed by setting a deadline in the future. If the deadline is exceeded a call to Read or Write or to other I/O methods will return an error that wraps os.ErrDeadlineExceeded. This can be tested using errors.Is(err, os.ErrDeadlineExceeded). The error's Timeout method will return true, but note that there are other possible errors for which the Timeout method will return true even if the deadline has not been exceeded. An idle timeout can be implemented by repeatedly extending the deadline after successful ReadFrom or WriteTo calls. A zero value for t means I/O operations will not time out. SetReadDeadline sets the deadline for future ReadFrom calls and any currently-blocked ReadFrom call. A zero value for t means ReadFrom will not time out. SetWriteDeadline sets the deadline for future WriteTo calls and any currently-blocked WriteTo call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means WriteTo will not time out. (*MeteredUDP) WriteTo(p []byte, addr net.Addr) (int, error) MeteredUDP : github.com/pion/datachannel.ReadDeadliner MeteredUDP : github.com/pion/datachannel.WriteDeadliner MeteredUDP : github.com/prometheus/common/expfmt.Closer MeteredUDP : io.Closer *MeteredUDP : net.PacketConn func WrapUDP(conn net.PacketConn) *MeteredUDP
Package-Level Functions (total 19)
AssertErr asserts that the machine is in the Exception state.
AssertIs asserts that the machine is in the given states.
AssertIs1 asserts that the machine is in the given state.
AssertNoErrEver asserts that the machine never was in the Exception state.
AssertNoErrNow asserts that the machine is not in the Exception state.
AssertNot asserts that the machine is not in the given states.
AssertNot1 asserts that the machine is not in the given state.
func AssertString(t *stdtest.T, m am.Api, expected string, states am.S)
func AssertTime(t *stdtest.T, m am.Api, states am.S, time am.Time, msgAndArgs ...any)
GroupWhen1 is a test version of [amhelp.GroupWhen1], which errors instead of returning an error.
LogToTestLog will fwd machine's log to `go test` log.
MachDebug sets up a machine for debugging in tests, based on the AM_DEBUG env var, passed am-dbg address, log level and stdout flag.
MachDebugEnv sets up a machine for debugging in tests, based on env vars only: AM_DBG_ADDR, AM_LOG, and AM_DEBUG.
Wait is a test version of [amhelp.Wait], which errors instead of returning false.
WaitForAll is a test version of [amhelp.WaitForAll], which errors instead of returning an error.
WaitForAny is a test version of [amhelp.WaitForAny], which errors instead of returning an error.
WaitForErrAll is a test version of [amhelp.WaitForErrAll], which errors instead of returning an error.