testutil

package
v0.6.12 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package testutil holds test helpers shared across framingo's own packages and usable by apps built on it: a SQLite-backed db.Manager, and doubles for the model interfaces a component receives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRecorder added in v0.6.12

NewRecorder pairs an in-memory exporter with a synchronous provider, so a span is readable the moment it ends - no flush, no sleep, no polling.

func SetupDB

func SetupDB() (db.Manager, error)

SetupDB returns an initialized db.Manager backed by an in-memory SQLite database, so a test exercises real SQL rather than a repository double. Requires CGO_ENABLED=1, which the sqlite driver needs.

Types

type Tracer added in v0.6.12

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

Tracer is a model.Tracer whose provider can be replaced mid-flight, the way a tracing-service restart replaces it in production. The provider it hands out is whatever the test supplied - pair it with NewRecorder for a real SDK provider writing to a real in-memory exporter, so only the service wrapper is a double.

func NewTracer added in v0.6.12

func NewTracer(p trace.TracerProvider) *Tracer

NewTracer returns a Tracer serving p. Reach for it when a test needs to swap the provider mid-flight, which the real tracing service only does through Init; a test that just needs some model.Tracer is better served by tracing.New(), which serves a noop provider with no Init, config or exporter.

func (*Tracer) Dependencies added in v0.6.12

func (t *Tracer) Dependencies() []common.Service

func (*Tracer) Name added in v0.6.12

func (t *Tracer) Name() string

func (*Tracer) Propagator added in v0.6.12

func (t *Tracer) Propagator() propagation.TextMapPropagator

func (*Tracer) Provider added in v0.6.12

func (t *Tracer) Provider() trace.TracerProvider

func (*Tracer) Swap added in v0.6.12

func (t *Tracer) Swap(p trace.TracerProvider)

Swap replaces the provider, standing in for a tracing-service restart.

Jump to

Keyboard shortcuts

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