Documentation ¶
Index ¶
- func AssertClosed[T any](t testing.TB, ctx context.Context, c <-chan T)
- func CtxShort(t *testing.T) context.Context
- func MaybeTrace(t testing.TB, ctx context.Context) (context.Context, trace.TracerProvider)
- func OtelTracerProvider(ctx context.Context, t testing.TB) trace.TracerProvider
- func ReadItem[T any](t testing.TB, ctx context.Context, c <-chan T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertClosed ¶
AssertClosed triggers a test failure if the given channel was not closed but carried more values or a timeout occurs (given by the context).
func CtxShort ¶
CtxShort returns a Context for tests that are expected to complete quickly. The context will be cancelled after 10 seconds or just before the test binary deadline (as specified by the -timeout flag when running the test), whichever is sooner.
func MaybeTrace ¶
MaybeTrace returns a context containing a new root span named after the test. It creates a new tracing provider and installs it as the global provider, restoring the previous provider at the end of the test. This function cannot be called from tests that are run in parallel.
To activate test tracing pass the `-tracing` flag to the test command. Assuming you chose the defaults above, run the following to collect traces:
docker run --rm --name jaeger -p 16686:16686 -p 4317:4317 jaegertracing/all-in-one:1.49
Then navigate to localhost:16686 and inspect the traces.
func OtelTracerProvider ¶
OtelTracerProvider creates a tracer provider that exports traces to, e.g., a Jaeger instance running on localhost on port 14268
Types ¶
This section is empty.