helper

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

This package contains code that makes it easy to test code that interacts with Hashicorp Vault, by enabling the creation of an in-memory Vault

cluster that is easily disposed of once testing is complete.

Index

Constants

View Source
const (
	ColorRed   = "\033[31m"
	ColorReset = "\033[0m"
)

Variables

This section is empty.

Functions

func CreateTestCluster

func CreateTestCluster(t *testing.T) (net.Listener, *api.Client)

CreateTestCluster creates an in-memory Vault cluster that can be used for testing code that interacts with Vault.

func GetVaultClientE

func GetVaultClientE(config *api.Config, token string) (client.VaultLogicalClient, error)

func MountVaultSecretEngine

func MountVaultSecretEngine(t *testing.T, client client.VaultSysClient, path string, mountType string, options map[string]string)

MountVaultSecretEngine configures a new mount within a Vault cluster. It can be used to configure the in-memory Vault client with other mounts beyond the default KV at the `secret/` path.

func ReadVaultSecretE

func ReadVaultSecretE(client client.VaultLogicalClient, path string) (*api.Secret, error)

ReadVaultSecretE reads a secret at the given path from Vault. It is basically a thin wrapper around the built in [Read](https://pkg.go.dev/github.com/hashicorp/vault/api#Logical.Read) method, done for the purpose of making testing of this library easier.

Types

This section is empty.

Jump to

Keyboard shortcuts

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