Help us shape the future of Go! Take the 2026 Go Developer Survey

storetest

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package storetest provides the shared unit-test suite that every binarystore implementation runs against a fake backend. Keeping the suite in one place means the providers are held to the same behaviour: identical sentinel errors, identical create-only and overwrite semantics, identical streaming and prefix handling.

The conformance suite in tests/conformance/binarystore asserts the same behaviour against real backends; this suite is its offline counterpart.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunSuite

func RunSuite(t *testing.T, newHarness Factory)

RunSuite runs the shared binary store behaviour suite, once against a store without a prefix and once against a store configured with a prefix.

Types

type EmptyReader

type EmptyReader struct{}

EmptyReader is an io.Reader that immediately reports io.EOF.

It is deliberately not one of the concrete types (*bytes.Buffer, *bytes.Reader, *strings.Reader, *os.File) that provider SDKs special-case when detecting zero-length bodies. Readers handed to a component by the Dapr runtime have this shape, so using it here catches providers that only support empty payloads for the special-cased types.

func (EmptyReader) Read

func (EmptyReader) Read([]byte) (int, error)

Read implements io.Reader.

type Factory

type Factory func(t *testing.T, prefix string) Harness

Factory builds a Harness for a store configured with the given prefix.

type Harness

type Harness struct {
	// Store is an initialised binary store configured with Prefix.
	Store binarystore.BinaryStore

	// Prefix is the object prefix the store was configured with.
	Prefix string

	// Names returns the object names currently held by the backend, as the
	// backend sees them (so including Prefix). It may be nil if the backend
	// cannot enumerate its contents, in which case prefix assertions are
	// skipped.
	Names func() []string
}

Harness is a single provider instance wired to a fake backend.

Jump to

Keyboard shortcuts

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