Documentation
¶
Overview ¶
Package testutils is the Test utilities.
The functionality in this package is exposed both for internal testing as well as service testability.
InMemoryLogger ¶
If you'd like to verify that log messages are logged properly, use the WithInMemoryLogger() helper which will provider you with a zap.Logger you can pass into a service and capture recorded messages.
Overriding environment variables ¶
If you'd like to override environment variables, use the env.Override() helper and defer the reset to ensure the old value us returned at the end of the test.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StaticAppData ¶
StaticAppData creates a Provider for a valid appID/owner
func WithInMemoryLogger ¶
WithInMemoryLogger creates an in-memory zap logger that can be used in tests
Types ¶
type TestBuffer ¶
TestBuffer is a buffer used to test the zap logger
func (*TestBuffer) Lines ¶
func (b *TestBuffer) Lines() []string
Lines returns buffer as array of strings
func (*TestBuffer) Stripped ¶
func (b *TestBuffer) Stripped() string
Stripped returns buffer as a string without the newline
func (*TestBuffer) Sync ¶
func (b *TestBuffer) Sync() error
Sync is a nop to conform to zap.WriteSyncer interface