teststore

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package teststore opens a store for a test on whichever backend MEMSTORE_TEST_BACKEND names, so the same test file runs against SQLite and PostgreSQL without knowing which it got.

MEMSTORE_TEST_BACKEND=sqlite   in-memory SQLite (the default)
MEMSTORE_TEST_BACKEND=pg       a private PostgreSQL database per test,
                               skipped when MEMSTORE_TEST_PG is unset

The daemon runs on PostgreSQL and only on PostgreSQL, so the pg run is the one that says whether the HTTP and MCP layers work; the sqlite run is kept while that backend is still shipped. CI runs both.

Index

Constants

View Source
const DefaultUser = "testuser"

DefaultUser is the owner recorded on a PostgreSQL test database. SQLite has no users, so tests that need to name one should use this constant rather than assume.

View Source
const VecDim = 4

VecDim is the embedding dimension the store is opened with. The mock embedders in the test packages all produce 4-wide vectors.

Variables

This section is empty.

Functions

func Backend

func Backend() string

Backend returns the selected backend name, "sqlite" or "pg".

func IsPG

func IsPG() bool

IsPG reports whether the selected backend is PostgreSQL. For the few tests whose expectations legitimately differ by backend; most should not ask.

Types

type Store

type Store interface {
	memstore.Store
	memstore.StoreScoper
	SetReranker(rr embedding.Reranker)
	TermDocCounts(ctx context.Context, terms []string) (map[string]int, int, error)
}

Store is what a test may hold: the full store union, the scoper that hands out capability-typed handles, and the two tuning entry points tests reach for that live on both backends but on no capability interface.

func New

func New(t testing.TB, embedder embedding.Embedder, namespace string) Store

New opens a store on the selected backend. embedder may be nil for a store that cannot embed (the FTS-only fallback tests need one).

Jump to

Keyboard shortcuts

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