corehelpers

package
v1.14.1 Latest Latest
Warning

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

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

Documentation

Overview

Package corehelpers contains testhelpers that don't depend on package vault, and thus can be used within vault (as well as elsewhere.)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeTestPluginDir

func MakeTestPluginDir(t testing.T) (string, func(t testing.T))

MakeTestPluginDir creates a temporary directory suitable for holding plugins. This helper also resolves symlinks to make tests happy on OS X.

func NewMockBuiltinRegistry

func NewMockBuiltinRegistry() *mockBuiltinRegistry

func NoopAuditFactory

func NoopAuditFactory(records **[][]byte) audit.Factory

func RetryUntil

func RetryUntil(t testing.T, timeout time.Duration, f func() error)

RetryUntil runs f until it returns a nil result or the timeout is reached. If a nil result hasn't been obtained by timeout, calls t.Fatal.

Types

type NoopAudit

type NoopAudit struct {
	Config         *audit.BackendConfig
	ReqErr         error
	ReqAuth        []*logical.Auth
	Req            []*logical.Request
	ReqHeaders     []map[string][]string
	ReqNonHMACKeys []string
	ReqErrs        []error

	RespErr            error
	RespAuth           []*logical.Auth
	RespReq            []*logical.Request
	Resp               []*logical.Response
	RespNonHMACKeys    [][]string
	RespReqNonHMACKeys [][]string
	RespErrs           []error
	// contains filtered or unexported fields
}

func NewNoopAudit

func NewNoopAudit(config map[string]string) (*NoopAudit, error)

func TestNoopAudit

func TestNoopAudit(t testing.T, config map[string]string) *NoopAudit

func (*NoopAudit) GetHash

func (n *NoopAudit) GetHash(ctx context.Context, data string) (string, error)

func (*NoopAudit) Invalidate

func (n *NoopAudit) Invalidate(ctx context.Context)

func (*NoopAudit) LogRequest

func (n *NoopAudit) LogRequest(ctx context.Context, in *logical.LogInput) error

func (*NoopAudit) LogResponse

func (n *NoopAudit) LogResponse(ctx context.Context, in *logical.LogInput) error

func (*NoopAudit) LogTestMessage

func (n *NoopAudit) LogTestMessage(ctx context.Context, in *logical.LogInput, config map[string]string) error

func (*NoopAudit) Reload

func (n *NoopAudit) Reload(ctx context.Context) error

func (*NoopAudit) Salt

func (n *NoopAudit) Salt(ctx context.Context) (*salt.Salt, error)

type TestLogger

type TestLogger struct {
	hclog.Logger
	Path string
	File *os.File
	// contains filtered or unexported fields
}

func NewTestLogger

func NewTestLogger(t testing.T) *TestLogger

func (*TestLogger) StopLogging

func (tl *TestLogger) StopLogging()

Jump to

Keyboard shortcuts

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