conformance

package
v1.0.35 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 26 Imported by: ? 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 conformance is the cross-engine behaviour suite for project drivers. Every case talks to a driver only through interfaces.ProjectDBInterface, and every engine runs the same cases against a real server. SQLite always runs; server engines run when their URL env var is set (see EngineFactories) and are skipped otherwise, so `go test ./...` stays offline.

Index

Constants

View Source
const (
	EnvPostgres = "CONFORMANCE_POSTGRES_URL" // postgres://user:pass@host:port/shared_db
	EnvMySQL    = "CONFORMANCE_MYSQL_URL"    // mysql://user:pass@host:port
	EnvMariaDB  = "CONFORMANCE_MARIADB_URL"  // mysql://user:pass@host:port
	EnvMongo    = "CONFORMANCE_MONGO_URL"    // mongodb://user:pass@host:port
)

Env vars that enable server engines.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, f Factory)

Run executes every case against fresh databases from f.

Types

type Case

type Case struct {
	Name string
	Run  func(t *testing.T, ctx context.Context, o *Opened)
}

Case is one behaviour every project driver must have.

func Cases

func Cases() []Case

Cases is the ordered conformance list.

type Factory

type Factory struct {
	Name string
	// Skip is non-empty when this engine is not configured.
	Skip string
	// KnownGaps lists cases the engine does not implement yet (case → reason).
	// They are reported as skips, which makes the list a checklist.
	KnownGaps map[string]string
	Open      func(t *testing.T) *Opened
}

Factory opens isolated project databases for one engine variant.

func EngineFactories

func EngineFactories() []Factory

EngineFactories returns every engine variant opened with the open_driver constructors; unconfigured ones carry Skip.

func EngineFactoriesWith

func EngineFactoriesWith(open OpenFunc) []Factory

EngineFactoriesWith is EngineFactories with a custom opener (nil = default).

type OpenFunc

OpenFunc opens a project driver for credentials. The default uses the open_driver constructors; the engine passes its production driver factory so the same cases run through the exact boot path (Pro wrappers included).

type Opened

type Opened struct {
	Driver    interfaces.ProjectDBInterface
	ProjectID string
	Cred      *models.DriverCredentials
	// Raw is an admin handle on the same database for assertions that need
	// to look at physical state (SQL engines only; nil for Mongo).
	Raw *sql.DB
	// Dialect is "sqlite", "postgresql", "mysql", "mariadb" or "mongodb".
	Dialect string
	// Schema is set for the Postgres schema-isolation variant.
	Schema string
}

Opened is one fresh, isolated project database.

Jump to

Keyboard shortcuts

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