test

package
v0.8.2 Latest Latest
Warning

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

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

README

Generic KVStore implementation tests

These are a set of common tests that should pass on any correct KVStore implementation.

Each test function in this package has the form:

func CommonTest<name>(t *testing.T, s store.KVStore) {...}

A KVStore implementation test should use the same name, including its own KVStore name in the test function. It should instantiate an instance of the store, and pass the testing.T and store to the common function.

The common test functions should NOT close the KVStore. The KVStore test implementation should close the store and cleanup any state.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommonTestKVCrud

func CommonTestKVCrud(t *testing.T, s store.KVStore)

func CommonTestMerge

func CommonTestMerge(t *testing.T, s store.KVStore)

func CommonTestPrefixIterator

func CommonTestPrefixIterator(t *testing.T, s store.KVStore)

func CommonTestPrefixIteratorSeek

func CommonTestPrefixIteratorSeek(t *testing.T, s store.KVStore)

func CommonTestRangeIterator

func CommonTestRangeIterator(t *testing.T, s store.KVStore)

func CommonTestRangeIteratorSeek

func CommonTestRangeIteratorSeek(t *testing.T, s store.KVStore)

func CommonTestReaderIsolation

func CommonTestReaderIsolation(t *testing.T, s store.KVStore)

func CommonTestReaderOwnsGetBytes

func CommonTestReaderOwnsGetBytes(t *testing.T, s store.KVStore)

CommonTestReaderOwnsGetBytes attempts to mutate the returned bytes first, while the reader is still open, second after that reader is closed, then the original key is read again, to ensure these modifications did not cause panic, or mutate the stored value

func CommonTestWriterOwnsBytes

func CommonTestWriterOwnsBytes(t *testing.T, s store.KVStore)

Types

type TestMergeCounter

type TestMergeCounter struct{}

a test merge operator which is just an incrementing counter of uint64

func (*TestMergeCounter) FullMerge

func (mc *TestMergeCounter) FullMerge(key, existingValue []byte, operands [][]byte) ([]byte, bool)

func (*TestMergeCounter) Name

func (mc *TestMergeCounter) Name() string

func (*TestMergeCounter) PartialMerge

func (mc *TestMergeCounter) PartialMerge(key, leftOperand, rightOperand []byte) ([]byte, bool)

Jump to

Keyboard shortcuts

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