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

package testhelpers

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

Index

Package Files

testhelpers.go

func AttemptUnsealCore Uses

func AttemptUnsealCore(c *vault.TestCluster, core *vault.TestClusterCore) error

func AttemptUnsealCores Uses

func AttemptUnsealCores(c *vault.TestCluster) error

func AwaitLeader Uses

func AwaitLeader(t testing.T, cluster *vault.TestCluster) (int, error)

AwaitLeader waits for one of the cluster's nodes to become leader.

func DeriveActiveCore Uses

func DeriveActiveCore(t testing.T, cluster *vault.TestCluster) *vault.TestClusterCore

func DeriveStableActiveCore Uses

func DeriveStableActiveCore(t testing.T, cluster *vault.TestCluster) *vault.TestClusterCore

func DeriveStandbyCores Uses

func DeriveStandbyCores(t testing.T, cluster *vault.TestCluster) []*vault.TestClusterCore

func EnsureCoreSealed Uses

func EnsureCoreSealed(t testing.T, core *vault.TestClusterCore)

func EnsureCoreUnsealed Uses

func EnsureCoreUnsealed(t testing.T, c *vault.TestCluster, core *vault.TestClusterCore)

func EnsureCoresSealed Uses

func EnsureCoresSealed(t testing.T, c *vault.TestCluster)

func EnsureCoresUnsealed Uses

func EnsureCoresUnsealed(t testing.T, c *vault.TestCluster)

func EnsureStableActiveNode Uses

func EnsureStableActiveNode(t testing.T, cluster *vault.TestCluster)

func GenerateDebugLogs Uses

func GenerateDebugLogs(t testing.T, client *api.Client) chan struct{}

func GenerateRoot Uses

func GenerateRoot(t testing.T, cluster *vault.TestCluster, kind GenerateRootKind) string

Generates a root token on the target cluster.

func GenerateRootWithError Uses

func GenerateRootWithError(t testing.T, cluster *vault.TestCluster, kind GenerateRootKind) (string, error)

func NewHardcodedServerAddressProvider Uses

func NewHardcodedServerAddressProvider(numCores, baseClusterPort int) raftlib.ServerAddressProvider

NewHardcodedServerAddressProvider is a convenience function that makes a ServerAddressProvider from a given cluster address base port.

func RaftClusterJoinNodes Uses

func RaftClusterJoinNodes(t testing.T, cluster *vault.TestCluster)

func RandomWithPrefix Uses

func RandomWithPrefix(name string) string

RandomWithPrefix is used to generate a unique name with a prefix, for randomizing names in acceptance tests

func RekeyCluster Uses

func RekeyCluster(t testing.T, cluster *vault.TestCluster, recovery bool) [][]byte

func VerifyRaftConfiguration Uses

func VerifyRaftConfiguration(core *vault.TestClusterCore, numCores int) error

VerifyRaftConfiguration checks that we have a valid raft configuration, i.e. the correct number of servers, having the correct NodeIDs, and exactly one leader.

func WaitForActiveNode Uses

func WaitForActiveNode(t testing.T, cluster *vault.TestCluster) *vault.TestClusterCore

func WaitForNCoresSealed Uses

func WaitForNCoresSealed(t testing.T, cluster *vault.TestCluster, n int)

func WaitForNCoresUnsealed Uses

func WaitForNCoresUnsealed(t testing.T, cluster *vault.TestCluster, n int)

func WaitForStandbyNode Uses

func WaitForStandbyNode(t testing.T, core *vault.TestClusterCore)

type GenerateRootKind Uses

type GenerateRootKind int
const (
    GenerateRootRegular GenerateRootKind = iota
    GenerateRootDR
    GenerateRecovery
)

type HardcodedServerAddressProvider Uses

type HardcodedServerAddressProvider struct {
    Entries map[raftlib.ServerID]raftlib.ServerAddress
}

HardcodedServerAddressProvider is a ServerAddressProvider that uses a hardcoded map of raft node addresses.

It is useful in cases where the raft configuration is known ahead of time, but some of the cores have not yet had startClusterListener() called (via either unsealing or raft joining), and thus do not yet have a ClusterAddr() assigned.

func (*HardcodedServerAddressProvider) ServerAddr Uses

func (p *HardcodedServerAddressProvider) ServerAddr(id raftlib.ServerID) (raftlib.ServerAddress, error)

type TestRaftServerAddressProvider Uses

type TestRaftServerAddressProvider struct {
    Cluster *vault.TestCluster
}

TestRaftServerAddressProvider is a ServerAddressProvider that uses the ClusterAddr() of each node to provide raft addresses.

Note that TestRaftServerAddressProvider should only be used in cases where cores that are part of a raft configuration have already had startClusterListener() called (via either unsealing or raft joining).

func (*TestRaftServerAddressProvider) ServerAddr Uses

func (p *TestRaftServerAddressProvider) ServerAddr(id raftlib.ServerID) (raftlib.ServerAddress, error)

Directories

PathSynopsis
certhelpers
consul
docker
ldap
logical
mongodb
mssql
mysql
postgresql
seal
teststorage

Package testhelpers imports 15 packages (graph) and is imported by 4 packages. Updated 2020-06-26. Refresh now. Tools for package owners.