teststorage

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseRaftStorage

func CloseRaftStorage(t testing.T, cluster *vault.TestCluster, idx int)

CloseRaftStorage closes open files being used by raft.

func FileBackendSetup

func FileBackendSetup(conf *vault.CoreConfig, opts *vault.TestClusterOptions)

func InmemBackendSetup

func InmemBackendSetup(conf *vault.CoreConfig, opts *vault.TestClusterOptions)

func InmemNonTransactionalBackendSetup

func InmemNonTransactionalBackendSetup(conf *vault.CoreConfig, opts *vault.TestClusterOptions)

func MakeFileBackend

func MakeFileBackend(t testing.T, logger hclog.Logger) *vault.PhysicalBackendBundle

func MakeInmemBackend

func MakeInmemBackend(t testing.T, logger hclog.Logger) *vault.PhysicalBackendBundle

func MakeInmemNonTransactionalBackend

func MakeInmemNonTransactionalBackend(t testing.T, logger hclog.Logger) *vault.PhysicalBackendBundle

func MakeRaftBackend

func MakeRaftBackend(t testing.T, coreIdx int, logger hclog.Logger) *vault.PhysicalBackendBundle

func MakeRaftBackendWithConf

func MakeRaftBackendWithConf(t testing.T, coreIdx int, logger hclog.Logger, extraConf map[string]string) *vault.PhysicalBackendBundle

func MakeReusableRaftHAStorage

func MakeReusableRaftHAStorage(t testing.T, logger hclog.Logger, numCores int, bundle *vault.PhysicalBackendBundle) (ReusableStorage, StorageCleanup)

func MakeReusableRaftStorage

func MakeReusableRaftStorage(t testing.T, logger hclog.Logger, numCores int, addressProvider raftlib.ServerAddressProvider) (ReusableStorage, StorageCleanup)

MakeReusableRaftStorage makes a physical raft backend that can be re-used across multiple test clusters in sequence.

func MakeReusableStorage

func MakeReusableStorage(t testing.T, logger hclog.Logger, bundle *vault.PhysicalBackendBundle) (ReusableStorage, StorageCleanup)

MakeReusableStorage makes a physical backend that can be re-used across multiple test clusters in sequence.

func RaftBackendSetup

func RaftBackendSetup(conf *vault.CoreConfig, opts *vault.TestClusterOptions)

func RaftHAFactory

func RaftHAFactory(f PhysicalBackendBundler) func(t testing.T, coreIdx int, logger hclog.Logger) *vault.PhysicalBackendBundle

RaftHAFactory returns a PhysicalBackendBundle with raft set as the HABackend and the physical.Backend provided in PhysicalBackendBundler as the storage backend.

func RaftHASetup

func RaftHASetup(conf *vault.CoreConfig, opts *vault.TestClusterOptions, bundler PhysicalBackendBundler)

func SharedPhysicalFactory

func SharedPhysicalFactory(f PhysicalBackendBundler) func(t testing.T, coreIdx int, logger hclog.Logger) *vault.PhysicalBackendBundle

Types

type ClusterSetupMutator

type ClusterSetupMutator func(conf *vault.CoreConfig, opts *vault.TestClusterOptions)

type PhysicalBackendBundler

type PhysicalBackendBundler func(t testing.T, logger hclog.Logger) *vault.PhysicalBackendBundle

type ReusableStorage

type ReusableStorage struct {

	// IsRaft specifies whether the storage is using a raft backend.
	IsRaft bool

	// Setup should be called just before a new TestCluster is created.
	Setup ClusterSetupMutator

	// Cleanup should be called after a TestCluster is no longer
	// needed -- generally in a defer, just before the call to
	// cluster.Cleanup().
	Cleanup func(t testing.T, cluster *vault.TestCluster)
}

ReusableStorage is a physical backend that can be re-used across multiple test clusters in sequence. It is useful for testing things like seal migration, wherein a given physical backend must be re-used as several test clusters are sequentially created, tested, and discarded.

type StorageCleanup

type StorageCleanup func()

StorageCleanup is a function that should be called once -- at the very end of a given unit test, after each of the sequence of clusters have been created, tested, and discarded.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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