Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTestDatabase ¶
CreateTestDatabase creates a uniquely-named test database and registers a t.Cleanup that drops it synchronously.
The unique suffix is 64 random bits from crypto/rand. Earlier versions derived the suffix from `unsafe.Pointer(t)`, which is unreliable: Go may reuse heap addresses for *testing.T after earlier tests complete, so two tests that happen to land on the same address get the same dbName. That manifested as intermittent "Replica /clickhouse/<db>/... already exists" failures on ReplicatedMergeTree fixtures shared by multiple tests (e.g. query_log_archive, sharded_events in TestEnd2End vs. TestLive_Introspection_AllStatements) because their ZK paths embed dbName.
Cleanup uses DROP DATABASE ... SYNC so the database's ZooKeeper metadata is released before the test returns — without SYNC, ClickHouse delays the drop by `database_atomic_delay_before_drop_table_sec` (default 480s), which leaves Replica entries lingering and racing later tests that happen to pick a colliding name.
func GetTestConnection ¶
GetTestConnection returns a shared ClickHouse connection for tests The connection is initialized once and reused across all tests
func InitTestLogger ¶
func InitTestLogger()
InitTestLogger initializes the logger in test mode (suppresses output)
func PingClickHouse ¶
PingClickHouse performs a basic connectivity test
Types ¶
This section is empty.