Documentation
¶
Index ¶
- func NewTestAPI(t *testing.T, chDB *ClickHouseDB) *handlers.API
- func NewTestAPIAll(t *testing.T, chDB *ClickHouseDB, pgDB *DB, neo4jDB *Neo4jDB, ...) *handlers.API
- func NewTestAPIBare(t *testing.T, chDB *ClickHouseDB) *handlers.API
- func NewTestAPIPg(t *testing.T, pgDB *DB) *handlers.API
- func NewTestPool(t *testing.T, db *DB) *pgxpool.Pool
- func SetupClickHouseForTest(t *testing.T, db *ClickHouseDB) (driver.Conn, string)
- func SetupClickHouseWithMigrationsForTest(t *testing.T, db *ClickHouseDB) (driver.Conn, string)
- func SetupNeo4jForTest(t *testing.T, db *Neo4jDB) neo4j.Client
- func SetupNeo4jWithDataForTest(t *testing.T, db *Neo4jDB, ...) neo4j.Client
- func SetupPostgresForTest(t *testing.T, db *DB) *pgxpool.Pool
- func WaitForPostgres() *wait.LogStrategy
- type ClickHouseDB
- type ClickHouseDBConfig
- type DB
- type DBConfig
- type Neo4jDB
- type Neo4jDBConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestAPI ¶
func NewTestAPI(t *testing.T, chDB *ClickHouseDB) *handlers.API
NewTestAPI creates an isolated *handlers.API for a single test with a per-test ClickHouse database (with full schema migrations). This is the most common test setup pattern.
func NewTestAPIAll ¶
func NewTestAPIAll(t *testing.T, chDB *ClickHouseDB, pgDB *DB, neo4jDB *Neo4jDB, seedFunc func(ctx context.Context, session neo4j.Session) error) *handlers.API
NewTestAPIAll creates an isolated *handlers.API with ClickHouse, PostgreSQL, and Neo4j connections. Pass nil for any component to skip it.
func NewTestAPIBare ¶
func NewTestAPIBare(t *testing.T, chDB *ClickHouseDB) *handlers.API
NewTestAPIBare creates an isolated *handlers.API for a single test with a per-test ClickHouse database (empty, no migrations). Use this for tests that create their own table schemas.
func NewTestAPIPg ¶
NewTestAPIPg creates an isolated *handlers.API for a single test with a PostgreSQL pool (with migrations applied).
func NewTestPool ¶
NewTestPool creates a new pgxpool connected to the test container.
func SetupClickHouseForTest ¶
SetupClickHouseForTest creates a per-test ClickHouse database and returns the direct connection and database name. No proxy registration.
func SetupClickHouseWithMigrationsForTest ¶
SetupClickHouseWithMigrationsForTest creates a per-test ClickHouse database with full schema migrations and returns the direct connection and database name.
func SetupNeo4jForTest ¶
SetupNeo4jForTest creates a read-only Neo4j client for the test. Does NOT touch config.Neo4jClient.
func SetupNeo4jWithDataForTest ¶
func SetupNeo4jWithDataForTest(t *testing.T, db *Neo4jDB, seedFunc func(ctx context.Context, session neo4j.Session) error) neo4j.Client
SetupNeo4jWithDataForTest seeds data and returns a read-only Neo4j client. Does NOT touch config.Neo4jClient.
func SetupPostgresForTest ¶
Does NOT touch config.PgPool.
func WaitForPostgres ¶
func WaitForPostgres() *wait.LogStrategy
WaitForPostgres is a convenience wait strategy for PostgreSQL.
Types ¶
type ClickHouseDB ¶
type ClickHouseDB struct {
// contains filtered or unexported fields
}
ClickHouseDB represents a ClickHouse test container.
func NewClickHouseDB ¶
func NewClickHouseDB(ctx context.Context, log *slog.Logger, cfg *ClickHouseDBConfig) (*ClickHouseDB, error)
NewClickHouseDB creates a new ClickHouse testcontainer.
func (*ClickHouseDB) Addr ¶
func (db *ClickHouseDB) Addr() string
Addr returns the ClickHouse native protocol address (host:port).
func (*ClickHouseDB) Close ¶
func (db *ClickHouseDB) Close()
Close terminates the ClickHouse container.
func (*ClickHouseDB) Database ¶
func (db *ClickHouseDB) Database() string
Database returns the ClickHouse database name.
func (*ClickHouseDB) HTTPAddr ¶
func (db *ClickHouseDB) HTTPAddr() string
HTTPAddr returns the HTTP endpoint URL (http://host:port) for the ClickHouse container.
func (*ClickHouseDB) Password ¶
func (db *ClickHouseDB) Password() string
Password returns the ClickHouse password.
func (*ClickHouseDB) Username ¶
func (db *ClickHouseDB) Username() string
Username returns the ClickHouse username.
type ClickHouseDBConfig ¶
type ClickHouseDBConfig struct {
Database string
Username string
Password string
Port string
ContainerImage string
}
ClickHouseDBConfig holds the ClickHouse test container configuration.
func (*ClickHouseDBConfig) Validate ¶
func (cfg *ClickHouseDBConfig) Validate() error
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents a PostgreSQL test container.
type Neo4jDB ¶
type Neo4jDB struct {
// contains filtered or unexported fields
}
Neo4jDB represents a Neo4j test container.
func NewNeo4jDB ¶
NewNeo4jDB creates a new Neo4j testcontainer.
type Neo4jDBConfig ¶
Neo4jDBConfig holds the Neo4j test container configuration.
func (*Neo4jDBConfig) Validate ¶
func (cfg *Neo4jDBConfig) Validate() error