testing

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockDiscoveryClient

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

MockDiscoveryClient mocks a discovery client (other peer in the communication)

func (*MockDiscoveryClient) FindPeers

func (mdc *MockDiscoveryClient) FindPeers(
	ctx context.Context,
	in *proto.FindPeersReq,
	opts ...grpc.CallOption,
) (*proto.FindPeersResp, error)

func (*MockDiscoveryClient) HookFindPeers

func (mdc *MockDiscoveryClient) HookFindPeers(fn findPeersDelegate)

type MockIdentityClient

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

MockIdentityClient mocks an identity client (other peer in the communication)

func (*MockIdentityClient) Hello

func (mic *MockIdentityClient) Hello(
	ctx context.Context,
	in *proto.Status,
	opts ...grpc.CallOption,
) (*proto.Status, error)

func (*MockIdentityClient) HookHello

func (mic *MockIdentityClient) HookHello(fn helloDelegate)

type MockNetworkingServer

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

func NewMockNetworkingServer

func NewMockNetworkingServer() *MockNetworkingServer

func (*MockNetworkingServer) AddPeer

func (m *MockNetworkingServer) AddPeer(id peer.ID, direction network.Direction)

func (*MockNetworkingServer) AddToPeerStore

func (m *MockNetworkingServer) AddToPeerStore(peerInfo *peer.AddrInfo)

func (*MockNetworkingServer) CloseProtocolStream

func (m *MockNetworkingServer) CloseProtocolStream(protocol string, peerID peer.ID) error

func (*MockNetworkingServer) DisconnectFromPeer

func (m *MockNetworkingServer) DisconnectFromPeer(peerID peer.ID, reason string)

func (*MockNetworkingServer) EmitEvent

func (m *MockNetworkingServer) EmitEvent(event *event.PeerEvent)

func (*MockNetworkingServer) FetchOrSetTemporaryDial

func (m *MockNetworkingServer) FetchOrSetTemporaryDial(peerID peer.ID, newValue bool) bool

func (*MockNetworkingServer) GetBootnodeConnCount

func (m *MockNetworkingServer) GetBootnodeConnCount() int64

func (*MockNetworkingServer) GetMockDiscoveryClient

func (m *MockNetworkingServer) GetMockDiscoveryClient() *MockDiscoveryClient

func (*MockNetworkingServer) GetMockIdentityClient

func (m *MockNetworkingServer) GetMockIdentityClient() *MockIdentityClient

func (*MockNetworkingServer) GetMockPeerMetrics

func (m *MockNetworkingServer) GetMockPeerMetrics() *MockPeerMetrics

func (*MockNetworkingServer) GetPeerInfo

func (m *MockNetworkingServer) GetPeerInfo(peerID peer.ID) *peer.AddrInfo

func (*MockNetworkingServer) GetRandomBootnode

func (m *MockNetworkingServer) GetRandomBootnode() *peer.AddrInfo

func (*MockNetworkingServer) GetRandomPeer

func (m *MockNetworkingServer) GetRandomPeer() *peer.ID

func (*MockNetworkingServer) HasFreeConnectionSlot

func (m *MockNetworkingServer) HasFreeConnectionSlot(direction network.Direction) bool

func (*MockNetworkingServer) HookAddPeer

func (m *MockNetworkingServer) HookAddPeer(fn addPeerDelegate)

func (*MockNetworkingServer) HookAddToPeerStore

func (m *MockNetworkingServer) HookAddToPeerStore(fn addToPeerStoreDelegate)

func (*MockNetworkingServer) HookCloseProtocolStream

func (m *MockNetworkingServer) HookCloseProtocolStream(fn closeProtocolStreamDelegate)

func (*MockNetworkingServer) HookDisconnectFromPeer

func (m *MockNetworkingServer) HookDisconnectFromPeer(fn disconnectFromPeerDelegate)

func (*MockNetworkingServer) HookEmitEvent

func (m *MockNetworkingServer) HookEmitEvent(fn emitEventDelegate)

func (*MockNetworkingServer) HookFetchAndSetTemporaryDial

func (m *MockNetworkingServer) HookFetchAndSetTemporaryDial(fn fetchAndSetTemporaryDialDelegate)

func (*MockNetworkingServer) HookGetBootnodeConnCount

