Documentation
¶
Index ¶
- Variables
- func BuildTestJSONPaths() *chcol.JSON
- func CheckMinServerServerVersion(conn driver.Conn, major, minor, patch uint64) bool
- func ClientOptionsFromEnv(env ClickHouseTestEnvironment, settings clickhouse.Settings, useHTTP bool) clickhouse.Options
- func CreateDatabase(testSet string) error
- func GetClickHouseTestVersion() string
- func GetConnection(testSet string, settings clickhouse.Settings, tlsConfig *tls.Config, ...) (driver.Conn, error)
- func GetConnectionWithOptions(options *clickhouse.Options) (driver.Conn, error)
- func GetEnv(key, fallback string) string
- func GetJWTConnection(testSet string, settings clickhouse.Settings, tlsConfig *tls.Config, ...) (driver.Conn, error)
- func IsSetInEnv(key string) bool
- func OptionsToDSN(o *clickhouse.Options) string
- func PrintMemUsage()
- func RandAsciiString(n int) string
- func RandIPv4() net.IP
- func RandIPv6() net.IP
- func RandIntString(n int) string
- func ResetRandSeed()
- func Runtime(m *testing.M, ts string) (exitCode int)
- func SetTestEnvironment(testSet string, environment ClickHouseTestEnvironment)
- func SkipNotCloud(t *testing.T, reasons ...string)
- func SkipOnCloud(t *testing.T, reasons ...string)
- func TestClientDefaultSettings(env ClickHouseTestEnvironment) clickhouse.Settings
- func TestClientWithDefaultOptions(env ClickHouseTestEnvironment, settings clickhouse.Settings) (driver.Conn, error)
- func TestClientWithDefaultSettings(env ClickHouseTestEnvironment) (driver.Conn, error)
- func TestDatabaseSQLClientWithDefaultOptions(env ClickHouseTestEnvironment, settings clickhouse.Settings) (*sql.DB, error)
- func TestDatabaseSQLClientWithDefaultSettings(env ClickHouseTestEnvironment) (*sql.DB, error)
- type ClickHouseTestEnvironment
- type FastTestStruct
- type NginxReverseHTTPProxyTestEnvironment
- type TestStruct
- type TestStructAddress
- type TinyProxyTestEnvironment
Constants ¶
This section is empty.
Variables ¶
var CloudClickHouse = false
var JSONTestDate, _ = time.Parse(time.RFC3339, "2024-12-13T02:09:30.123Z")
var LocalClickHouse = false
var RemoteClickHouse = false
Functions ¶
func BuildTestJSONPaths ¶ added in v2.31.0
func CheckMinServerServerVersion ¶ added in v2.4.0
func ClientOptionsFromEnv ¶ added in v2.10.0
func ClientOptionsFromEnv(env ClickHouseTestEnvironment, settings clickhouse.Settings, useHTTP bool) clickhouse.Options
func CreateDatabase ¶ added in v2.4.0
func GetClickHouseTestVersion ¶ added in v2.4.0
func GetClickHouseTestVersion() string
func GetConnection ¶ added in v2.4.0
func GetConnectionWithOptions ¶ added in v2.4.0
func GetJWTConnection ¶ added in v2.35.0
func IsSetInEnv ¶ added in v2.4.0
func OptionsToDSN ¶ added in v2.27.0
func OptionsToDSN(o *clickhouse.Options) string
func PrintMemUsage ¶
func PrintMemUsage()
PrintMemUsage outputs the current, total and OS memory being used. As well as the number of garage collection cycles completed. thanks to https://golangcode.com/print-the-current-memory-usage/
func RandAsciiString ¶
func RandIntString ¶
func ResetRandSeed ¶ added in v2.33.0
func ResetRandSeed()
func SetTestEnvironment ¶ added in v2.4.0
func SetTestEnvironment(testSet string, environment ClickHouseTestEnvironment)
func SkipNotCloud ¶ added in v2.35.0
SkipNotCloud skips the test if it's not run on ClickHouse Cloud
func SkipOnCloud ¶ added in v2.20.0
SkipOnCloud skips the test if it's run on ClickHouse Cloud
func TestClientDefaultSettings ¶ added in v2.22.3
func TestClientDefaultSettings(env ClickHouseTestEnvironment) clickhouse.Settings
func TestClientWithDefaultOptions ¶ added in v2.28.0
func TestClientWithDefaultOptions(env ClickHouseTestEnvironment, settings clickhouse.Settings) (driver.Conn, error)
func TestClientWithDefaultSettings ¶ added in v2.10.0
func TestClientWithDefaultSettings(env ClickHouseTestEnvironment) (driver.Conn, error)
func TestDatabaseSQLClientWithDefaultOptions ¶ added in v2.22.3
func TestDatabaseSQLClientWithDefaultOptions(env ClickHouseTestEnvironment, settings clickhouse.Settings) (*sql.DB, error)
func TestDatabaseSQLClientWithDefaultSettings ¶ added in v2.22.3
func TestDatabaseSQLClientWithDefaultSettings(env ClickHouseTestEnvironment) (*sql.DB, error)
Types ¶
type ClickHouseTestEnvironment ¶ added in v2.4.0
type ClickHouseTestEnvironment struct {
ContainerID string
Port int
HttpPort int
SslPort int
HttpsPort int
Host string
Username string
Password string
JWT string
Database string
Version proto.Version
ContainerIP string
Container testcontainers.Container `json:"-"`
}
func CreateClickHouseTestEnvironment ¶ added in v2.4.0
func CreateClickHouseTestEnvironment(testSet string) (ClickHouseTestEnvironment, error)
func GetExternalTestEnvironment ¶ added in v2.4.0
func GetExternalTestEnvironment(testSet string) (ClickHouseTestEnvironment, error)
func GetTestEnvironment ¶ added in v2.4.0
func GetTestEnvironment(testSet string) (ClickHouseTestEnvironment, error)
type FastTestStruct ¶ added in v2.31.0
type FastTestStruct struct {
// contains filtered or unexported fields
}
FastTestStruct is a distinctly separate type that implements clickhouse.JSONSerializer and clickhouse.JSONDeserializer The struct must be a separate type since the JSON column is unable to ignore the interface implementation.
func BuildFastTestJSONStruct ¶ added in v2.31.0
func BuildFastTestJSONStruct() FastTestStruct
func (*FastTestStruct) DeserializeClickHouseJSON ¶ added in v2.31.0
func (fts *FastTestStruct) DeserializeClickHouseJSON(obj *clickhouse.JSON) error
DeserializeClickHouseJSON implements clickhouse.JSONDeserializer for faster struct scanning
func (*FastTestStruct) SerializeClickHouseJSON ¶ added in v2.31.0
func (fts *FastTestStruct) SerializeClickHouseJSON() (*clickhouse.JSON, error)
SerializeClickHouseJSON implements clickhouse.JSONSerializer for faster struct appending
type NginxReverseHTTPProxyTestEnvironment ¶ added in v2.8.0
type NginxReverseHTTPProxyTestEnvironment struct {
HttpPort int
NginxContainer testcontainers.Container `json:"-"`
}
func CreateNginxReverseProxyTestEnvironment ¶ added in v2.8.0
func CreateNginxReverseProxyTestEnvironment(clickhouseEnv ClickHouseTestEnvironment) (NginxReverseHTTPProxyTestEnvironment, error)
type TestStruct ¶ added in v2.31.0
type TestStruct struct {
Name string
Age int64
Active bool
Score float64
Tags []string
Numbers []int64
Address TestStructAddress
KeysNumbers map[string]int64
Metadata map[string]interface{}
Timestamp time.Time `chType:"DateTime64(3)"`
DynamicString chcol.Dynamic
DynamicInt chcol.Dynamic
DynamicMap chcol.Dynamic
}
func BuildTestJSONStruct ¶ added in v2.31.0
func BuildTestJSONStruct() TestStruct
type TestStructAddress ¶ added in v2.31.0
type TinyProxyTestEnvironment ¶ added in v2.9.2
type TinyProxyTestEnvironment struct {
HttpPort int
Container testcontainers.Container `json:"-"`
}
func CreateTinyProxyTestEnvironment ¶ added in v2.9.2
func CreateTinyProxyTestEnvironment(t *testing.T) (TinyProxyTestEnvironment, error)