xxt

package
v0.9.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthPluginNative     = "mysql_native_password"
	AuthPluginCachedSha2 = "caching_sha2_password"
)

Variables

This section is empty.

Functions

func AssertMySQLError

func AssertMySQLError(t *testing.T, err error, code int)

func NewTestErr

func NewTestErr(err error, format string, a ...any) error

Types

type Container

type Container struct {
	Name string
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer(name string, dockerExec string) (*Container, error)

func (Container) CheckRunning

func (c Container) CheckRunning() error

CheckRunning checks whether the container is running.

func (Container) CopyFileFromContainer

func (c Container) CopyFileFromContainer(srcPath, dstPath string) error

CopyFileFromContainer copies a file from a Docker container.

type GoBuilder

type GoBuilder struct {
	Container *Container
	// contains filtered or unexported fields
}

func NewGoBuilder

func NewGoBuilder(tctx *TestContext, container *Container) (*GoBuilder, error)

func (GoBuilder) App

func (gb GoBuilder) App(name string) ([]byte, error)

App takes the application name which is located in the container's shared volume located at "/shared".

type MemoryUse

type MemoryUse struct {
	// contains filtered or unexported fields
}

func NewMemoryUse

func NewMemoryUse() *MemoryUse

func (*MemoryUse) DiffAlloc

func (m *MemoryUse) DiffAlloc() uint64

func (*MemoryUse) Stop

func (m *MemoryUse) Stop()

func (MemoryUse) String

func (m MemoryUse) String() string

type MySQLServer

type MySQLServer struct {
	Container *Container
	Schema    string
	Version   string
	// contains filtered or unexported fields
}

func NewMySQLServer

func NewMySQLServer(tctx *TestContext, container *Container, schema string) (*MySQLServer, error)

func (MySQLServer) CreateUser

func (my MySQLServer) CreateUser(username, password, schema, authPlugin string) error

func (MySQLServer) DropUser

func (my MySQLServer) DropUser(username string) error

func (MySQLServer) ExecApp

func (my MySQLServer) ExecApp(path string) ([]byte, error)

ExecApp runs the application within the container found at path and returns its output.

func (MySQLServer) ExecSQLStmt

func (my MySQLServer) ExecSQLStmt(stmt string) ([]byte, error)

ExecSQLStmt executes the SQL stmt using the mysql CLI within the container. This is not SQL-injection safe and is only used for testing.

func (MySQLServer) FlushPrivileges

func (my MySQLServer) FlushPrivileges() error

func (MySQLServer) LoadSQLScript

func (my MySQLServer) LoadSQLScript(scripts ...string) error

LoadSQLScript executes the statements from files provided as scripts using the mysql CLI within the container.

func (MySQLServer) Variable

func (my MySQLServer) Variable(scope, variable string) (string, error)

type TestContext

type TestContext struct {
	MySQLRootPwd string
	XPluginAddr  string
	MySQLAddr    string
	Server       *MySQLServer
	Builder      *GoBuilder
}

func New

func New(schema string) (*TestContext, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL