Documentation
¶
Overview ¶
Package eventtest supports logging events to a test. You can use NewContext to create a context that knows how to deliver telemetry events back to the test. You must use this context or a derived one anywhere you want telemetry to be correctly routed back to the test it was constructed with.
Index ¶
- Constants
- Variables
- func CmpOptions() []cmp.Option
- func ExporterOptions() *event.ExporterOptions
- func NewContext(ctx context.Context, tb testing.TB) context.Context
- func RunBenchmark(b *testing.B, ctx context.Context, hooks Hooks)
- func TestAllocs(t *testing.T, f func(io.Writer) context.Context, hooks Hooks, expect int)
- func TestBenchmark(t *testing.T, f func(io.Writer) context.Context, hooks Hooks, expect string)
- type CaptureHandler
- type Hooks
- type Info
Constants ¶
View Source
const ( TimeFormat = logfmt.TimeFormat LogfmtOutput = `` /* 872-byte string literal not displayed */ LogfOutput = `` /* 1018-byte string literal not displayed */ )
Variables ¶
View Source
var ( A = Info{ Name: "A", Msg: "a", Msgf: "a where A=%d", } B = Info{ Name: "B", Msg: "b", Msgf: "b where B=%q", } )
View Source
var InitialTime = func() time.Time { t, _ := time.Parse(logfmt.TimeFormat, "2020/03/05 14:27:48") return t }()
Functions ¶
func CmpOptions ¶
func ExporterOptions ¶
func ExporterOptions() *event.ExporterOptions
func NewContext ¶
NewContext returns a context you should use for the active test.
func TestAllocs ¶
Types ¶
type CaptureHandler ¶
func NewCapture ¶
func NewCapture() (context.Context, *CaptureHandler)
func (*CaptureHandler) Reset ¶
func (h *CaptureHandler) Reset()
Click to show internal directories.
Click to hide internal directories.