mocks

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockResult

func NewMockResult(sid string) *common.CommandResult

NewMockResult builds a new result with sid as transmission

Types

type Broadcaster added in v1.4.0

type Broadcaster struct {
	mock.Mock
}

Broadcaster is an autogenerated mock type for the Broadcaster type

func NewBroadcaster added in v1.4.0

func NewBroadcaster(t mockConstructorTestingTNewBroadcaster) *Broadcaster

NewBroadcaster creates a new instance of Broadcaster. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*Broadcaster) IsFanout added in v1.4.0

func (_m *Broadcaster) IsFanout() bool

IsFanout provides a mock function with given fields:

func (*Broadcaster) Shutdown added in v1.4.0

func (_m *Broadcaster) Shutdown(ctx context.Context) error

Shutdown provides a mock function with given fields: ctx

func (*Broadcaster) Start added in v1.4.0

func (_m *Broadcaster) Start(done chan error) error

Start provides a mock function with given fields: done

type Broker added in v1.4.0

type Broker struct {
	mock.Mock
}

Broker is an autogenerated mock type for the Broker type

func NewBroker added in v1.4.0

func NewBroker(t mockConstructorTestingTNewBroker) *Broker

NewBroker creates a new instance of Broker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*Broker) Announce added in v1.4.0

func (_m *Broker) Announce() string

Announce provides a mock function with given fields:

func (*Broker) CommitSession added in v1.4.0

func (_m *Broker) CommitSession(sid string, session broker.Cacheable) error

CommitSession provides a mock function with given fields: sid, session

func (*Broker) FinishSession added in v1.4.0

func (_m *Broker) FinishSession(sid string) error

FinishSession provides a mock function with given fields: sid

func (*Broker) HandleBroadcast added in v1.4.0

func (_m *Broker) HandleBroadcast(msg *common.StreamMessage)

HandleBroadcast provides a mock function with given fields: msg

func (*Broker) HandleCommand added in v1.4.0

func (_m *Broker) HandleCommand(msg *common.RemoteCommandMessage)

HandleCommand provides a mock function with given fields: msg

func (*Broker) HistoryFrom added in v1.4.0

func (_m *Broker) HistoryFrom(stream string, epoch string, offset uint64) ([]common.StreamMessage, error)

HistoryFrom provides a mock function with given fields: stream, epoch, offset

func (*Broker) HistorySince added in v1.4.0

func (_m *Broker) HistorySince(stream string, ts int64) ([]common.StreamMessage, error)

HistorySince provides a mock function with given fields: stream, ts

func (*Broker) RestoreSession added in v1.4.0

func (_m *Broker) RestoreSession(from string) ([]byte, error)

RestoreSession provides a mock function with given fields: from

func (*Broker) Shutdown added in v1.4.0

func (_m *Broker) Shutdown(ctx context.Context) error

Shutdown provides a mock function with given fields: ctx

func (*Broker) Start added in v1.4.0

func (_m *Broker) Start(done chan error) error

Start provides a mock function with given fields: done

func (*Broker) Subscribe added in v1.4.0

func (_m *Broker) Subscribe(stream string) string

Subscribe provides a mock function with given fields: stream

func (*Broker) Unsubscribe added in v1.4.0

func (_m *Broker) Unsubscribe(stream string) string

Unsubscribe provides a mock function with given fields: stream

type Controller added in v1.2.0

type Controller struct {
	mock.Mock
}

Controller is an autogenerated mock type for the Controller type

func (*Controller) Authenticate added in v1.2.0

func (_m *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)

Authenticate provides a mock function with given fields: sid, env

func (*Controller) Disconnect added in v1.2.0

func (_m *Controller) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error

Disconnect provides a mock function with given fields: sid, env, id, subscriptions

func (*Controller) Perform added in v1.2.0

func (_m *Controller) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)

Perform provides a mock function with given fields: sid, env, id, channel, data

func (*Controller) Shutdown added in v1.2.0

