Documentation
¶
Overview ¶
Package testing provides testing helpers for state machines using testify.
Index ¶
- func AssertErr(t *stdtest.T, mach am.Api)
- func AssertIs(t *stdtest.T, mach am.Api, states am.S, msgAndArgs ...any)
- func AssertIs1(t *stdtest.T, mach am.Api, state string, msgAndArgs ...any)
- func AssertNoErrEver(t *stdtest.T, mach am.Api)
- func AssertNoErrNow(t *stdtest.T, mach am.Api)
- func AssertNoErrQueued(t *stdtest.T, mach *am.Machine)
- func AssertNot(t *stdtest.T, mach am.Api, states am.S, msgAndArgs ...any)
- func AssertNot1(t *stdtest.T, mach am.Api, state string, msgAndArgs ...any)
- 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)
- func GroupWhen1(t *stdtest.T, mach []am.Api, state string, ctx context.Context) []<-chan struct{}
- func LogToTestLog(t *stdtest.T, mach am.Api, maxLvl am.LogLevel)
- func MachDebug(t *stdtest.T, mach am.Api, amDbgAddr string, logLvl am.LogLevel, stdout bool)
- func MachDebugEnv(t *stdtest.T, mach am.Api)
- func Wait(t *stdtest.T, errMsg string, ctx context.Context, length time.Duration)
- func WaitForAll(t *stdtest.T, source string, ctx context.Context, timeout time.Duration, ...)
- func WaitForAny(t *stdtest.T, source string, ctx context.Context, timeout time.Duration, ...)
- func WaitForErrAll(t *stdtest.T, source string, ctx context.Context, mach am.Api, ...)
- type MeteredUDP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNoErrEver ¶
AssertNoErrEver asserts that the machine never was in the Exception state.
func AssertNoErrNow ¶
AssertNoErrNow asserts that the machine is not in the Exception state.
func AssertNot1 ¶
AssertNot1 asserts that the machine is not in the given state.
func AssertString ¶ added in v0.19.3
func AssertTime ¶ added in v0.19.3
func GroupWhen1 ¶
func GroupWhen1( t *stdtest.T, mach []am.Api, state string, ctx context.Context, ) []<-chan struct{}
GroupWhen1 is a test version of amhelp.GroupWhen1, which errors instead of returning an error.
func LogToTestLog ¶ added in v0.18.9
LogToTestLog will fwd machine's log to `go test` log.
func MachDebug ¶
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.
func MachDebugEnv ¶
MachDebugEnv sets up a machine for debugging in tests, based on env vars only: AM_DBG_ADDR, AM_LOG, and AM_DEBUG.
func Wait ¶
Wait is a test version of amhelp.Wait, which errors instead of returning false.
func WaitForAll ¶
func WaitForAll( t *stdtest.T, source string, ctx context.Context, timeout time.Duration, chans ...<-chan struct{}, )
WaitForAll is a test version of amhelp.WaitForAll, which errors instead of returning an error.
func WaitForAny ¶
func WaitForAny( t *stdtest.T, source string, ctx context.Context, timeout time.Duration, chans ...<-chan struct{}, )
WaitForAny is a test version of amhelp.WaitForAny, which errors instead of returning an error.
Types ¶
type MeteredUDP ¶ added in v0.19.3
type MeteredUDP struct {
net.PacketConn
// contains filtered or unexported fields
}
MeteredUDP wraps a net.PacketConn to track bytes and packet counts.
func WrapUDP ¶ added in v0.19.3
func WrapUDP(conn net.PacketConn) *MeteredUDP
func (*MeteredUDP) BytesOut ¶ added in v0.19.3
func (m *MeteredUDP) BytesOut() uint64
func (*MeteredUDP) PacketsIn ¶ added in v0.19.3
func (m *MeteredUDP) PacketsIn() uint64
func (*MeteredUDP) PacketsOut ¶ added in v0.19.3
func (m *MeteredUDP) PacketsOut() uint64