Documentation
¶
Index ¶
- func AssertNoSecretInBytes(t testing.TB, data []byte, secrets ...string)
- func AssertNoSecretInError(t testing.TB, err error, secrets ...string)
- func AssertNoSecretInLogs(t testing.TB, l *BufferLogger, secrets ...string)
- func AssertNoSecretInString(t testing.TB, text string, secrets ...string)
- func AssertNoSecretInYAML(t testing.TB, yamlData []byte, secrets ...string)
- func AssertSecretPresentInBytes(t testing.TB, data []byte, secret string)
- func AssertSecretPresentInString(t testing.TB, text string, secret string)
- type BufferLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNoSecretInBytes ¶
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 ¶
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 ¶
AssertNoSecretInString asserts that none of the provided non-empty secrets appear anywhere in the given text string.
func AssertNoSecretInYAML ¶
AssertNoSecretInYAML asserts that raw serialized YAML bytes do not contain any plaintext secret values.
func AssertSecretPresentInBytes ¶
AssertSecretPresentInBytes asserts that the expected non-empty secret is present in the byte slice.
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.