vault

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package vault is a package meant for internal testing only. The interfaces may change or be removed at any time without warning.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestOption

type TestOption func(*testing.T, *testOptions)

TestOption - how Options are passed as arguments.

func WithDockerNetwork

func WithDockerNetwork(b bool) TestOption

WithDockerNetwork sets the option to create docker network when creating a Vault test server. The default is to not create a docker network.

func WithTestVaultTLS

func WithTestVaultTLS(s TestVaultTLS) TestOption

WithTestVaultTLS sets the Vault TLS option. TestNoTLS is the default TLS option.

type TestVaultServer

type TestVaultServer struct {
	*vault.TestVaultServer
}

TestVaultServer is a vault server running in a docker container suitable for testing.

func NewTestVaultServer

func NewTestVaultServer(t *testing.T, opt ...TestOption) *TestVaultServer

NewTestVaultServer creates and returns a TestVaultServer. Some Vault secret engines require the Vault server be created with a docker network. Check the Mount method for the Vault secret engine to see if a docker network is required.

WithTestVaultTLS and WithDockerNetwork are the only valid options. Setting the WithDockerNetwork option can significantly increase the amount of time required for a test to run.

type TestVaultTLS

type TestVaultTLS int

TestVaultTLS represents the TLS configuration level of a TestVaultServer.

const (
	// TestNoTLS disables TLS. The test server Addr begins with http://.
	TestNoTLS TestVaultTLS = iota // no TLS

	// TestServerTLS configures the Vault test server listener to use TLS.
	// A CA certificate is generated and a server certificate is issued
	// from the CA certificate. The CA certificate is available in the
	// CaCert field of the TestVaultServer. The test server Addr begins
	// with https://.
	TestServerTLS

	// TestClientTLS configures the Vault test server listener to require a
	// client certificate for mTLS and includes all of the settings from
	// TestServerTLS. A second CA certificate is generated and a client
	// certificate is issued from this CA certificate. The client
	// certificate and the client certificate key are available in the in
	// the ClientCert and ClientKey fields of the TestVaultServer
	// respectively.
	TestClientTLS
)

Jump to

Keyboard shortcuts

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