Documentation ¶
Overview ¶
Package storage contains common tests for storage provider implementations. These tests are intended to demonstrate the expected behaviour as defined in the documentation above the spi.Provider, spi.Store and spi.Iterator interface declarations.
Index ¶
- func TestAll(t *testing.T, provider spi.Provider, opts ...TestOption)
- func TestProviderClose(t *testing.T, provider spi.Provider)
- func TestProviderGetOpenStores(t *testing.T, provider spi.Provider)
- func TestProviderOpenStoreSetGetConfig(t *testing.T, provider spi.Provider)
- func TestPutGet(t *testing.T, provider spi.Provider)
- func TestStoreBatch(t *testing.T, provider spi.Provider)
- func TestStoreClose(t *testing.T, provider spi.Provider)
- func TestStoreDelete(t *testing.T, provider spi.Provider)
- func TestStoreFlush(t *testing.T, provider spi.Provider)
- func TestStoreGetBulk(t *testing.T, provider spi.Provider)
- func TestStoreGetTags(t *testing.T, provider spi.Provider)
- func TestStoreQuery(t *testing.T, provider spi.Provider, opts ...TestOption)
- func TestStoreQueryWithSortingAndInitialPageOptions(t *testing.T, provider spi.Provider, opts ...TestOption)
- type TestOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestAll ¶
func TestAll(t *testing.T, provider spi.Provider, opts ...TestOption)
TestAll tests common storage functionality. These tests demonstrate behaviour that is expected to be consistent across store implementations. Some tests can be skipped by passing in the appropriate TestOptions here.
func TestProviderClose ¶
TestProviderClose tests common Provider Close functionality.
func TestProviderGetOpenStores ¶
TestProviderGetOpenStores tests common Provider GetOpenStores functionality. This test assumes that the provider passed in has never had stores created under it before.
func TestProviderOpenStoreSetGetConfig ¶
TestProviderOpenStoreSetGetConfig tests common Provider OpenStore, SetStoreConfig, and GetStoreConfig functionality.
func TestPutGet ¶
TestPutGet tests common Store Put and Get functionality.
func TestStoreBatch ¶
TestStoreBatch tests common Store Batch functionality.
func TestStoreClose ¶
TestStoreClose tests common Store Close functionality.
func TestStoreDelete ¶
TestStoreDelete tests common Store Delete functionality.
func TestStoreFlush ¶
TestStoreFlush tests common Store Flush functionality.
func TestStoreGetBulk ¶
TestStoreGetBulk tests common Store GetBulk functionality.
func TestStoreGetTags ¶
TestStoreGetTags tests common Store GetTags functionality.
func TestStoreQuery ¶
func TestStoreQuery(t *testing.T, provider spi.Provider, opts ...TestOption)
TestStoreQuery tests common Store Query functionality.
func TestStoreQueryWithSortingAndInitialPageOptions ¶
func TestStoreQueryWithSortingAndInitialPageOptions(t *testing.T, provider spi.Provider, opts ...TestOption)
TestStoreQueryWithSortingAndInitialPageOptions tests common Store Query functionality when the sorting and initial page options are used.
Types ¶
type TestOption ¶
type TestOption func(opts *testOptions)
TestOption is an option for test behaviour.
func SkipIteratorTotalItemTests ¶
func SkipIteratorTotalItemTests(onlySkipTestsThatDoNotSetStoreConfig bool) TestOption
SkipIteratorTotalItemTests causes all checks of an iterator's TotalItems method to be skipped. If onlySkipTestsThatDoNotSetStoreConfig is set to true, then instead of skipping all TotalItems tests, only those that don't set a store configuration will be skipped. This option is designed to allow storage implementations that don't have the TotalItems method implemented (or can only run it when a store config is set) to disable specific tests while still running as many tests as possible from this test suite.
func SkipOpenStoreSetGetStoreConfigTests ¶
func SkipOpenStoreSetGetStoreConfigTests() TestOption
SkipOpenStoreSetGetStoreConfigTests causes the tests in TestProviderOpenStoreSetGetConfig to be skipped.
func SkipSortTests ¶
func SkipSortTests(onlySkipTestsThatDoNotSetStoreConfig bool) TestOption
SkipSortTests skips all tests that do queries with sort options. If onlySkipTestsThatDoNotSetStoreConfig is set to true, then instead of skipping all sort tests, only those that don't set a store configuration will be skipped. This option is designed to allow storage implementations that don't support query sort options (or can only sort when a store config is set) to disable specific tests while still running as many tests as possible from this test suite.