fake

package
v0.0.0-...-5756e46 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fake contains a fake Vault signer for use in tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeClient

type FakeClient struct {
	NewRequestS  *vault.Request
	RawRequestFn func(r *vault.Request) (*vault.Response, error)
	GotToken     string
	T            *testing.T
}

func NewFakeClient

func NewFakeClient() *FakeClient

func (*FakeClient) CloneConfig

func (c *FakeClient) CloneConfig() *vault.Config

func (*FakeClient) NewRequest

func (c *FakeClient) NewRequest(method, requestPath string) *vault.Request

func (*FakeClient) RawRequest

func (c *FakeClient) RawRequest(r *vault.Request) (*vault.Response, error)

func (*FakeClient) SetToken

func (c *FakeClient) SetToken(v string)

func (*FakeClient) WithNewRequest

func (c *FakeClient) WithNewRequest(r *vault.Request) *FakeClient

func (*FakeClient) WithRawRequest

func (c *FakeClient) WithRawRequest(resp *vault.Response, err error) *FakeClient

func (*FakeClient) WithRawRequestFn

func (c *FakeClient) WithRawRequestFn(fn func(t *testing.T, r *vault.Request) (*vault.Response, error)) *FakeClient

type Vault

type Vault struct {
	NewFn                           func(string, internalinformers.SecretLister, cmapi.GenericIssuer) (*Vault, error)
	SignFn                          func([]byte, time.Duration) ([]byte, []byte, error)
	IsVaultInitializedAndUnsealedFn func() error
}

Vault is a mock implementation of the Vault interface

func New

func New() *Vault

New returns a new fake Vault

func (*Vault) IsVaultInitializedAndUnsealed

func (v *Vault) IsVaultInitializedAndUnsealed() error

IsVaultInitializedAndUnsealed always returns nil

func (*Vault) New

New call NewFn and returns a pointer to the fake Vault.

func (*Vault) Sign

func (v *Vault) Sign(csrPEM []byte, duration time.Duration) ([]byte, []byte, error)

Sign implements `vault.Interface`.

func (*Vault) WithNew

WithNew sets the fake Vault's New function.

func (*Vault) WithSign

func (v *Vault) WithSign(certPEM, caPEM []byte, err error) *Vault

WithSign sets the fake Vault's Sign function.

Jump to

Keyboard shortcuts

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