Documentation ¶
Index ¶
- Variables
- func NewHttpTestEchoHandler() *httptest.Server
- type ConnectionsHandlerStub
- func (stub *ConnectionsHandlerStub) Addresses() []string
- func (stub *ConnectionsHandlerStub) Bootstrap() error
- func (stub *ConnectionsHandlerStub) Close() error
- func (stub *ConnectionsHandlerStub) ConnectToPeer(address string) error
- func (stub *ConnectionsHandlerStub) ConnectedAddresses() []string
- func (stub *ConnectionsHandlerStub) ConnectedPeers() []core.PeerID
- func (stub *ConnectionsHandlerStub) ConnectedPeersOnTopic(topic string) []core.PeerID
- func (stub *ConnectionsHandlerStub) GetConnectedPeersInfo() *p2p.ConnectedPeersInfo
- func (stub *ConnectionsHandlerStub) IsConnected(peerID core.PeerID) bool
- func (stub *ConnectionsHandlerStub) IsConnectedToTheNetwork() bool
- func (stub *ConnectionsHandlerStub) IsInterfaceNil() bool
- func (stub *ConnectionsHandlerStub) PeerAddresses(pid core.PeerID) []string
- func (stub *ConnectionsHandlerStub) Peers() []core.PeerID
- func (stub *ConnectionsHandlerStub) SetPeerDenialEvaluator(handler p2p.PeerDenialEvaluator) error
- func (stub *ConnectionsHandlerStub) SetPeerShardResolver(peerShardResolver p2p.PeerShardResolver) error
- func (stub *ConnectionsHandlerStub) SetThresholdMinConnectedPeers(minConnectedPeers int) error
- func (stub *ConnectionsHandlerStub) ThresholdMinConnectedPeers() int
- func (stub *ConnectionsHandlerStub) WaitForConnections(maxWaitingTime time.Duration, minNumOfPeers uint32)
- type HttpServerStub
- type LoggerMock
- func (c LoggerMock) Debug(message string, args ...interface{})
- func (c LoggerMock) Error(message string, args ...interface{})
- func (c LoggerMock) Info(message string, args ...interface{})
- func (c LoggerMock) IsInterfaceNil() bool
- func (c LoggerMock) LogIfError(err error, args ...interface{})
- func (c LoggerMock) Trace(message string, args ...interface{})
- func (c LoggerMock) Warn(message string, args ...interface{})
- type LoggerStub
- func (stub *LoggerStub) Debug(message string, args ...interface{})
- func (stub *LoggerStub) Error(message string, args ...interface{})
- func (stub *LoggerStub) GetLevel() logger.LogLevel
- func (stub *LoggerStub) Info(message string, args ...interface{})
- func (stub *LoggerStub) IsInterfaceNil() bool
- func (stub *LoggerStub) LogIfError(err error, args ...interface{})
- func (stub *LoggerStub) Trace(message string, args ...interface{})
- func (stub *LoggerStub) Warn(message string, args ...interface{})
- type MarshallerMock
- type MarshallerStub
- type PayloadHandlerStub
- type ProtoMarshallerMock
- type WebsocketConnectionStub
- func (w *WebsocketConnectionStub) Close() error
- func (w *WebsocketConnectionStub) GetID() string
- func (w *WebsocketConnectionStub) IsInterfaceNil() bool
- func (w *WebsocketConnectionStub) IsOpen() bool
- func (w *WebsocketConnectionStub) OpenConnection(url string) error
- func (w *WebsocketConnectionStub) ReadMessage() (messageType int, payload []byte, err error)
- func (w *WebsocketConnectionStub) WriteMessage(messageType int, data []byte) error
Constants ¶
This section is empty.
Variables ¶
var ErrMockMarshaller = errors.New("MarshallerMock generic error")
ErrMockMarshaller -
var ErrNilObjectToMarshal = errors.New("nil object to serialize from")
ErrNilObjectToMarshal -
Functions ¶
func NewHttpTestEchoHandler ¶
NewHttpTestEchoHandler -
Types ¶
type ConnectionsHandlerStub ¶
type ConnectionsHandlerStub struct { BootstrapCalled func() error PeersCalled func() []core.PeerID AddressesCalled func() []string ConnectToPeerCalled func(address string) error IsConnectedCalled func(peerID core.PeerID) bool ConnectedPeersCalled func() []core.PeerID ConnectedAddressesCalled func() []string PeerAddressesCalled func(pid core.PeerID) []string ConnectedPeersOnTopicCalled func(topic string) []core.PeerID SetPeerShardResolverCalled func(peerShardResolver p2p.PeerShardResolver) error GetConnectedPeersInfoCalled func() *p2p.ConnectedPeersInfo WaitForConnectionsCalled func(maxWaitingTime time.Duration, minNumOfPeers uint32) IsConnectedToTheNetworkCalled func() bool ThresholdMinConnectedPeersCalled func() int SetThresholdMinConnectedPeersCalled func(minConnectedPeers int) error SetPeerDenialEvaluatorCalled func(handler p2p.PeerDenialEvaluator) error CloseCalled func() error }
ConnectionsHandlerStub -
func (*ConnectionsHandlerStub) Addresses ¶
func (stub *ConnectionsHandlerStub) Addresses() []string
Addresses -
func (*ConnectionsHandlerStub) Bootstrap ¶
func (stub *ConnectionsHandlerStub) Bootstrap() error
Bootstrap -
func (*ConnectionsHandlerStub) ConnectToPeer ¶
func (stub *ConnectionsHandlerStub) ConnectToPeer(address string) error
ConnectToPeer -
func (*ConnectionsHandlerStub) ConnectedAddresses ¶
func (stub *ConnectionsHandlerStub) ConnectedAddresses() []string
ConnectedAddresses -
func (*ConnectionsHandlerStub) ConnectedPeers ¶
func (stub *ConnectionsHandlerStub) ConnectedPeers() []core.PeerID
ConnectedPeers -
func (*ConnectionsHandlerStub) ConnectedPeersOnTopic ¶
func (stub *ConnectionsHandlerStub) ConnectedPeersOnTopic(topic string) []core.PeerID
ConnectedPeersOnTopic -
func (*ConnectionsHandlerStub) GetConnectedPeersInfo ¶
func (stub *ConnectionsHandlerStub) GetConnectedPeersInfo() *p2p.ConnectedPeersInfo
GetConnectedPeersInfo -
func (*ConnectionsHandlerStub) IsConnected ¶
func (stub *ConnectionsHandlerStub) IsConnected(peerID core.PeerID) bool
IsConnected -
func (*ConnectionsHandlerStub) IsConnectedToTheNetwork ¶
func (stub *ConnectionsHandlerStub) IsConnectedToTheNetwork() bool
IsConnectedToTheNetwork -
func (*ConnectionsHandlerStub) IsInterfaceNil ¶
func (stub *ConnectionsHandlerStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*ConnectionsHandlerStub) PeerAddresses ¶
func (stub *ConnectionsHandlerStub) PeerAddresses(pid core.PeerID) []string
PeerAddresses -
func (*ConnectionsHandlerStub) Peers ¶
func (stub *ConnectionsHandlerStub) Peers() []core.PeerID
Peers -
func (*ConnectionsHandlerStub) SetPeerDenialEvaluator ¶
func (stub *ConnectionsHandlerStub) SetPeerDenialEvaluator(handler p2p.PeerDenialEvaluator) error
SetPeerDenialEvaluator -
func (*ConnectionsHandlerStub) SetPeerShardResolver ¶
func (stub *ConnectionsHandlerStub) SetPeerShardResolver(peerShardResolver p2p.PeerShardResolver) error
SetPeerShardResolver -
func (*ConnectionsHandlerStub) SetThresholdMinConnectedPeers ¶
func (stub *ConnectionsHandlerStub) SetThresholdMinConnectedPeers(minConnectedPeers int) error
SetThresholdMinConnectedPeers -
func (*ConnectionsHandlerStub) ThresholdMinConnectedPeers ¶
func (stub *ConnectionsHandlerStub) ThresholdMinConnectedPeers() int
ThresholdMinConnectedPeers -
func (*ConnectionsHandlerStub) WaitForConnections ¶
func (stub *ConnectionsHandlerStub) WaitForConnections(maxWaitingTime time.Duration, minNumOfPeers uint32)
WaitForConnections -
type HttpServerStub ¶
type HttpServerStub struct { ListenAndServeCalled func() error ShutdownCalled func(ctx context.Context) error }
HttpServerStub -
func (*HttpServerStub) ListenAndServe ¶
func (h *HttpServerStub) ListenAndServe() error
ListenAndServe -
type LoggerMock ¶
type LoggerMock struct { }
LoggerMock -
func (LoggerMock) Debug ¶
func (c LoggerMock) Debug(message string, args ...interface{})
Debug will print a debug log
func (LoggerMock) Error ¶
func (c LoggerMock) Error(message string, args ...interface{})
Error will print an error log
func (LoggerMock) Info ¶
func (c LoggerMock) Info(message string, args ...interface{})
Info will print an info log
func (LoggerMock) IsInterfaceNil ¶
func (c LoggerMock) IsInterfaceNil() bool
IsInterfaceNil returns false as the struct doesn't use pointer receivers
func (LoggerMock) LogIfError ¶
func (c LoggerMock) LogIfError(err error, args ...interface{})
LogIfError will print an error if it is not nil
func (LoggerMock) Trace ¶
func (c LoggerMock) Trace(message string, args ...interface{})
Trace will print a trace log
func (LoggerMock) Warn ¶
func (c LoggerMock) Warn(message string, args ...interface{})
Warn will print a warn log
type LoggerStub ¶
type LoggerStub struct { TraceCalled func(message string, args ...interface{}) DebugCalled func(message string, args ...interface{}) InfoCalled func(message string, args ...interface{}) WarnCalled func(message string, args ...interface{}) ErrorCalled func(message string, args ...interface{}) LogIfErrorCalled func(err error, args ...interface{}) GetLevelCalled func() logger.LogLevel }
LoggerStub -
func (*LoggerStub) Debug ¶
func (stub *LoggerStub) Debug(message string, args ...interface{})
Debug -
func (*LoggerStub) Error ¶
func (stub *LoggerStub) Error(message string, args ...interface{})
Error -
func (*LoggerStub) LogIfError ¶
func (stub *LoggerStub) LogIfError(err error, args ...interface{})
LogIfError -
func (*LoggerStub) Trace ¶
func (stub *LoggerStub) Trace(message string, args ...interface{})
Trace -
type MarshallerMock ¶
type MarshallerMock struct {
Fail bool
}
MarshallerMock that will be used for testing
func (*MarshallerMock) IsInterfaceNil ¶
func (mm *MarshallerMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MarshallerMock) Marshal ¶
func (mm *MarshallerMock) Marshal(obj interface{}) ([]byte, error)
Marshal converts the input object in a slice of bytes
func (*MarshallerMock) Unmarshal ¶
func (mm *MarshallerMock) Unmarshal(obj interface{}, buff []byte) error
Unmarshal applies the serialized values over an instantiated object
type MarshallerStub ¶
type MarshallerStub struct { MarshalCalled func(obj interface{}) ([]byte, error) UnmarshalCalled func(obj interface{}, buff []byte) error }
MarshallerStub -
func (*MarshallerStub) IsInterfaceNil ¶
func (ms *MarshallerStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*MarshallerStub) Marshal ¶
func (ms *MarshallerStub) Marshal(obj interface{}) ([]byte, error)
Marshal -
func (*MarshallerStub) Unmarshal ¶
func (ms *MarshallerStub) Unmarshal(obj interface{}, buff []byte) error
Unmarshal -
type PayloadHandlerStub ¶
type PayloadHandlerStub struct { ProcessPayloadCalled func(payload []byte, topic string, version uint32) error CloseCalled func() error }
PayloadHandlerStub -
func (*PayloadHandlerStub) IsInterfaceNil ¶
func (ph *PayloadHandlerStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*PayloadHandlerStub) ProcessPayload ¶
func (ph *PayloadHandlerStub) ProcessPayload(payload []byte, topic string, version uint32) error
ProcessPayload -
type ProtoMarshallerMock ¶
type ProtoMarshallerMock struct { }
ProtoMarshallerMock implements marshaling with protobuf
func (*ProtoMarshallerMock) IsInterfaceNil ¶
func (pmm *ProtoMarshallerMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ProtoMarshallerMock) Marshal ¶
func (pmm *ProtoMarshallerMock) Marshal(obj interface{}) ([]byte, error)
Marshal does the actual serialization of an object The object to be serialized must implement the gogoProtoObj interface
func (*ProtoMarshallerMock) Unmarshal ¶
func (pmm *ProtoMarshallerMock) Unmarshal(obj interface{}, buff []byte) error
Unmarshal does the actual deserialization of an object The object to be deserialized must implement the gogoProtoObj interface
type WebsocketConnectionStub ¶
type WebsocketConnectionStub struct { OpenConnectionCalled func(url string) error ReadMessageCalled func() (messageType int, payload []byte, err error) WriteMessageCalled func(messageType int, data []byte) error IsOpenCalled func() bool GetIDCalled func() string CloseCalled func() error }
WebsocketConnectionStub -
func (*WebsocketConnectionStub) IsInterfaceNil ¶
func (w *WebsocketConnectionStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*WebsocketConnectionStub) OpenConnection ¶
func (w *WebsocketConnectionStub) OpenConnection(url string) error
OpenConnection -
func (*WebsocketConnectionStub) ReadMessage ¶
func (w *WebsocketConnectionStub) ReadMessage() (messageType int, payload []byte, err error)
ReadMessage -
func (*WebsocketConnectionStub) WriteMessage ¶
func (w *WebsocketConnectionStub) WriteMessage(messageType int, data []byte) error
WriteMessage -