Documentation ¶
Overview ¶
Package interceptortest contains internal utilities for testing interceptors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertSpanPropagation ¶
func AssertSpanPropagation(t *testing.T, tracer TestTracer)
func NewProxy ¶
func NewProxy(invoker Invoker) interceptor.Interceptor
NewProxy creates a proxy interceptor that calls the given invoker.
func RunTestWorkflow ¶ added in v1.13.1
func RunTestWorkflow(t *testing.T, tracer interceptor.Tracer)
RunTestWorkflow executes a test workflow with a tracing interceptor.
Types ¶
type CallRecordingInvoker ¶
type CallRecordingInvoker struct {
// contains filtered or unexported fields
}
CallRecordingInvoker is an Invoker that records all calls made to it before continuing normal invocation.
func (*CallRecordingInvoker) Calls ¶
func (c *CallRecordingInvoker) Calls() []*RecordedCall
Calls provides a copy of the currently recorded calls.
type Invoker ¶
type Invoker interface { // Invoke is called for every intercepted call. This may be called // concurrently from separate goroutines. Invoke(*ProxyCall) []reflect.Value }
Invoker is an interface that is called for every intercepted call by a proxy.
type InvokerFunc ¶
InvokerFunc implements Invoker for a single function.
type ProxyCall ¶
type ProxyCall struct { Interface reflect.Type Next reflect.Value Method reflect.Method Args []reflect.Value }
ProxyCall represents a call made to the proxy interceptor.
type RecordedCall ¶
type RecordedCall struct { *ProxyCall // Results of the call. This will not be set if still running and may be set // asynchronously in a non-concurrency-safe way once the call completes. Results []reflect.Value }
RecordedCall is a ProxyCall that also has results.
type TestTracer ¶
type TestTracer interface { interceptor.Tracer FinishedSpans() []*SpanInfo SpanName(options *interceptor.TracerStartSpanOptions) string }
TestTracer is an interceptor.Tracer that returns finished spans.