exampletest

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package exampletest is the harness every examples/<name> test uses. It gives the test a database that has the example's migrations applied, so the example is proven against a real server by the same CI job that runs the integration suite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckGenerated

func CheckGenerated(t *testing.T)

CheckGenerated fails when the generated code of the example in the working directory is stale, by running the real generator in check mode. It is the test-side twin of `momo generate`, so a model edit without a regenerate cannot reach main.

func Open

func Open(t *testing.T) *momo.DB

Open creates a scratch PostgreSQL database with the vector extension, applies the example's migrations (the migrations directory next to its main.go) and returns a handle on it. The database is dropped when the test ends. The test is skipped when MOMO_TEST_POSTGRES_URL is unset, and fails instead when MOMO_REQUIRE_INTEGRATION=1, as in CI.

Types

This section is empty.

Jump to

Keyboard shortcuts

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