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 ¶
- func MakeTestPluginDir(t testing.T) (string, func(t testing.T))
- func NewMockBuiltinRegistry() *mockBuiltinRegistry
- func NoopAuditFactory(records **[][]byte) audit.Factory
- func RegisterSubloggerAdder(logger hclog.Logger, adder logging.SubloggerAdder)
- func RetryUntil(t testing.T, timeout time.Duration, f func() error)
- type NoopAudit
- func (n *NoopAudit) GetHash(ctx context.Context, data string) (string, error)
- func (n *NoopAudit) Invalidate(ctx context.Context)
- func (n *NoopAudit) LogRequest(ctx context.Context, in *logical.LogInput) error
- func (n *NoopAudit) LogResponse(ctx context.Context, in *logical.LogInput) error
- func (n *NoopAudit) LogTestMessage(ctx context.Context, in *logical.LogInput, config map[string]string) error
- func (n *NoopAudit) Reload(ctx context.Context) error
- func (n *NoopAudit) Salt(ctx context.Context) (*salt.Salt, error)
- type TestLogger
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 RegisterSubloggerAdder ¶ added in v1.13.7
func RegisterSubloggerAdder(logger hclog.Logger, adder logging.SubloggerAdder)
RegisterSubloggerAdder checks to see if the provided logger interface is a TestLogger and re-assigns the SubloggerHook implementation if so.
func RetryUntil ¶
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 TestNoopAudit ¶
func (*NoopAudit) Invalidate ¶
func (*NoopAudit) LogRequest ¶
func (*NoopAudit) LogResponse ¶
func (*NoopAudit) LogTestMessage ¶
type TestLogger ¶
type TestLogger struct { hclog.InterceptLogger Path string File *os.File // For managing temporary start-up state sync.RWMutex AllLoggers []hclog.Logger logging.SubloggerAdder // contains filtered or unexported fields }
func NewTestLogger ¶
func NewTestLogger(t testing.T) *TestLogger
func (*TestLogger) AppendToAllLoggers ¶ added in v1.13.7
func (l *TestLogger) AppendToAllLoggers(sub hclog.Logger) hclog.Logger
AppendToAllLoggers appends the sub logger to allLoggers, or if the TestLogger is assigned to a SubloggerAdder implementation, it calls the underlying hook.
func (*TestLogger) StopLogging ¶
func (tl *TestLogger) StopLogging()