testing

package
v1.1.38 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package testing provides utilities for testing code that requires a Vault client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeVaultServer

type FakeVaultServer struct {
	// contains filtered or unexported fields
}

func NewFakeVaultServer

func NewFakeVaultServer(t *testing.T) *FakeVaultServer

NewFakeVaultServer returns a new fake vault server that can be used to fake vault secret lookups

func (*FakeVaultServer) ConfigureClient

func (s *FakeVaultServer) ConfigureClient(clientConfig *vaultapi.Config)

ConfigureClient can be used to configure a vault client to talk to this fake vault server instance

func (*FakeVaultServer) ExpectGithubLogin

func (s *FakeVaultServer) ExpectGithubLogin(githubToken string, vaultToken string)

ExpectGithubLogin configures the server to expect a github login with a specific Github token (by default any token is expected)

func (*FakeVaultServer) GetClient added in v1.0.55

func (s *FakeVaultServer) GetClient() *vaultapi.Client

GetClient can be used to quickly construct a vault client connected to this fake vault server instance

func (*FakeVaultServer) Server added in v0.0.53

func (s *FakeVaultServer) Server() *httptest.Server

Server returns the underlying httptest.Server associated with this fake vault server instance

func (*FakeVaultServer) SetSecret

func (s *FakeVaultServer) SetSecret(path string, data map[string]interface{})

SetSecret adds a secret to the fake server

Jump to

Keyboard shortcuts

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