storage

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

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

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

func TestProviderClose(t *testing.T, provider spi.Provider)

TestProviderClose tests common Provider Close functionality.

func TestProviderGetOpenStores

func TestProviderGetOpenStores(t *testing.T, provider spi.Provider)

TestProviderGetOpenStores tests common Provider GetOpenStores functionality. This test assumes that the provider passed in has never had stores created under it before.

func TestProviderOpenStoreSetGetConfig

func TestProviderOpenStoreSetGetConfig(t *testing.T, provider spi.Provider)

TestProviderOpenStoreSetGetConfig tests common Provider OpenStore, SetStoreConfig, and GetStoreConfig functionality.

func TestPutGet

func TestPutGet(t *testing.T, provider spi.Provider)

TestPutGet tests common Store Put and Get functionality.

func TestStoreBatch

func TestStoreBatch(t *testing.T, provider spi.Provider)

TestStoreBatch tests common Store Batch functionality.

func TestStoreClose

func TestStoreClose(t *testing.T, provider spi.Provider)

TestStoreClose tests common Store Close functionality.

func TestStoreDelete

func TestStoreDelete(t *testing.T, provider spi.Provider)

TestStoreDelete tests common Store Delete functionality.

func TestStoreFlush

func TestStoreFlush(t *testing.T, provider spi.Provider)

TestStoreFlush tests common Store Flush functionality.

func TestStoreGetBulk

func TestStoreGetBulk(t *testing.T, provider spi.Provider)

TestStoreGetBulk tests common Store GetBulk functionality.

func TestStoreGetTags

func TestStoreGetTags(t *testing.T, provider spi.Provider)

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.

Jump to

Keyboard shortcuts

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