workflowtest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountSpansWithPrefix

func CountSpansWithPrefix(spans []*RecordingSpan, prefix string) int

CountSpansWithPrefix returns the number of spans whose name starts with prefix.

func SpanNames

func SpanNames(spans []*RecordingSpan) []string

SpanNames returns span names for assertion failures.

Types

type RecordingEvent

type RecordingEvent struct {
	Name       string
	Attributes []observability.Attribute
}

RecordingEvent records a span event.

type RecordingSpan

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

RecordingSpan records workflow span operations for tests.

func FindSpanWithPrefix

func FindSpanWithPrefix(t testing.TB, spans []*RecordingSpan, prefix string) *RecordingSpan

FindSpanWithPrefix returns the first span whose name starts with prefix.

func (*RecordingSpan) AddEvent

func (span *RecordingSpan) AddEvent(name string, attrs ...observability.Attribute)

func (*RecordingSpan) Attribute

func (span *RecordingSpan) Attribute(key string) (any, bool)

Attribute returns a recorded attribute value.

func (*RecordingSpan) End

func (span *RecordingSpan) End()

func (*RecordingSpan) Ended

func (span *RecordingSpan) Ended() bool

Ended reports whether End was called.

func (*RecordingSpan) Events

func (span *RecordingSpan) Events() []RecordingEvent

Events returns a snapshot of recorded events.

func (*RecordingSpan) Name

func (span *RecordingSpan) Name() string

Name returns the span name.

func (*RecordingSpan) Options

func (span *RecordingSpan) Options() observability.SpanOptions

Options returns the span start options.

func (*RecordingSpan) RecordError

func (span *RecordingSpan) RecordError(err error)

func (*RecordingSpan) RequireAttribute

func (span *RecordingSpan) RequireAttribute(t testing.TB, key string) any

RequireAttribute fails the test if the span does not include the attribute.

func (*RecordingSpan) RequireAttributeValue

func (span *RecordingSpan) RequireAttributeValue(t testing.TB, key string, want any)

RequireAttributeValue fails the test if the span attribute is missing or not equal to want.

func (*RecordingSpan) RequireEnded

func (span *RecordingSpan) RequireEnded(t testing.TB)

RequireEnded fails the test if End was not called.

func (*RecordingSpan) RequireEvent

func (span *RecordingSpan) RequireEvent(t testing.TB, name string)

RequireEvent fails the test if the span does not include the named event.

func (*RecordingSpan) RequireOmittedAttribute

func (span *RecordingSpan) RequireOmittedAttribute(t testing.TB, key string)

RequireOmittedAttribute fails if the span includes the attribute.

func (*RecordingSpan) RequireOptionalStringAttribute

func (span *RecordingSpan) RequireOptionalStringAttribute(t testing.TB, key string, wantPresent bool, contains string)

RequireOptionalStringAttribute fails if presence or string content does not match expectations.

func (*RecordingSpan) SetAttributes

func (span *RecordingSpan) SetAttributes(attrs ...observability.Attribute)

func (*RecordingSpan) SetError

func (span *RecordingSpan) SetError(message string)

type RecordingTracer

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

RecordingTracer records workflow observability spans for tests.

func NewRecordingTracer

func NewRecordingTracer() *RecordingTracer

NewRecordingTracer creates an empty workflow telemetry recorder.

func (*RecordingTracer) ExtractTraceContext

func (*RecordingTracer) ExtractTraceContext(ctx context.Context) map[string]string

func (*RecordingTracer) LastSpan

func (tracer *RecordingTracer) LastSpan(t testing.TB) *RecordingSpan

LastSpan returns the most recently started span.

func (*RecordingTracer) Spans

func (tracer *RecordingTracer) Spans() []*RecordingSpan

Spans returns a snapshot of spans started by this tracer.

func (*RecordingTracer) Start

Jump to

Keyboard shortcuts

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