Documentation
¶
Overview ¶
Package chtest provides throwaway ClickHouse databases for tests.
Index ¶
- Variables
- func BaseDay() time.Time
- func LogsRowsRead(t testing.TB, conn driver.Conn, db string, since time.Time) uint64
- func New(t testing.TB) (driver.Conn, string)
- func NewV1(t testing.TB) (driver.Conn, string)
- func NewV2(t testing.TB) (driver.Conn, string)
- func Options(db string) *clickhouse.Options
- func Topology() chstore.Topology
Constants ¶
This section is empty.
Variables ¶
var V1Day = BaseDay()
V1Day is the first UTC day of the rows NewV1 inserts; they span three days.
var V2Day = BaseDay()
V2Day is the UTC day of the rows NewV2 inserts.
Functions ¶
func BaseDay ¶
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 ¶
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 NewV1 ¶
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 ¶
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.
Types ¶
This section is empty.