utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTestWaitTimeout = time.Second * 12

Variables

This section is empty.

Functions

func EIOHandshake

func EIOHandshake(t *testing.T, ts *httptest.Server) (sid string)

func EIOPoll

func EIOPoll(t *testing.T, ts *httptest.Server, sid string) (body string, status int)

func EIOPush

func EIOPush(t *testing.T, ts *httptest.Server, sid, body string)

Types

type TestServerTransport

type TestServerTransport struct {
	Callbacks *transport.Callbacks
}

func NewTestServerTransport

func NewTestServerTransport() *TestServerTransport

func (*TestServerTransport) Close

func (t *TestServerTransport) Close()

func (*TestServerTransport) Discard

func (t *TestServerTransport) Discard()

func (*TestServerTransport) Handshake

func (*TestServerTransport) Name

func (t *TestServerTransport) Name() string

func (*TestServerTransport) PostHandshake

func (t *TestServerTransport) PostHandshake(handshakePacket *parser.Packet)

func (*TestServerTransport) QueuedPackets

func (t *TestServerTransport) QueuedPackets() []*parser.Packet

func (*TestServerTransport) Send

func (t *TestServerTransport) Send(packets ...*parser.Packet)

func (*TestServerTransport) ServeHTTP

func (t *TestServerTransport) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TestSocket

type TestSocket struct {
	Closed   bool
	SendFunc func(packets ...*parser.Packet)
	// contains filtered or unexported fields
}

func NewTestSocket

func NewTestSocket(id string) *TestSocket

func (*TestSocket) Close

func (s *TestSocket) Close()

func (*TestSocket) ID

func (s *TestSocket) ID() string

Session ID (sid)

func (*TestSocket) PingInterval

func (s *TestSocket) PingInterval() time.Duration

func (*TestSocket) PingTimeout

func (s *TestSocket) PingTimeout() time.Duration

func (*TestSocket) Send

func (s *TestSocket) Send(packets ...*parser.Packet)

func (*TestSocket) TransportName

func (s *TestSocket) TransportName() string

Name of the current transport

type TestWaiter

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

This is a sync.WaitGroup with a WaitTimeout function. Use this for testing purposes.

func NewTestWaiter

func NewTestWaiter(delta int) *TestWaiter

func (*TestWaiter) Add

func (w *TestWaiter) Add(delta int)

func (*TestWaiter) Done

func (w *TestWaiter) Done()

func (*TestWaiter) Wait

func (w *TestWaiter) Wait()

func (*TestWaiter) WaitTimeout

func (w *TestWaiter) WaitTimeout(t *testing.T, timeout time.Duration) (timedout bool)

type TestWaiterString

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

func NewTestWaiterString

func NewTestWaiterString() *TestWaiterString

func (*TestWaiterString) Add

func (w *TestWaiterString) Add(s string)

func (*TestWaiterString) Done

func (w *TestWaiterString) Done(s string)

func (*TestWaiterString) Wait

func (w *TestWaiterString) Wait()

func (*TestWaiterString) WaitTimeout

func (w *TestWaiterString) WaitTimeout(t *testing.T, timeout time.Duration) (timedout bool)

type TimeoutWaiter

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

This is a sync.WaitGroup with a WaitTimeout function.

func NewTimeoutWaiter

func NewTimeoutWaiter(delta int) *TimeoutWaiter

func (*TimeoutWaiter) Add

func (w *TimeoutWaiter) Add(delta int)

func (*TimeoutWaiter) Done

func (w *TimeoutWaiter) Done()

func (*TimeoutWaiter) Wait

func (w *TimeoutWaiter) Wait()

func (*TimeoutWaiter) WaitTimeout

func (w *TimeoutWaiter) WaitTimeout(timeout time.Duration) (timedout bool)

Jump to

Keyboard shortcuts

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