fake

package
v1.14.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 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 added in v1.12.0

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) NewRequest added in v1.12.0

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

func (*FakeClient) RawRequest added in v1.12.0

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

func (*FakeClient) SetToken added in v1.12.0

func (c *FakeClient) SetToken(v string)

func (*FakeClient) WithNewRequest added in v1.12.0

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

func (*FakeClient) WithRawRequest added in v1.12.0

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

func (*FakeClient) WithRawRequestFn added in v1.12.0

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