testutil

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package testutil provides shared test helpers and mock implementations for gas-auth integration and unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNopLogger

func NewNopLogger() gas.Logger

NewNopLogger creates a gas.Logger that discards all output.

func SetupSQLite

func SetupSQLite(t *testing.T) (rawDB *sql.DB, dbSvc *database.Service, migSvc *migrate.Service)

SetupSQLite creates an in-memory SQLite database wired into real gas-database and gas-migrate services.

MaxOpenConns is pinned to 1 because each connection to a ":memory:" database gets its own private schema; a larger pool would see inconsistent state.

Types

type PostgresContainer

type PostgresContainer struct {
	Container *postgres.PostgresContainer
	ConnStr   string
	DB        *sql.DB
	// contains filtered or unexported fields
}

PostgresContainer holds a running PostgreSQL testcontainer plus real gas-database and gas-migrate services bound to it.

func SetupPostgres

func SetupPostgres(t *testing.T) *PostgresContainer

SetupPostgres starts a PostgreSQL container and returns a real database and migrate service backed by it.

func (*PostgresContainer) MigrationManager

func (pc *PostgresContainer) MigrationManager() *migrate.Service

MigrationManager returns the real migration service for this container.

func (*PostgresContainer) Provider

func (pc *PostgresContainer) Provider() *database.Service

Provider returns the real database service for this container.

Jump to

Keyboard shortcuts

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