testutils

package
v0.0.0-...-6357825 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertIncomingErrorArrived

func AssertIncomingErrorArrived(
	fromCh <-chan error,
	expected string,
)

func AssertMessageArrived

func AssertMessageArrived(
	fromCh <-chan sip.Message,
	expectedMessage string,
	expectedSource string,
	expectedDest string,
) sip.Message

func CreateClient

func CreateClient(network string, raddr string, laddr string) net.Conn

func CreatePacketClientServer

func CreatePacketClientServer(network string, addr string) (net.Conn, net.Conn)

func CreateStreamClientServer

func CreateStreamClientServer(network string, addr string) (net.Conn, net.Conn)

func Message

func Message(rawMsg []string) sip.Message

func NewLogrusLogger

func NewLogrusLogger() *log.LogrusLogger

func Request

func Request(rawMsg []string) sip.Request

func Response

func Response(rawMsg []string) sip.Response

func WriteToConn

func WriteToConn(conn net.Conn, data []byte)

Types

type MockAddr

type MockAddr struct {
	Net  string
	Addr string
}

TODO implement with channels, all methods to replace net.Pipe in connection_pool_test.go

func (*MockAddr) Network

func (addr *MockAddr) Network() string

func (*MockAddr) String

func (addr *MockAddr) String() string

type MockConn

type MockConn struct {
	net.Conn
	LAddr net.Addr
	RAddr net.Addr
}

func (*MockConn) LocalAddr

func (conn *MockConn) LocalAddr() net.Addr

func (*MockConn) RemoteAddr

func (conn *MockConn) RemoteAddr() net.Addr

type MockListener

type MockListener struct {
	// contains filtered or unexported fields
}

func NewMockListener

func NewMockListener(addr net.Addr) *MockListener

func (*MockListener) Accept

func (ls *MockListener) Accept() (net.Conn, error)

func (*MockListener) Addr

func (ls *MockListener) Addr() net.Addr

func (*MockListener) Close

func (ls *MockListener) Close() error

func (*MockListener) Dial

func (ls *MockListener) Dial(network string, addr net.Addr) (net.Conn, error)

type MockTransportLayer

type MockTransportLayer struct {
	InMsgs  chan sip.Message
	InErrs  chan error
	OutMsgs chan sip.Message
	// contains filtered or unexported fields
}

func NewMockTransportLayer

func NewMockTransportLayer() *MockTransportLayer

func (*MockTransportLayer) Cancel

func (tpl *MockTransportLayer) Cancel()

func (*MockTransportLayer) Done

func (tpl *MockTransportLayer) Done() <-chan struct{}

func (*MockTransportLayer) Errors

func (tpl *MockTransportLayer) Errors() <-chan error

func (*MockTransportLayer) Host

func (tpl *MockTransportLayer) Host() string

func (*MockTransportLayer) IsReliable

func (tpl *MockTransportLayer) IsReliable(network string) bool

func (*MockTransportLayer) Listen

func (tpl *MockTransportLayer) Listen(network string, addr string) error

func (*MockTransportLayer) Log

func (tpl *MockTransportLayer) Log() log.Logger

func (*MockTransportLayer) Messages

func (tpl *MockTransportLayer) Messages() <-chan sip.Message

func (*MockTransportLayer) Send

func (tpl *MockTransportLayer) Send(msg sip.Message) error

func (*MockTransportLayer) String

func (tpl *MockTransportLayer) String() string

Jump to

Keyboard shortcuts

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