kadtest

package
v0.0.0-...-e07b07e Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertClosed

func AssertClosed[T any](t testing.TB, ctx context.Context, c <-chan T)

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

func CtxShort(t *testing.T) context.Context

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

func OtelTracerProvider(ctx context.Context, t testing.TB) trace.TracerProvider

OtelTracerProvider creates a tracer provider that exports traces to, e.g., a Jaeger instance running on localhost on port 14268

func ReadItem

func ReadItem[T any](t testing.TB, ctx context.Context, c <-chan T) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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