Documentation
¶
Index ¶
- Variables
- func NewUUID() api.UUID
- type ExpectedError
- type MatchMessage
- type NatsTestServer
- type PortLock
- type TestLogger
- func (m TestLogger) Debugf(format string, v ...interface{})
- func (m *TestLogger) Errorf(format string, v ...interface{})
- func (m *TestLogger) ExpectsError(expectedError interface{})
- func (m TestLogger) Fatalf(format string, v ...interface{})
- func (m TestLogger) Noticef(format string, v ...interface{})
- func (m *TestLogger) SetTest(t testing.TB) func()
- func (m TestLogger) Tracef(format string, v ...interface{})
- func (m TestLogger) VerifyExpectations()
Constants ¶
This section is empty.
Variables ¶
var LastUUID api.UUID
LastUUID contains the last UUID returned by NewUUID()
Functions ¶
Types ¶
type ExpectedError ¶
type ExpectedError struct { MatchMessage MatchMessage Name string }
ExpectedError is the definition of an expected error
func ExpectsContains ¶
func ExpectsContains(value string) ExpectedError
ExpectsContains returns a ExpectedError matching a partial message
func ExpectsEqual ¶
func ExpectsEqual(value string) ExpectedError
ExpectsEqual returns a ExpectedError matching a message exactly
type MatchMessage ¶
MatchMessage is a function that match a log message
type NatsTestServer ¶
NatsTestServer wraps a gnatsd server.Server
func InitNatsTestServer ¶
func InitNatsTestServer( t *testing.T, logger xbus.Logger, accountStorage storage.AccountStorage, passwordStorage storage.PasswordStorage, actorStorage storage.ActorStorage, sessionStorage storage.SessionStorage, ServerCert *tls.Certificate, ) NatsTestServer
InitNatsTestServer returns a gnatsd test server
func (NatsTestServer) AuthToken ¶
func (s NatsTestServer) AuthToken() string
AuthToken returns the auth token
func (NatsTestServer) Connect ¶
func (s NatsTestServer) Connect(t *testing.T) *nats.Conn
Connect returns a new client connection to the server
func (NatsTestServer) IsReady ¶
func (s NatsTestServer) IsReady() bool
IsReady returns true if the server is ready
type PortLock ¶
type PortLock struct {
// contains filtered or unexported fields
}
PortLock is a locker which locks by binding to a port on the loopback IPv4 interface
type TestLogger ¶
type TestLogger struct {
// contains filtered or unexported fields
}
TestLogger is a BusLogger for tests
func GetTestLogger ¶
func GetTestLogger(t testing.TB) *TestLogger
GetTestLogger returns a new BusLogger for the passed testing.T
func (TestLogger) Debugf ¶
func (m TestLogger) Debugf(format string, v ...interface{})
Debugf passes the message to T.Logf
func (*TestLogger) Errorf ¶
func (m *TestLogger) Errorf(format string, v ...interface{})
Errorf passes the message to T.Errorf
func (*TestLogger) ExpectsError ¶
func (m *TestLogger) ExpectsError(expectedError interface{})
ExpectsError anticipate an error and make it non-fatal to the test
func (TestLogger) Fatalf ¶
func (m TestLogger) Fatalf(format string, v ...interface{})
Fatalf passes the message to T.Fatalf
func (TestLogger) Noticef ¶
func (m TestLogger) Noticef(format string, v ...interface{})
Noticef passes the message to T.Logf
func (*TestLogger) SetTest ¶
func (m *TestLogger) SetTest(t testing.TB) func()
SetTest changes the current test, and return a function to cancel the change
func (TestLogger) Tracef ¶
func (m TestLogger) Tracef(format string, v ...interface{})
Tracef passes the message to T.Logf
func (TestLogger) VerifyExpectations ¶
func (m TestLogger) VerifyExpectations()
VerifyExpectations enforce error expectations