Documentation ¶
Overview ¶
Package cht implements ClickHouse testing utilities, primarily end to end.
Package cht implements running ClickHouse for tests.
Index ¶
- Constants
- func Bin() (string, error)
- func BinOrSkip(t testing.TB) string
- func Ports(t testing.TB, n int) []int
- func Skip(t testing.TB)
- type Cluster
- type Clusters
- type Config
- type CoordinationConfig
- type DistributedDDL
- type KeeperConfig
- type LogEntry
- type Logger
- type Map
- type OpenTelemetry
- type Option
- func With(opts ...Option) Option
- func WithClusters(c Clusters) Option
- func WithDistributedDDL(ddl DistributedDDL) Option
- func WithInterServerHTTP(port int) Option
- func WithInterServerHost(host string) Option
- func WithKeeper(cfg KeeperConfig) Option
- func WithLog(lg *zap.Logger) Option
- func WithMacros(m Map) Option
- func WithMaxServerMemoryUsage(n int) Option
- func WithTCP(port int) Option
- func WithZooKeeper(nodes []ZooKeeperNode) Option
- type RaftConfig
- type RaftServer
- type Replica
- type Server
- type Shard
- type UserDir
- type UsersXML
- type ZooKeeperNode
Constants ¶
const EnvBin = "CH_BIN"
EnvBin is environmental variable that sets paths to current ClickHouse binary.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Clusters ¶
func (Clusters) MarshalXML ¶
type Config ¶
type Config struct { XMLName xml.Name `xml:"clickhouse"` Logger Logger `xml:"logger"` HTTP int `xml:"http_port"` TCP int `xml:"tcp_port"` Host string `xml:"listen_host"` InterServerHTTP *int `xml:"interserver_http_port,omitempty"` InterServerHTTPHost *string `xml:"interserver_http_host,omitempty"` MaxServerMemoryUsage int `xml:"max_server_memory_usage,omitempty"` Path string `xml:"path"` TempPath string `xml:"tmp_path"` UserFilesPath string `xml:"user_files_path"` UserDirectories UserDir `xml:"user_directories"` MarkCacheSize int64 `xml:"mark_cache_size"` MMAPCacheSize int64 `xml:"mmap_cache_size"` OpenTelemetrySpanLog *OpenTelemetry `xml:"opentelemetry_span_log,omitempty"` // Sets the probability that the ClickHouse can start a trace for executed queries (if no parent trace context is supplied). OpenTelemetryStartTraceProbability *float64 `xml:"opentelemetry_start_trace_probability"` // ZooKeeper configures ZooKeeper nodes. ZooKeeper []ZooKeeperNode `xml:"zookeeper>node,omitempty"` Macros Map `xml:"macros,omitempty"` DistributedDDL *DistributedDDL `xml:"distributed_ddl,omitempty"` // Keeper is config for clickhouse-keeper server. Keeper *KeeperConfig `xml:"keeper_server,omitempty"` RemoteServers Clusters `xml:"remote_servers,omitempty"` }
Config for ClickHouse.
type CoordinationConfig ¶
type CoordinationConfig struct { OperationTimeoutMs int `xml:"operation_timeout_ms,omitempty"` SessionTimeoutMs int `xml:"session_timeout_ms,omitempty"` RaftLogsLevel string `xml:"raft_logs_level,omitempty"` HeartBeatIntervalMs int `xml:"heart_beat_interval_ms,omitempty"` DeadSessionCheckPeriodMs int `xml:"dead_session_check_period_ms,omitempty"` ElectionTimeoutLowerBoundMs int `xml:"election_timeout_lower_bound_ms,omitempty"` ElectionTimeoutUpperBoundMs int `xml:"election_timeout_upper_bound_ms,omitempty"` }
type DistributedDDL ¶
type DistributedDDL struct { Path string `xml:"path,omitempty"` Profile string `xml:"profile,omitempty"` PoolSize int `xml:"pool_size"` TaskMaxLifetime int `xml:"task_max_lifetime,omitempty"` CleanupDelayPeriod int `xml:"cleanup_delay_period,omitempty"` MaxTasksInQueue int `xml:"max_tasks_in_queue,omitempty"` }
type KeeperConfig ¶
type KeeperConfig struct { XMLName xml.Name `xml:"keeper_server"` TCPPort int `xml:"tcp_port,omitempty"` ServerID int `xml:"server_id,omitempty"` LogStoragePath string `xml:"log_storage_path,omitempty"` SnapshotStoragePath string `xml:"snapshot_storage_path,omitempty"` Coordination CoordinationConfig `xml:"coordination_settings"` Raft RaftConfig `xml:"raft_configuration"` }
KeeperConfig is config for clickhouse-keeper.
https://clickhouse.com/docs/en/operations/clickhouse-keeper/
type LogEntry ¶
type Map ¶
func (Map) MarshalXML ¶
type OpenTelemetry ¶
type Option ¶
type Option func(o *options)
func WithClusters ¶
func WithDistributedDDL ¶
func WithDistributedDDL(ddl DistributedDDL) Option
func WithInterServerHTTP ¶
func WithInterServerHost ¶ added in v0.46.1
func WithKeeper ¶
func WithKeeper(cfg KeeperConfig) Option
func WithMacros ¶
func WithMaxServerMemoryUsage ¶ added in v0.47.0
func WithZooKeeper ¶
func WithZooKeeper(nodes []ZooKeeperNode) Option
type RaftConfig ¶
type RaftConfig struct {
Servers []RaftServer `xml:"servers"`
}
type RaftServer ¶
type Server ¶
Server represents testing ClickHouse server.
func New ¶
New creates new ClickHouse server and returns it. Use Many to start multiple servers at once.
Skips tests if CH_E2E variable is set to 0. Fails if CH_E2E is 1, but no binary is available. Skips if CH_E2E is unset and no binary.
Override binary with CH_BIN. Can be clickhouse-server or clickhouse.