func (_m *Controller) Shutdown() error

Shutdown provides a mock function with given fields:

func (*Controller) Start added in v1.2.0

func (_m *Controller) Start() error

Start provides a mock function with given fields:

func (*Controller) Subscribe added in v1.2.0

func (_m *Controller) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)

Subscribe provides a mock function with given fields: sid, env, id, channel

func (*Controller) Unsubscribe added in v1.2.0

func (_m *Controller) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)

Unsubscribe provides a mock function with given fields: sid, env, id, channel

type Handler added in v1.1.4

type Handler struct {
	mock.Mock
}

Handler is an autogenerated mock type for the Handler type

func NewHandler added in v1.4.0

func NewHandler(t mockConstructorTestingTNewHandler) *Handler

NewHandler creates a new instance of Handler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*Handler) HandleBroadcast added in v1.4.0

func (_m *Handler) HandleBroadcast(json []byte)

HandleBroadcast provides a mock function with given fields: json

func (*Handler) HandlePubSub added in v1.1.4

func (_m *Handler) HandlePubSub(json []byte)

HandlePubSub provides a mock function with given fields: json

func (*Handler) Logger added in v1.5.0

func (_m *Handler) Logger() *slog.Logger

Logger provides a mock function with given fields:

type Identifier added in v1.2.0

type Identifier struct {
	mock.Mock
}

Identifier is an autogenerated mock type for the Identifier type

func NewIdentifier added in v1.4.0

func NewIdentifier(t mockConstructorTestingTNewIdentifier) *Identifier

NewIdentifier creates a new instance of Identifier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*Identifier) Identify added in v1.2.0

func (_m *Identifier) Identify(sid string, env *common.SessionEnv) (*common.ConnectResult, error)

Identify provides a mock function with given fields: sid, env

type Instrumenter added in v1.4.0

type Instrumenter struct {
	mock.Mock
}

Instrumenter is an autogenerated mock type for the Instrumenter type

func NewInstrumenter added in v1.4.0

func NewInstrumenter(t mockConstructorTestingTNewInstrumenter) *Instrumenter

NewInstrumenter creates a new instance of Instrumenter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*Instrumenter) CounterAdd added in v1.4.0

func (_m *Instrumenter) CounterAdd(name string, val uint64)

CounterAdd provides a mock function with given fields: name, val

func (*Instrumenter) CounterIncrement added in v1.4.0

func (_m *Instrumenter) CounterIncrement(name string)

CounterIncrement provides a mock function with given fields: name

func (*Instrumenter) GaugeDecrement added in v1.4.0

func (_m *Instrumenter) GaugeDecrement(name string)

GaugeDecrement provides a mock function with given fields: name

func (*Instrumenter) GaugeIncrement added in v1.4.0

func (_m *Instrumenter) GaugeIncrement(name string)

GaugeIncrement provides a mock function with given fields: name

func (*Instrumenter) GaugeSet added in v1.4.0

func (_m *Instrumenter) GaugeSet(name string, val uint64)

GaugeSet provides a mock function with given fields: name, val

func (*Instrumenter) RegisterCounter added in v1.4.0

func (_m *Instrumenter) RegisterCounter(name string, desc string)

RegisterCounter provides a mock function with given fields: name, desc

func (*Instrumenter) RegisterGauge added in v1.4.0

func (_m *Instrumenter) RegisterGauge(name string, desc string)

RegisterGauge provides a mock function with given fields: name, desc

type MockConnection added in v1.4.0

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

func NewMockConnection added in v1.4.0

func NewMockConnection() MockConnection

func (MockConnection) Close added in v1.4.0

func (conn MockConnection) Close(_code int, _reason string)

func (MockConnection) Descriptor added in v1.4.0

func (conn MockConnection) Descriptor() net.Conn

func (MockConnection) Read added in v1.4.0

func (conn MockConnection) Read() ([]byte, error)

func (MockConnection) ReadIndifinitely added in v1.4.0