func (m *MockNetworkingServer) HookGetBootnodeConnCount(fn getBootnodeConnCountDelegate)

func (*MockNetworkingServer) HookGetPeerInfo

func (m *MockNetworkingServer) HookGetPeerInfo(fn getPeerInfoDelegate)

func (*MockNetworkingServer) HookGetRandomBootnode

func (m *MockNetworkingServer) HookGetRandomBootnode(fn getRandomBootnodeDelegate)

func (*MockNetworkingServer) HookGetRandomPeer

func (m *MockNetworkingServer) HookGetRandomPeer(fn getRandomPeerDelegate)

func (*MockNetworkingServer) HookHasFreeConnectionSlot

func (m *MockNetworkingServer) HookHasFreeConnectionSlot(fn hasFreeConnectionSlotDelegate)

func (*MockNetworkingServer) HookIsTemporaryDial

func (m *MockNetworkingServer) HookIsTemporaryDial(fn isTemporaryDialDelegate)

func (*MockNetworkingServer) HookNewDiscoveryClient

func (m *MockNetworkingServer) HookNewDiscoveryClient(fn newDiscoveryClientDelegate)

func (*MockNetworkingServer) HookNewIdentityClient

func (m *MockNetworkingServer) HookNewIdentityClient(fn newIdentityClientDelegate)

func (*MockNetworkingServer) HookRemoveFromPeerStore

func (m *MockNetworkingServer) HookRemoveFromPeerStore(fn removeFromPeerStoreDelegate)

func (*MockNetworkingServer) HookRemoveTemporaryDial

func (m *MockNetworkingServer) HookRemoveTemporaryDial(fn removeTemporaryDialDelegate)

func (*MockNetworkingServer) HookTemporaryDialPeer

func (m *MockNetworkingServer) HookTemporaryDialPeer(fn temporaryDialPeerDelegate)

func (*MockNetworkingServer) HookUpdatePendingConnCount

func (m *MockNetworkingServer) HookUpdatePendingConnCount(fn updatePendingConnCountDelegate)

func (*MockNetworkingServer) IsTemporaryDial

func (m *MockNetworkingServer) IsTemporaryDial(peerID peer.ID) bool

func (*MockNetworkingServer) NewDiscoveryClient

func (m *MockNetworkingServer) NewDiscoveryClient(peerID peer.ID) (proto.DiscoveryClient, error)

func (*MockNetworkingServer) NewIdentityClient

func (m *MockNetworkingServer) NewIdentityClient(peerID peer.ID) (proto.IdentityClient, error)

func (*MockNetworkingServer) RemoveFromPeerStore

func (m *MockNetworkingServer) RemoveFromPeerStore(peerInfo *peer.AddrInfo)

func (*MockNetworkingServer) RemoveTemporaryDial

func (m *MockNetworkingServer) RemoveTemporaryDial(peerID peer.ID)

func (*MockNetworkingServer) TemporaryDialPeer

func (m *MockNetworkingServer) TemporaryDialPeer(peerAddrInfo *peer.AddrInfo)

func (*MockNetworkingServer) UpdatePendingConnCount

func (m *MockNetworkingServer) UpdatePendingConnCount(delta int64, direction network.Direction)

type MockPeerMetrics

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

MockPeerMetrics is a mock used by the Kademlia routing table

func (*MockPeerMetrics) HookLatencyEWMA

func (m *MockPeerMetrics) HookLatencyEWMA(fn latencyEWMADelegate)

func (*MockPeerMetrics) HookRecordLatency

func (m *MockPeerMetrics) HookRecordLatency(fn recordLatencyDelegate)

func (*MockPeerMetrics) HookRemoveMetricsPeer

func (m *MockPeerMetrics) HookRemoveMetricsPeer(fn removeMetricsPeerDelegate)

func (*MockPeerMetrics) LatencyEWMA

func (m *MockPeerMetrics) LatencyEWMA(id peer.ID) time.Duration

func (*MockPeerMetrics) RecordLatency

func (m *MockPeerMetrics) RecordLatency(id peer.ID, duration time.Duration)

func (*MockPeerMetrics) RemovePeer

func (m *MockPeerMetrics) RemovePeer(id peer.ID)

Jump to

Keyboard shortcuts

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