package tests
import "github.com/ClickHouse/clickhouse-go/v2/tests"
Index ¶
- Variables
- func AssertIsTimeoutError(t *testing.T, err error)
- func BuildTestJSONPaths() *chcol.JSON
- func CheckMinServerServerVersion(conn driver.Conn, major, minor, patch uint64) bool
- func CleanupNativeConn(t *testing.T, conn driver.Conn)
- func ClientOptionsFromEnv(env ClickHouseTestEnvironment, settings clickhouse.Settings, useHTTP bool) clickhouse.Options
- func CreateDatabase(testSet string) error
- func GetClickHouseTestVersion() string
- func GetConnection(testSet string, t *testing.T, protocol clickhouse.Protocol, settings clickhouse.Settings, tlsConfig *tls.Config, compression *clickhouse.Compression) (driver.Conn, error)
- func GetConnectionHTTP(testSet string, t *testing.T, settings clickhouse.Settings, tlsConfig *tls.Config, compression *clickhouse.Compression) (driver.Conn, error)
- func GetConnectionTCP(testSet string, settings clickhouse.Settings, tlsConfig *tls.Config, compression *clickhouse.Compression) (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, maxConnLifetime time.Duration, jwtFunc clickhouse.GetJWTFunc) (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 SkipOnHTTP(t *testing.T, protocol clickhouse.Protocol, 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)
- func TestProtocols(rootT *testing.T, testFunc func(t *testing.T, protocol clickhouse.Protocol))
- type ClickHouseTestEnvironment
- func CreateClickHouseTestEnvironment(testSet string) (ClickHouseTestEnvironment, error)
- func GetExternalTestEnvironment(testSet string) (ClickHouseTestEnvironment, error)
- func GetTestEnvironment(testSet string) (ClickHouseTestEnvironment, error)
- type FastTestStruct
- func BuildFastTestJSONStruct() FastTestStruct
- func (fts *FastTestStruct) DeserializeClickHouseJSON(obj *clickhouse.JSON) error
- func (fts *FastTestStruct) SerializeClickHouseJSON() (*clickhouse.JSON, error)
- type NginxReverseHTTPProxyTestEnvironment
- type TestStruct
- type TestStructAddress
- type TinyProxyTestEnvironment
Variables ¶
var CloudClickHouse = false
var LocalClickHouse = false
var RemoteClickHouse = false
Functions ¶
func AssertIsTimeoutError ¶
AssertIsTimeoutError ensures that the error provided is a timeout error. It recursively unwraps the provided error and ensures the core error implements the Timeout() method and it returns true. context deadline error, os deadline error and poll deadline error each implement this and return true.
func BuildTestJSONPaths ¶
func CheckMinServerServerVersion ¶
func CleanupNativeConn ¶
func ClientOptionsFromEnv ¶
func ClientOptionsFromEnv(env ClickHouseTestEnvironment, settings clickhouse.Settings, useHTTP bool) clickhouse.Options
func CreateDatabase ¶
func GetClickHouseTestVersion ¶
func GetClickHouseTestVersion() string
func GetConnection ¶
func GetConnection(testSet string, t *testing.T, protocol clickhouse.Protocol, settings clickhouse.Settings, tlsConfig *tls.Config, compression *clickhouse.Compression) (driver.Conn, error)
func GetConnectionHTTP ¶
func GetConnectionHTTP(testSet string, t *testing.T, settings clickhouse.Settings, tlsConfig *tls.Config, compression *clickhouse.Compression) (driver.Conn, error)
func GetConnectionTCP ¶
func GetConnectionTCP(testSet string, settings clickhouse.Settings, tlsConfig *tls.Config, compression *clickhouse.Compression) (driver.Conn, error)
func GetConnectionWithOptions ¶
func GetEnv ¶
func GetJWTConnection ¶
func GetJWTConnection(testSet string, settings clickhouse.Settings, tlsConfig *tls.Config, maxConnLifetime time.Duration, jwtFunc clickhouse.GetJWTFunc) (driver.Conn, error)
func IsSetInEnv ¶
func OptionsToDSN ¶
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 garbage collection cycles completed. thanks to https://golangcode.com/print-the-current-memory-usage/
func RandAsciiString ¶
func RandIPv4 ¶
func RandIPv6 ¶
func RandIntString ¶
func ResetRandSeed ¶
func ResetRandSeed()
func Runtime ¶
func SetTestEnvironment ¶
func SetTestEnvironment(testSet string, environment ClickHouseTestEnvironment)
func SkipNotCloud ¶
SkipNotCloud skips the test if it's not run on ClickHouse Cloud
func SkipOnCloud ¶
SkipOnCloud skips the test if it's run on ClickHouse Cloud
func SkipOnHTTP ¶
SkipOnHTTP skips the test if the protocol is HTTP
func TestClientDefaultSettings ¶
func TestClientDefaultSettings(env ClickHouseTestEnvironment) clickhouse.Settings
func TestClientWithDefaultOptions ¶
func TestClientWithDefaultOptions(env ClickHouseTestEnvironment, settings clickhouse.Settings) (driver.Conn, error)
func TestClientWithDefaultSettings ¶
func TestClientWithDefaultSettings(env ClickHouseTestEnvironment) (driver.Conn, error)
func TestDatabaseSQLClientWithDefaultOptions ¶
func TestDatabaseSQLClientWithDefaultOptions(env ClickHouseTestEnvironment, settings clickhouse.Settings) (*sql.DB, error)
func TestDatabaseSQLClientWithDefaultSettings ¶
func TestDatabaseSQLClientWithDefaultSettings(env ClickHouseTestEnvironment) (*sql.DB, error)
func TestProtocols ¶
Types ¶
type ClickHouseTestEnvironment ¶
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 ¶
func CreateClickHouseTestEnvironment(testSet string) (ClickHouseTestEnvironment, error)
func GetExternalTestEnvironment ¶
func GetExternalTestEnvironment(testSet string) (ClickHouseTestEnvironment, error)
func GetTestEnvironment ¶
func GetTestEnvironment(testSet string) (ClickHouseTestEnvironment, error)
type FastTestStruct ¶
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 ¶
func BuildFastTestJSONStruct() FastTestStruct
func (*FastTestStruct) DeserializeClickHouseJSON ¶
func (fts *FastTestStruct) DeserializeClickHouseJSON(obj *clickhouse.JSON) error
DeserializeClickHouseJSON implements clickhouse.JSONDeserializer for faster struct scanning
func (*FastTestStruct) SerializeClickHouseJSON ¶
func (fts *FastTestStruct) SerializeClickHouseJSON() (*clickhouse.JSON, error)
SerializeClickHouseJSON implements clickhouse.JSONSerializer for faster struct appending
type NginxReverseHTTPProxyTestEnvironment ¶
type NginxReverseHTTPProxyTestEnvironment struct { HttpPort int NginxContainer testcontainers.Container `json:"-"` }
func CreateNginxReverseProxyTestEnvironment ¶
func CreateNginxReverseProxyTestEnvironment(clickhouseEnv ClickHouseTestEnvironment) (NginxReverseHTTPProxyTestEnvironment, error)
type TestStruct ¶
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 ¶
func BuildTestJSONStruct() TestStruct
type TestStructAddress ¶
type TestStructAddress struct { Street string `chType:"String"` City string `chType:"String"` Country string `chType:"String"` }
type TinyProxyTestEnvironment ¶
type TinyProxyTestEnvironment struct { HttpPort int Container testcontainers.Container `json:"-"` }
func CreateTinyProxyTestEnvironment ¶
func CreateTinyProxyTestEnvironment(t *testing.T) (TinyProxyTestEnvironment, error)
func (TinyProxyTestEnvironment) ProxyUrl ¶
func (e TinyProxyTestEnvironment) ProxyUrl(t *testing.T) string
Source Files ¶
error_util.go json_helper.go package.go utils.go
Directories ¶
Path | Synopsis |
---|---|
tests/issues | |
tests/issues/209 | |
tests/issues/360 | |
tests/issues/470 | |
tests/issues/476 | |
tests/issues/484 | |
tests/issues/485 | |
tests/std | |
tests/stress |
- Version
- v2.40.1 (latest)
- Published
- Jul 30, 2025
- Platform
- windows/amd64
- Imports
- 31 packages
- Last checked
- 4 seconds ago –
Tools for package owners.