testleak

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertNoSecretInBytes

func AssertNoSecretInBytes(t testing.TB, data []byte, secrets ...string)

AssertNoSecretInBytes asserts that none of the provided non-empty secrets appear anywhere in the given byte slice. If a secret is leaked, the test fails without exposing the raw secret value in the failure message.

func AssertNoSecretInError

func AssertNoSecretInError(t testing.TB, err error, secrets ...string)

AssertNoSecretInError asserts that if err is non-nil, none of the secrets appear in err.Error().

func AssertNoSecretInLogs

func AssertNoSecretInLogs(t testing.TB, l *BufferLogger, secrets ...string)

AssertNoSecretInLogs asserts that none of the provided secrets appear in the captured logs.

func AssertNoSecretInString

func AssertNoSecretInString(t testing.TB, text string, secrets ...string)

AssertNoSecretInString asserts that none of the provided non-empty secrets appear anywhere in the given text string.

func AssertNoSecretInYAML

func AssertNoSecretInYAML(t testing.TB, yamlData []byte, secrets ...string)

AssertNoSecretInYAML asserts that raw serialized YAML bytes do not contain any plaintext secret values.

func AssertSecretPresentInBytes

func AssertSecretPresentInBytes(t testing.TB, data []byte, secret string)

AssertSecretPresentInBytes asserts that the expected non-empty secret is present in the byte slice.

func AssertSecretPresentInString

func AssertSecretPresentInString(t testing.TB, text string, secret string)

AssertSecretPresentInString asserts that the expected non-empty secret is present in text.

Types

type BufferLogger

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

BufferLogger implements logger.DebugLogger to capture runtime logs safely in memory.

func NewBufferLogger

func NewBufferLogger() *BufferLogger

NewBufferLogger creates a thread-safe in-memory buffer logger.

func (*BufferLogger) Bytes

func (l *BufferLogger) Bytes() []byte

Bytes returns a thread-safe snapshot copy of captured log bytes.

func (*BufferLogger) Debug

func (l *BufferLogger) Debug(msg string, args ...any)

func (*BufferLogger) Debugf

func (l *BufferLogger) Debugf(format string, args ...any)

func (*BufferLogger) String

func (l *BufferLogger) String() string

String returns a thread-safe snapshot string of captured logs.

Jump to

Keyboard shortcuts

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