testutils

package
v0.0.0-...-cdef871 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GetTestLogger is a proxy to go-xbus/testutils.GetTestLogger
	GetTestLogger = testutils.GetTestLogger
	// ExpectsEqual is a proxy to go-xbus/testutils.ExpectsEqual
	ExpectsEqual = testutils.ExpectsEqual
	// ExpectsContains is a proxy to go-xbus/testutils.ExpectsContains
	ExpectsContains = testutils.ExpectsContains
)
View Source
var LastUUID api.UUID

LastUUID contains the last UUID returned by NewUUID()

Functions

func DeferedAssertNoError

func DeferedAssertNoError(t *testing.T, cb func() error)

DeferedAssertNoError helps checking a function error in a defer statement

func ExpectsJSONContains

func ExpectsJSONContains(expected interface{}) testutils.ExpectedError

ExpectsJSONContains match

func NewUUID

func NewUUID() api.UUID

NewUUID returns a new UUID or panics

Types

type NatsTestServer

type NatsTestServer struct {
	ConnOptions nats.Options
	// contains filtered or unexported fields
}

NatsTestServer wraps a gnatsd server.Server

func InitNatsTestServer

func InitNatsTestServer(
	t *testing.T, logger xbus.ZeroLogger,
	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

func (NatsTestServer) Shutdown

func (s NatsTestServer) Shutdown()

Shutdown stops the server

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

func NewPortLock

func NewPortLock(port int) *PortLock

NewPortLock returns a lock for port

func (*PortLock) Lock

func (p *PortLock) Lock() error

Lock locks on port

func (*PortLock) TryLock

func (p *PortLock) TryLock() (bool, error)

TryLock acquires the lock, non-blocking

func (*PortLock) Unlock

func (p *PortLock) Unlock() error

Unlock unlocks the port lock

type TestLogger

type TestLogger = testutils.TestLogger

TestLogger is a proxy to go-xbus/testutils.TestLogger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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