chtest

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package chtest provides throwaway ClickHouse databases for tests.

Index

Constants

This section is empty.

Variables

View Source
var V1Day = BaseDay()

V1Day is the first UTC day of the rows NewV1 inserts; they span three days.

View Source
var V2Day = BaseDay()

V2Day is the UTC day of the rows NewV2 inserts.

Functions

func BaseDay

func BaseDay() time.Time

BaseDay is the UTC day fixtures start on: three days ago, so rows stay inside any 7 day TTL (a fixed date would let ClickHouse expire them mid-test) and the day is recent enough not to hit retention or partition edge cases.

func LogsRowsRead

func LogsRowsRead(t testing.TB, conn driver.Conn, db string, since time.Time) uint64

LogsRowsRead sums read_rows of the finished initial SELECT queries on the logs table in database db that started at or after since. Tests use it to prove that an index skipped granules. On a cluster the initiator's row carries the total over all shards.

func New

func New(t testing.TB) (driver.Conn, string)

New creates and migrates a fresh database, dropped (on every node) when the test ends.

func NewV1

func NewV1(t testing.TB) (driver.Conn, string)

NewV1 creates a fresh database with the schema version 1 tables (a retention_days column, a TTL, retention partitions) and seeds it for the tenants "a" and "b": two streams each (retention_days 0 and 7), three rows per stream and day over the three days from V1Day. The database is dropped (on every node) when the test ends. Used by the schema migration tests.

func NewV2

func NewV2(t testing.TB) (driver.Conn, string)

NewV2 creates a fresh database with the schema version 2 tables (no structured-metadata indexes, no line_ascii_escape column) and seeds it for the tenant "t1": two streams ({app="s1"}, {app="s2"}), three rows each. The database is dropped (on every node) when the test ends. Used by the schema migration tests.

func Options

func Options(db string) *clickhouse.Options

Options returns connection options for the test server with the given default database.

func Topology

func Topology() chstore.Topology

Topology is the layout tests run against: a single server by default, or the cluster named by RUNAKEFLI_TEST_CH_CLUSTER (see test/cluster/up.sh).

Types

This section is empty.

Jump to

Keyboard shortcuts

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