mocks

package
v0.0.0-...-3231407 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockContentStore

type MockContentStore struct {
	Data map[string]string
}

MockContentStore is a mock implementation of containerd's content store.

func (*MockContentStore) Abort

func (*MockContentStore) Abort(ctx context.Context, ref string) error

func (*MockContentStore) Delete

func (*MockContentStore) Delete(ctx context.Context, dgst digest.Digest) error

func (*MockContentStore) Info

func (m *MockContentStore) Info(ctx context.Context, dgst digest.Digest) (content.Info, error)

Info returns the content.Info for the given digest, if it exists in the mocked data keyed by digest.

func (*MockContentStore) ListStatuses

func (*MockContentStore) ListStatuses(ctx context.Context, filters ...string) ([]content.Status, error)

func (*MockContentStore) ReaderAt

func (m *MockContentStore) ReaderAt(ctx context.Context, desc v1.Descriptor) (content.ReaderAt, error)

ReaderAt returns a content.ReaderAt for the given descriptor, if it exists in the mocked data keyed by digest.

func (*MockContentStore) Status

func (*MockContentStore) Status(ctx context.Context, ref string) (content.Status, error)

func (*MockContentStore) Update

func (*MockContentStore) Update(ctx context.Context, info content.Info, fieldpaths ...string) (content.Info, error)

func (*MockContentStore) Walk

func (*MockContentStore) Walk(ctx context.Context, fn content.WalkFunc, filters ...string) error

func (*MockContentStore) Writer

type MockEventService

type MockEventService struct {
	EnvelopeChan chan *events.Envelope
	ErrorsChan   chan error
}

func (*MockEventService) Forward

func (*MockEventService) Forward(ctx context.Context, envelope *events.Envelope) error

Forward implements containerd.EventService.

func (*MockEventService) Publish

func (*MockEventService) Publish(ctx context.Context, topic string, event events.Event) error

Publish implements containerd.EventService.

func (*MockEventService) Subscribe

func (m *MockEventService) Subscribe(ctx context.Context, filters ...string) (ch <-chan *events.Envelope, errs <-chan error)

Subscribe implements containerd.EventService.

type MockHost

type MockHost struct {
	PeerStore peerstore.Peerstore
}

MockHost provides a mock implementation of host.Host for unit testing.

func (*MockHost) Addrs

func (*MockHost) Addrs() []multiaddr.Multiaddr

func (*MockHost) Close

func (*MockHost) Close() error

func (*MockHost) ConnManager

func (*MockHost) ConnManager() connmgr.ConnManager

func (*MockHost) Connect

func (*MockHost) Connect(ctx context.Context, pi peer.AddrInfo) error

func (*MockHost) EventBus

func (*MockHost) EventBus() event.Bus

func (*MockHost) ID

func (*MockHost) ID() peer.ID

ID returns the peer ID of this host.

func (*MockHost) Mux

func (*MockHost) Mux() protocol.Switch

func (*MockHost) Network

func (*MockHost) Network() network.Network

func (*MockHost) NewStream

func (*MockHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error)

func (*MockHost) Peerstore

func (m *MockHost) Peerstore() peerstore.Peerstore

Peerstore returns the mocked peerstore of this host.

func (*MockHost) RemoveStreamHandler

func (*MockHost) RemoveStreamHandler(pid protocol.ID)

func (*MockHost) SetStreamHandler

func (*MockHost) SetStreamHandler(pid protocol.ID, handler network.StreamHandler)

func (*MockHost) SetStreamHandlerMatch

func (*MockHost) SetStreamHandlerMatch(protocol.ID, func(protocol.ID) bool, network.StreamHandler)

type MockImageStore

type MockImageStore struct {
	Data map[string]images.Image
}

MockImageStore is a mock implementation of containerd's image store.

func (*MockImageStore) Create

func (*MockImageStore) Create(ctx context.Context, image images.Image) (images.Image, error)

func (*MockImageStore) Delete

func (*MockImageStore) Delete(ctx context.Context, name string, opts ...images.DeleteOpt) error

func (*MockImageStore) Get

func (m *MockImageStore) Get(ctx context.Context, name string) (images.Image, error)

Get gets an image by name if it exists in the mocked data keyed by name.

func (*MockImageStore) List

func (m *MockImageStore) List(ctx context.Context, filters ...string) ([]images.Image, error)

