mock

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package mock Mocks all Store functions using testify.Mock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(endpoints []string, options *store.Config) (store.Store, error)

New creates a Mock store.

Types

type Lock

type Lock struct {
	mock.Mock
}

Lock mock implementation of Locker.

func (*Lock) Lock

func (l *Lock) Lock(_ context.Context, stopCh chan struct{}) (<-chan struct{}, error)

Lock mock.

func (*Lock) Unlock

func (l *Lock) Unlock(_ context.Context) error

Unlock mock.

type Mock

type Mock struct {
	mock.Mock

	// Endpoints passed to InitializeMock.
	Endpoints []string

	// Options passed to InitializeMock.
	Options *store.Config
}

Mock store. Mocks all Store functions using testify.Mock.

func (*Mock) AtomicDelete

func (s *Mock) AtomicDelete(_ context.Context, key string, previous *store.KVPair) (bool, error)

AtomicDelete mock.

func (*Mock) AtomicPut

func (s *Mock) AtomicPut(_ context.Context, key string, value []byte, previous *store.KVPair, opts *store.WriteOptions) (bool, *store.KVPair, error)

AtomicPut mock.

func (*Mock) Close

func (s *Mock) Close() error

Close mock.

func (*Mock) Delete

func (s *Mock) Delete(_ context.Context, key string) error

Delete mock.

func (*Mock) DeleteTree

func (s *Mock) DeleteTree(_ context.Context, prefix string) error

DeleteTree mock.

func (*Mock) Exists

func (s *Mock) Exists(_ context.Context, key string, opts *store.ReadOptions) (bool, error)

Exists mock.

func (*Mock) Get

func (s *Mock) Get(_ context.Context, key string, opts *store.ReadOptions) (*store.KVPair, error)

Get mock.

func (*Mock) List

func (s *Mock) List(_ context.Context, prefix string, opts *store.ReadOptions) ([]*store.KVPair, error)

List mock.

func (*Mock) NewLock

func (s *Mock) NewLock(_ context.Context, key string, options *store.LockOptions) (store.Locker, error)

NewLock mock.

func (*Mock) Put

func (s *Mock) Put(_ context.Context, key string, value []byte, opts *store.WriteOptions) error

Put mock.

func (*Mock) Watch

func (s *Mock) Watch(_ context.Context, key string, stopCh <-chan struct{}, opts *store.ReadOptions) (<-chan *store.KVPair, error)

Watch mock.

func (*Mock) WatchTree

func (s *Mock) WatchTree(_ context.Context, prefix string, stopCh <-chan struct{}, opts *store.ReadOptions) (<-chan []*store.KVPair, error)

WatchTree mock.

Jump to

Keyboard shortcuts

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