teststorage

package
v1.9.9 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MPL-2.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseRaftStorage added in v1.5.0

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

CloseRaftStorage closes open files being used by raft.

func ClusterSetup added in v1.4.0

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, extraConf map[string]interface{}) *vault.PhysicalBackendBundle

func MakeReusableRaftHAStorage added in v1.5.0

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

func MakeReusableRaftStorage added in v1.5.0

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 added in v1.5.0

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 added in v1.5.0

func RaftHAFactory(f PhysicalBackendBundler) func(t testing.T, coreIdx int, logger hclog.Logger, conf map[string]interface{}) *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 added in v1.5.0

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, conf map[string]interface{}) *vault.PhysicalBackendBundle

Types

type ClusterSetupMutator

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

type PhysicalBackendBundler added in v1.5.0

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

type ReusableStorage added in v1.5.0

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 added in v1.5.0

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