Documentation
¶
Overview ¶
Package testutil provides reusable test helpers for OpenTrace packages. It centralises common setup patterns (in-memory SQLite, test stores) so that every test package does not need its own copy.
Index ¶
- func AdminUser() *store.User
- func MemberUser() *store.User
- func SetupTestBunDB(t *testing.T) *bun.DB
- func SetupTestDB(t *testing.T) *sql.DB
- func SetupTestStores(t *testing.T) (*sql.DB, store.Stores)
- func WithAdmin(req *http.Request) *http.Request
- func WithUser(req *http.Request, user *store.User) *http.Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupTestBunDB ¶
SetupTestBunDB opens an in-memory SQLite database (bun) with all migrations applied. The database is automatically closed when the test completes.
func SetupTestDB ¶
SetupTestDB opens an in-memory SQLite database with all migrations applied. Returns the underlying *sql.DB for backward compatibility. The database is automatically closed when the test completes.
func SetupTestStores ¶
SetupTestStores creates a full Stores instance backed by an in-memory SQLite database and a temp-directory segmented log store.
Types ¶
This section is empty.