dbtest

package
v0.0.0-...-f95167b Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dbtest provides test helpers for spinning up a Postgres container.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(connStr string, vectorEnabled bool) error

Migrate runs the embedded OSS migrations against connStr and returns any error. If vectorEnabled is true the vector pass is also applied. Use MigrateT in tests that have a *testing.T; use Migrate in TestMain where no T is available.

func MigrateT

func MigrateT(t *testing.T, connStr string, vectorEnabled bool)

MigrateT runs the embedded OSS migrations against connStr and calls t.Fatal on error. If vectorEnabled is true the vector pass is also applied.

func Start

func Start(ctx context.Context) (connStr string, cleanup func(), err error)

Start starts a pgvector Postgres container and returns the connection string and a cleanup function. Callers are responsible for calling cleanup when done.

func StartT

func StartT(ctx context.Context, t *testing.T) string

StartT starts a pgvector Postgres container and registers cleanup with t.Cleanup. Suitable for use in individual tests or test helpers that have a *testing.T.

Types

This section is empty.

Jump to

Keyboard shortcuts

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