fabriqtest

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostgresImage = "timescale/timescaledb-ha:pg16-all"
	// PostgresPlainImage is the vanilla upstream Postgres image used for the
	// primary+standby replication harness (StartPrimaryStandby). It backs the
	// catalog control database — a single plain table with no pgvector/timescale
	// needs — and, unlike timescaledb-ha, has no HA entrypoint that fights
	// pg_basebackup-based standby setup.
	PostgresPlainImage = "postgres:16-alpine"
	RedisImage         = "redis:7-alpine"
	FalkorDBImage      = "falkordb/falkordb:v4.2.2" // pinned: multi-label + SET n:Label
	ElasticsearchImage = "elasticsearch:9.4.1"
	// ClickHouseImage pins a server new enough that lightweight DELETE is GA and
	// enabled by default (>= 23.3).
	ClickHouseImage = "clickhouse/clickhouse-server:24.3"
)

Container images for the integration harness. timescaledb-ha bundles TimescaleDB and pgvector, matching the production datastore contract.

Variables

View Source
var ErrFakeNotFound = coretest.ErrFakeNotFound

ErrFakeNotFound is the not-found sentinel the fakes return.

Functions

func ApplyDDL added in v0.0.3

func ApplyDDL(t testing.TB, dsn string, stmts []string)

ApplyDDL executes the given statements against dsn as the connecting role (typically the superuser/owner DSN). It is the seam tests use to create application-defined materialization targets (e.g. domain.PagesDDL()) that are no longer part of fabriq's shipped migration chain. Apply it BEFORE CreateAppRole so the app role inherits grants on the new tables.

func CreateAppRole

func CreateAppRole(t testing.TB, superDSN string) string

CreateAppRole provisions a NON-superuser application role on a database previously started with StartPostgres and returns a DSN for it.

This mirrors production: migrations run as the schema owner; the application connects as a restricted role so RLS actually applies (Postgres row security NEVER constrains superusers). Call it AFTER running migrations.

func NewConformanceBackend

func NewConformanceBackend(t testing.TB) conformance.Backend

NewConformanceBackend builds a fake-backed conformance.Backend over the domain registry. It is the fast (Docker-free) gate that keeps the fakes from drifting from real-adapter behavior.

func NewFabric

func NewFabric(w *World) query.Fabric

NewFabric returns a query.Fabric over the world's fakes.

func QueryStrings added in v0.0.6

func QueryStrings(t testing.TB, dsn, sql string, args ...any) []string

QueryStrings runs a single-column query against dsn and returns the rows as strings — the seam integration tests use for schema-shape assertions (information_schema / pg_catalog checks).

func RunCacheConformance

func RunCacheConformance(t *testing.T, newCache func(t *testing.T) cache.Cache)

RunCacheConformance runs the shared cache conformance suite.

func StartClickHouse added in v0.0.6

func StartClickHouse(t testing.TB) string

StartClickHouse launches a ClickHouse container and returns its clickhouse:// DSN. The container terminates with the test.

func StartElasticsearch

func StartElasticsearch(t testing.TB) string

StartElasticsearch launches a single-node Elasticsearch container (security off, HTTP only) and returns its base URL. The container terminates with the test.

func StartFalkorDB

func StartFalkorDB(t testing.TB) string

StartFalkorDB launches a FalkorDB container and returns its address (host:port). The container terminates with the test.

func StartPostgres

func StartPostgres(t testing.TB) string

StartPostgres launches a Postgres+Timescale+pgvector container and returns its DSN. The container terminates with the test.

func StartRedis

func StartRedis(t testing.TB) string

StartRedis launches a Redis container and returns its address (host:port). The container terminates with the test.

Types

type FakeAnalytics added in v0.0.6

type FakeAnalytics = coretest.FakeAnalytics

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

func NewFakeAnalytics added in v0.0.6

func NewFakeAnalytics(reg *registry.Registry) *FakeAnalytics

NewFakeAnalytics builds an in-memory analytics querier.

type FakeAnalyticsSink added in v0.0.6

type FakeAnalyticsSink = coretest.FakeAnalyticsSink

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

func NewFakeAnalyticsSink added in v0.0.6

func NewFakeAnalyticsSink() *FakeAnalyticsSink

NewFakeAnalyticsSink builds an in-memory analytics sink.

type FakeBlob

type FakeBlob = coretest.FakeBlob

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

func NewFakeBlob

func NewFakeBlob() *FakeBlob

NewFakeBlob builds an in-memory blob store.

type FakeCAS

type FakeCAS = coretest.FakeCAS

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

func NewFakeCAS

func NewFakeCAS() *FakeCAS

NewFakeCAS builds an in-memory content-addressable store.

type FakeCache

type FakeCache = coretest.FakeCache

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

func NewFakeCache

func NewFakeCache() *FakeCache

NewFakeCache builds an in-memory cache.

type FakeCatalog added in v0.0.6

type FakeCatalog = coretest.FakeCatalog

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

func NewFakeCatalog added in v0.0.6

func NewFakeCatalog() *FakeCatalog

NewFakeCatalog builds an in-memory tenant catalog.

type FakeDocumentStore

type FakeDocumentStore = coretest.FakeDocumentStore

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

type FakeGraph

type FakeGraph = coretest.FakeGraph

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

func NewFakeGraph

func NewFakeGraph(reg *registry.Registry, rel query.RelationalQuerier) *FakeGraph

NewFakeGraph builds a graph querier over a relational querier.

type FakeNode

type FakeNode = coretest.FakeNode

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

type FakeProjectionState

type FakeProjectionState = coretest.FakeProjectionState

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

type FakeRelational

type FakeRelational = coretest.FakeRelational

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

type FakeSearch

type FakeSearch = coretest.FakeSearch

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

func NewFakeSearch

func NewFakeSearch(reg *registry.Registry) *FakeSearch

NewFakeSearch builds an in-memory search querier.

type FakeSpatial

type FakeSpatial = coretest.FakeSpatial

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

type FakeStore

type FakeStore = coretest.FakeStore

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

type FakeTS

type FakeTS = coretest.FakeTS

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

type FakeVector

type FakeVector = coretest.FakeVector

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

type World

type World = coretest.World

The fakes live in core/fabriqtest so the core module can test itself without depending on the main module. These aliases keep github.com/xraph/fabriq/fabriqtest working for anyone importing it.

Aliases, not wrappers: fabriqtest.World and coretest.World are the same type, so methods, struct fields and type assertions all carry over.

func NewWorld

func NewWorld(reg *registry.Registry) *World

NewWorld builds a fake world backed by shared in-memory storage.

Jump to

Keyboard shortcuts

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