vault: github.com/hashicorp/vault/helper/testhelpers/teststorage Index | Files

package teststorage

import "github.com/hashicorp/vault/helper/testhelpers/teststorage"

Index

Package Files

teststorage.go teststorage_reusable.go

func CloseRaftStorage Uses

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

CloseRaftStorage closes open files being used by raft.

func ClusterSetup Uses

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

func ConsulBackendSetup Uses

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

func FileBackendSetup Uses

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

func InmemBackendSetup Uses

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

func InmemNonTransactionalBackendSetup Uses

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

func MakeConsulBackend Uses

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

func MakeFileBackend Uses

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

func MakeInmemBackend Uses

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

func MakeInmemNonTransactionalBackend Uses

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

func MakeRaftBackend Uses

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

func MakeReusableRaftHAStorage Uses

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

func MakeReusableRaftStorage Uses

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 Uses

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 Uses

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

func RaftHAFactory Uses

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 Uses

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

func SharedPhysicalFactory Uses

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

type ClusterSetupMutator Uses

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

type PhysicalBackendBundler Uses

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

type ReusableStorage Uses

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 Uses

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.

Package teststorage imports 17 packages (graph) and is imported by 2 packages. Updated 2020-07-15. Refresh now. Tools for package owners.