mocks

package
v0.1.8 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: 4 Imported by: 0

Documentation

Overview

Package mocks provides useful mocks for testing different command controller features.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockIterator

type MockIterator struct {
	MoreResults bool
	ErrNext     error
}

MockIterator is a mocked implementation of storage.Iterator.

func (*MockIterator) Close added in v0.1.6

func (m *MockIterator) Close() error

Close always returns a nil error.

func (*MockIterator) Key

func (m *MockIterator) Key() (string, error)

Key is not implemented.

func (*MockIterator) Next

func (m *MockIterator) Next() (bool, error)

Next returns mocked values.

func (*MockIterator) Tags added in v0.1.6

func (m *MockIterator) Tags() ([]storage.Tag, error)

Tags is not implemented.

func (*MockIterator) TotalItems added in v0.1.7

func (m *MockIterator) TotalItems() (int, error)

TotalItems is not implemented.

func (*MockIterator) Value

func (m *MockIterator) Value() ([]byte, error)

Value returns a mocked value.

type MockStore

type MockStore struct {
	Store map[string][]byte

	ErrPut         error
	ErrGet         error
	ErrQuery       error
	ErrDelete      error
	ErrFlush       error
	QueryReturnItr storage.Iterator
	// contains filtered or unexported fields
}

MockStore mock store.

func (*MockStore) Batch added in v0.1.6

func (s *MockStore) Batch([]storage.Operation) error

Batch is not implemented.

func (*MockStore) Close added in v0.1.6

func (s *MockStore) Close() error

Close is not implemented.

func (*MockStore) Delete

func (s *MockStore) Delete(k string) error

Delete will delete record with k key.

func (*MockStore) Flush added in v0.1.6

func (s *MockStore) Flush() error

Flush returns a mocked error.

func (*MockStore) Get

func (s *MockStore) Get(k string) ([]byte, error)

Get fetches the record based on key.

func (*MockStore) GetBulk added in v0.1.6

func (s *MockStore) GetBulk(...string) ([][]byte, error)

GetBulk is not implemented.

func (*MockStore) GetTags added in v0.1.6

func (s *MockStore) GetTags(string) ([]storage.Tag, error)

GetTags is not implemented.

func (*MockStore) Put

func (s *MockStore) Put(k string, v []byte, _ ...storage.Tag) error

Put stores the key and the record.

func (*MockStore) Query added in v0.1.6

Query returns mocked data.

type MockStoreProvider

type MockStoreProvider struct {
	Store              *MockStore
	Custom             storage.Store
	ErrOpenStoreHandle error
	ErrClose           error
	ErrCloseStore      error
	FailNamespace      string
}

MockStoreProvider mock store provider.

func NewCustomMockStoreProvider

func NewCustomMockStoreProvider(customStore storage.Store) *MockStoreProvider

NewCustomMockStoreProvider new mock store provider instance from existing mock store.

func NewMockStoreProvider

func NewMockStoreProvider() *MockStoreProvider

NewMockStoreProvider new store provider instance.

func (*MockStoreProvider) Close

func (s *MockStoreProvider) Close() error

Close closes all stores created under this store provider.

func (*MockStoreProvider) GetOpenStores added in v0.1.6

func (s *MockStoreProvider) GetOpenStores() []storage.Store

GetOpenStores returns the single mocked store.

func (*MockStoreProvider) GetStoreConfig added in v0.1.6

func (s *MockStoreProvider) GetStoreConfig(name string) (storage.StoreConfiguration, error)

GetStoreConfig is not implemented.

func (*MockStoreProvider) OpenStore

func (s *MockStoreProvider) OpenStore(name string) (storage.Store, error)

OpenStore opens and returns a store for given name space.

func (*MockStoreProvider) SetStoreConfig added in v0.1.6

func (s *MockStoreProvider) SetStoreConfig(name string, config storage.StoreConfiguration) error

SetStoreConfig is not implemented.

type Notifier

type Notifier struct {
	NotifyFunc func(topic string, message []byte) error
}

Notifier is mock implementation of notifier.

func NewMockNotifier

func NewMockNotifier() *Notifier

NewMockNotifier returns mock notifier implementation.

func (*Notifier) Notify

func (n *Notifier) Notify(topic string, message []byte) error

Notify is mock implementation of notifier Notify().

Directories

Path Synopsis
Package protocol provides useful mocks for testing different command controller features.
Package protocol provides useful mocks for testing different command controller features.

Jump to

Keyboard shortcuts

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