providertest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package providertest contains a common test suite for persistence.Provider implementations.

Index

Constants

View Source
const DefaultTestTimeout = 10 * time.Second

DefaultTestTimeout is the default test timeout.

Variables

This section is empty.

Functions

func Declare

func Declare(
	before func(context.Context, In) Out,
	after func(),
)

Declare declares a functional test-suite for a specific persistence.Provider implementation.

Types

type In

type In struct {
	// Marshaler marshals and unmarshals the test message types, aggregate roots
	// and process roots.
	Marshaler marshalkit.Marshaler
}

In is a container for values provided by the test suite to the provider-specific initialization code.

type Out

type Out struct {
	// NewProvider is a function that creates a new provider.
	NewProvider func() (p persistence.Provider, close func())

	// IsShared returns true if multiple instances of the same provider access
	// the same data.
	IsShared bool

	// TestTimeout is the maximum duration allowed for each test.
	TestTimeout time.Duration
}

Out is a container for values that are provided by the provider-specific initialization code to the test suite.

type TestContext

type TestContext struct {
	Context context.Context
	In      In
	Out     Out
}

TestContext encapsulates the shared test context passed to the tests for each provider sub-system.

func (*TestContext) SetupDataStore

func (tc *TestContext) SetupDataStore() (persistence.DataStore, func())

SetupDataStore sets up a new data-store.

Jump to

Keyboard shortcuts

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