func (conn MockConnection) ReadIndifinitely() []byte

func (MockConnection) Write added in v1.4.0

func (conn MockConnection) Write(msg []byte, deadline time.Time) error

func (MockConnection) WriteBinary added in v1.4.0

func (conn MockConnection) WriteBinary(msg []byte, deadline time.Time) error

type MockController

type MockController struct {
	Started bool
}

MockController implements controller interface for tests

func NewMockController

func NewMockController() MockController

NewMockController builds new mock controller instance

func (*MockController) Authenticate

func (c *MockController) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)

Authenticate emulates authentication process: - if path is equal to "failure" then authentication failed - otherwise returns value of headers['id'] as identifier

func (*MockController) Disconnect

func (c *MockController) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error

Disconnect method stub

func (*MockController) Perform

func (c *MockController) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)

Perform return result with Transmissions containing data (i.e. emulates "echo" action)

func (*MockController) Shutdown

func (c *MockController) Shutdown() error

Shutdown changes Started to false

func (*MockController) Start added in v1.1.0

func (c *MockController) Start() error

func (*MockController) Subscribe

func (c *MockController) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)

Subscribe emulates subscription process: - if channel is equal to "failure" then returns subscription error - if channel is equal to "disconnect" then returns result with disconnect set to true - if channel is equal to "stream" then add "stream" to result.Streams - otherwise returns success result with one transmission equal to sid

func (*MockController) Unsubscribe

func (c *MockController) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)

Unsubscribe returns command result

type RPCClient

type RPCClient struct {
	mock.Mock
}

RPCClient is an autogenerated mock type for the RPCClient type

func (*RPCClient) Command

Command provides a mock function with given fields: ctx, in, opts

func (*RPCClient) Connect

Connect provides a mock function with given fields: ctx, in, opts

func (*RPCClient) Disconnect

Disconnect provides a mock function with given fields: ctx, in, opts

type RPCServer added in v1.4.0

type RPCServer struct {
	mock.Mock
}

RPCServer is an autogenerated mock type for the RPCServer type

func (*RPCServer) Command added in v1.4.0

Command provides a mock function with given fields: _a0, _a1

func (*RPCServer) Connect added in v1.4.0

Connect provides a mock function with given fields: _a0, _a1

func (*RPCServer) Disconnect added in v1.4.0

Disconnect provides a mock function with given fields: _a0, _a1

type Subscriber added in v1.4.0

type Subscriber struct {
	mock.Mock
}

Subscriber is an autogenerated mock type for the Subscriber type

func NewSubscriber added in v1.4.0

func NewSubscriber(t mockConstructorTestingTNewSubscriber) *Subscriber

NewSubscriber creates a new instance of Subscriber. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*Subscriber) Broadcast added in v1.4.0

func (_m *Subscriber) Broadcast(msg *common.StreamMessage)

Broadcast provides a mock function with given fields: msg

func (*Subscriber) BroadcastCommand added in v1.4.0

func (_m *Subscriber) BroadcastCommand(msg *common.RemoteCommandMessage)

BroadcastCommand provides a mock function with given fields: msg

func (*Subscriber) IsMultiNode added in v1.4.0

func (_m *Subscriber) IsMultiNode() bool

IsMultiNode provides a mock function with given fields:

func (*Subscriber) Shutdown added in v1.4.0

func (_m *Subscriber) Shutdown(ctx context.Context) error

Shutdown provides a mock function with given fields: ctx

func (*Subscriber) Start added in v1.4.0

func (_m *Subscriber) Start(done chan error) error

Start provides a mock function with given fields: done

func (*Subscriber) Subscribe added in v1.4.0

func (_m *Subscriber) Subscribe(stream string)

Subscribe provides a mock function with given fields: stream

func (*Subscriber) Unsubscribe added in v1.4.0

func (_m *Subscriber) Unsubscribe(stream string)

Unsubscribe provides a mock function with given fields: stream

Jump to

Keyboard shortcuts

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