testutils

package
v2.11.0-dev.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBMBaseHash

func DBMBaseHash(service, containerTagsHash string) string

DBMBaseHash computes the expected DBM base hash for the given inputs, matching the value injected as ddsh in SQL comments and as _dd.propagated_hash on spans. It mirrors computeBaseHash by returning "" when process tags are unavailable.

func DecodeV1Traces added in v2.9.0

func DecodeV1Traces(t *testing.T, buf []byte) map[string]any

DecodeV1Traces decodes a msgpack-encoded v1 payload (e.g. bytes read from req.Body of an agent intake request) and returns its top-level fields keyed by their numeric proto field IDs (as strings). Fields absent from the payload (zero value after decode) are omitted from the result.

func DiscardLogger

func DiscardLogger() tracer.Logger

func FlushTelemetry added in v2.4.0

func FlushTelemetry()

FlushTelemetry flushes any pending telemetry data.

func SetContainerTagsHash

func SetContainerTagsHash(t *testing.T, hash string)

SetContainerTagsHash sets the container tags hash for the duration of the test.

func SetGlobalAnalyticsRate

func SetGlobalAnalyticsRate(t *testing.T, val float64)

func SetGlobalDogstatsdAddr

func SetGlobalDogstatsdAddr(t *testing.T, val string)

func SetGlobalHeaderTags

func SetGlobalHeaderTags(t *testing.T, headers ...string)

func SetGlobalServiceName

func SetGlobalServiceName(t *testing.T, val string)

func SetPropagatingTag

func SetPropagatingTag(t testing.TB, ctx *tracer.SpanContext, k, v string)

SetPropagatingTag sets a propagating tag on the given span context.

func SkipIfGoTip

func SkipIfGoTip(t testing.TB, format string, args ...any)

SkipIfGoTip skips t when the test binary is built with an unreleased ("devel") Go toolchain — e.g. the nightly gotip CI job — where unexported standard-library layout can drift ahead of released Go. On a released toolchain it is a no-op and the test proceeds.

runtime.Version() reports "devel go1.NN-<hash> <date>" for such toolchains, versus "go1.NN.P" for a release; the "devel" prefix is the sentinel.

The optional format/args are logged (like t.Logf) before the skip so call sites keep their diagnostics; the skip message always names the toolchain. Use it in place of a hard t.Fatal when an assertion depends on standard library internals that legitimately drift on tip.

func StartAppSec

func StartAppSec(t *testing.T, opts ...config.StartOption)

func StartAppSecBench

func StartAppSecBench(b *testing.B)

func StartTelemetryRecorder added in v2.7.0

func StartTelemetryRecorder(t *testing.T) *telemetrytest.RecordClient

StartTelemetryRecorder starts a new telemetry mock client and returns it.

Types

type MockStatsdClient

type MockStatsdClient = statsdtest.TestStatsdClient

func NewMockStatsdClient

func NewMockStatsdClient() *MockStatsdClient

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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