Documentation
¶
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 datastore.Settings, useHTTP bool) datastore.Options
- func CreateDatabase(testSet string) error
- func GetClickHouseTestVersion() string
- func GetConnection(testSet string, t *testing.T, protocol datastore.Protocol, ...) (driver.Conn, error)
- func GetConnectionHTTP(testSet string, sessionName string, settings datastore.Settings, ...) (driver.Conn, error)
- func GetConnectionTCP(testSet string, settings datastore.Settings, tlsConfig *tls.Config, ...) (driver.Conn, error)
- func GetConnectionWithOptions(options *datastore.Options) (driver.Conn, error)
- func GetEnv(key, fallback string) string
- func GetJWTConnection(testSet string, settings datastore.Settings, tlsConfig *tls.Config, ...) (driver.Conn, error)
- func IsSetInEnv(key string) bool
- func OptionsToDSN(o *datastore.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 datastore.Protocol, reasons ...string)
- func TestClientDefaultSettings(env ClickHouseTestEnvironment) datastore.Settings
- func TestClientWithDefaultOptions(env ClickHouseTestEnvironment, settings datastore.Settings) (driver.Conn, error)
- func TestClientWithDefaultSettings(env ClickHouseTestEnvironment) (driver.Conn, error)
- func TestDatabaseSQLClientWithDefaultOptions(env ClickHouseTestEnvironment, settings datastore.Settings) (*sql.DB, error)
- func TestDatabaseSQLClientWithDefaultSettings(env ClickHouseTestEnvironment) (*sql.DB, error)
- func TestProtocols(rootT *testing.T, testFunc func(t *testing.T, protocol datastore.Protocol))
- 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 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 ClientOptionsFromEnv ¶
func CreateDatabase ¶
func GetClickHouseTestVersion ¶
func GetClickHouseTestVersion() string
func GetConnection ¶
func GetConnectionHTTP ¶
func GetConnectionTCP ¶
func GetJWTConnection ¶
func IsSetInEnv ¶
func OptionsToDSN ¶
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 RandIntString ¶
func ResetRandSeed ¶
func ResetRandSeed()
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) datastore.Settings
func TestClientWithDefaultSettings ¶
func TestClientWithDefaultSettings(env ClickHouseTestEnvironment) (driver.Conn, error)
func TestDatabaseSQLClientWithDefaultSettings ¶
func TestDatabaseSQLClientWithDefaultSettings(env ClickHouseTestEnvironment) (*sql.DB, error)
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 datastore.JSONSerializer and datastore.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 *datastore.JSON) error
DeserializeClickHouseJSON implements datastore.JSONDeserializer for faster struct scanning
func (*FastTestStruct) SerializeClickHouseJSON ¶
func (fts *FastTestStruct) SerializeClickHouseJSON() (*datastore.JSON, error)
SerializeClickHouseJSON implements datastore.JSONSerializer for faster struct appending
type NginxReverseHTTPProxyTestEnvironment ¶
type NginxReverseHTTPProxyTestEnvironment struct {
HttpPort int
NginxContainer testcontainers.Container `json:"-"`
}
func CreateNginxReverseProxyTestEnvironment ¶
func CreateNginxReverseProxyTestEnvironment(datastoreEnv 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 TinyProxyTestEnvironment ¶
type TinyProxyTestEnvironment struct {
HttpPort int
Container testcontainers.Container `json:"-"`
}
func CreateTinyProxyTestEnvironment ¶
func CreateTinyProxyTestEnvironment(t *testing.T) (TinyProxyTestEnvironment, error)