testenv

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package testenv supplies test functions for testing vstreamer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	KeyspaceName string
	ShardName    string
	Cells        []string

	TabletEnv    tabletenv.Env
	TopoServ     *topo.Server
	SrvTopo      srvtopo.Server
	Dbcfgs       *dbconfigs.DBConfigs
	Mysqld       *mysqlctl.Mysqld
	SchemaEngine *schema.Engine
	// MySQL and Percona are considered equivalent here and both called mysql
	DBType         string
	DBMajorVersion int
	DBMinorVersion int
	DBPatchVersion int
	// contains filtered or unexported fields
}

Env contains all the env vars for a test against a mysql instance.

func Init

func Init(ctx context.Context) (*Env, error)

Init initializes an Env.

func (*Env) Close

func (te *Env) Close()

Close tears down TestEnv.

func (*Env) HasCapability added in v0.17.0

func (te *Env) HasCapability(cap ServerCapability) bool

HasCapability returns true if the server has the given capability. Used to skip tests that require a certain version of MySQL.

func (*Env) RemoveAnyDeprecatedDisplayWidths added in v0.12.1

func (te *Env) RemoveAnyDeprecatedDisplayWidths(orig string) string

In MySQL 8.0 and later information_schema no longer contains the display width for integer types and as of 8.0.19 for year types as this was an unnecessary headache because it can only serve to confuse if the display width is less than the type width (8.0 no longer supports the 2 digit YEAR). So if the test is running against MySQL 8.0 or later then you should use this function to replace e.g. `int([0-9]*)` with `int` in the expected results string that we define in the test.

func (*Env) SetVSchema

func (te *Env) SetVSchema(vs string) error

SetVSchema sets the vschema for the test keyspace.

type ServerCapability added in v0.17.0

type ServerCapability int32

ServerCapability is used to define capabilities for which we want to optionally run tests if the underlying mysql server supports them.

const (
	ServerCapabilityInvisibleColumn              ServerCapability = 1
	ServerCapabilityGeneratedInvisiblePrimaryKey ServerCapability = 2
)

Jump to

Keyboard shortcuts

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