burrowtest

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package burrowtest provides test helpers for code that uses the burrow framework. It mirrors the standard-library convention of putting test utilities in a sibling sub-package (httptest, fstest, iotest), keeping the production package's import graph free of test-only dependencies.

Importing burrowtest blank-imports the SQLite Den backend, since DB opens a SQLite database. Production binaries that do not import this package therefore do not link the SQLite engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB(t *testing.T) *den.DB

DB returns a file-backed SQLite database wrapped in a den.DB for testing. Struct-tag validation is enabled by default to match github.com/oliverandrich/burrow.OpenDB. The database is created in testing.T.TempDir and closed automatically when the test finishes.

func ErrorExecContext

func ErrorExecContext(ctx context.Context) context.Context

ErrorExecContext returns a context with a minimal burrow.TemplateExecutor that renders error templates as "<code>: <message>". Use this in tests that trigger error responses through burrow.Handle or burrow.RenderError.

func ErrorExecMiddleware

func ErrorExecMiddleware(next http.Handler) http.Handler

ErrorExecMiddleware is an HTTP middleware that injects ErrorExecContext into the request context. Use this in tests that need error rendering support.

Types

This section is empty.

Jump to

Keyboard shortcuts

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