List lists the images in the image store filtered by the given filters. Note that only some filters are recognized by this mock implementation.

func (*MockImageStore) Update

func (*MockImageStore) Update(ctx context.Context, image images.Image, fieldpaths ...string) (images.Image, error)

type MockPeerstore

type MockPeerstore struct{}

MockPeerstore provides a mock implementation of peerstore.Peerstore for unit testing.

func (*MockPeerstore) AddAddr

func (*MockPeerstore) AddAddr(p peer.ID, addr multiaddr.Multiaddr, ttl time.Duration)

func (*MockPeerstore) AddAddrs

func (*MockPeerstore) AddAddrs(p peer.ID, addrs []multiaddr.Multiaddr, ttl time.Duration)

func (*MockPeerstore) AddPrivKey

func (*MockPeerstore) AddPrivKey(peer.ID, crypto.PrivKey) error

func (*MockPeerstore) AddProtocols

func (*MockPeerstore) AddProtocols(peer.ID, ...protocol.ID) error

func (*MockPeerstore) AddPubKey

func (*MockPeerstore) AddPubKey(peer.ID, crypto.PubKey) error

func (*MockPeerstore) AddrStream

func (*MockPeerstore) AddrStream(context.Context, peer.ID) <-chan multiaddr.Multiaddr

func (*MockPeerstore) Addrs

func (*MockPeerstore) Addrs(p peer.ID) []multiaddr.Multiaddr

func (*MockPeerstore) ClearAddrs

func (*MockPeerstore) ClearAddrs(p peer.ID)

func (*MockPeerstore) Close

func (*MockPeerstore) Close() error

func (*MockPeerstore) FirstSupportedProtocol

func (*MockPeerstore) FirstSupportedProtocol(peer.ID, ...protocol.ID) (protocol.ID, error)

func (*MockPeerstore) Get

func (*MockPeerstore) Get(p peer.ID, key string) (interface{}, error)

func (*MockPeerstore) GetProtocols

func (*MockPeerstore) GetProtocols(peer.ID) ([]protocol.ID, error)

func (*MockPeerstore) LatencyEWMA

func (*MockPeerstore) LatencyEWMA(peer.ID) time.Duration

func (*MockPeerstore) PeerInfo

func (*MockPeerstore) PeerInfo(peer.ID) peer.AddrInfo

func (*MockPeerstore) Peers

func (*MockPeerstore) Peers() peer.IDSlice

func (*MockPeerstore) PeersWithAddrs

func (*MockPeerstore) PeersWithAddrs() peer.IDSlice

func (*MockPeerstore) PeersWithKeys

func (*MockPeerstore) PeersWithKeys() peer.IDSlice

func (*MockPeerstore) PrivKey

func (*MockPeerstore) PrivKey(peer.ID) crypto.PrivKey

PrivKey generates a new private key for the given peer.

func (*MockPeerstore) PubKey

func (*MockPeerstore) PubKey(peer.ID) crypto.PubKey

func (*MockPeerstore) Put

func (*MockPeerstore) Put(p peer.ID, key string, val interface{}) error

func (*MockPeerstore) RecordLatency

func (*MockPeerstore) RecordLatency(peer.ID, time.Duration)

func (*MockPeerstore) RemovePeer

func (*MockPeerstore) RemovePeer(peer.ID)

func (*MockPeerstore) RemoveProtocols

func (*MockPeerstore) RemoveProtocols(peer.ID, ...protocol.ID) error

func (*MockPeerstore) SetAddr

func (*MockPeerstore) SetAddr(p peer.ID, addr multiaddr.Multiaddr, ttl time.Duration)

func (*MockPeerstore) SetAddrs

func (*MockPeerstore) SetAddrs(p peer.ID, addrs []multiaddr.Multiaddr, ttl time.Duration)

func (*MockPeerstore) SetProtocols

func (*MockPeerstore) SetProtocols(peer.ID, ...protocol.ID) error

func (*MockPeerstore) SupportsProtocols

func (*MockPeerstore) SupportsProtocols(peer.ID, ...protocol.ID) ([]protocol.ID, error)

func (*MockPeerstore) UpdateAddrs

func (*MockPeerstore) UpdateAddrs(p peer.ID, oldTTL time.Duration, newTTL time.Duration)

Jump to

Keyboard shortcuts

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