Version: v2.1.1+incompatible Latest Latest

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

Go to latest
Published: May 22, 2017 License: BSD-3-Clause Imports: 17 Imported by: 0



Package vttest provides the functionality to bring up a test cluster.



This section is empty.


This section is empty.


This section is empty.


type Handle

type Handle struct {
	Data map[string]interface{}
	// contains filtered or unexported fields

Handle allows you to interact with the processes launched by vttest.

func LaunchVitess

func LaunchVitess(
	options ...VitessOption,
) (hdl *Handle, err error)

LaunchVitess launches a vitess test cluster.

func (*Handle) MySQLConnParams

func (hdl *Handle) MySQLConnParams() (sqldb.ConnParams, error)

MySQLConnParams builds the MySQL connection params. It's valid only if you used MySQLOnly option.

func (*Handle) TearDown

func (hdl *Handle) TearDown() error

TearDown tears down the launched processes.

func (*Handle) VtgateAddress

func (hdl *Handle) VtgateAddress() (string, error)

VtgateAddress returns the address under which vtgate is reachable e.g. "localhost:15991". An error is returned if the data is not available.

type InitDataOptions

type InitDataOptions struct {
	// contains filtered or unexported fields

InitDataOptions contain the command line arguments that configure initialization of vttest with random data. See the documentation of the corresponding command line flags in py/vttest/run_local_database.py for the meaning of each field. If a field is nil, the flag will not be specified when running 'run_local_database.py' and the default value for the flag will be used.

type VitessOption

type VitessOption struct {
	// contains filtered or unexported fields

VitessOption is the type for generic options to be passed in to LaunchVitess.

func ExtraMyCnf

func ExtraMyCnf(extraMyCnf string) VitessOption

ExtraMyCnf adds one or more 'my.cnf'-style config files to MySQL. (if more than one, the ':' separator should be used).

func InitData

func InitData(i *InitDataOptions) VitessOption

InitData returns a VitessOption that sets the InitDataOptions parameters.

func MySQLOnly

func MySQLOnly(dbName string) VitessOption

MySQLOnly is used to launch only a mysqld instance, with the specified db name. It cannot be used at the same as ProtoTopo.

func NoStderr

func NoStderr() VitessOption

NoStderr makes the underlying local_cluster stderr output disapper.

func ProtoTopo

func ProtoTopo(topo *vttestpb.VTTestTopology) VitessOption

ProtoTopo is used to pass in the topology as a vttest proto definition. See vttest.proto for more information. It cannot be used at the same time as MySQLOnly.

func Schema

func Schema(schema string) VitessOption

Schema is used to specify SQL commands to run at startup. It conflicts with SchemaDirectory. This option requires a ProtoTopo or MySQLOnly option before.

func SchemaDirectory

func SchemaDirectory(dir string) VitessOption

SchemaDirectory is used to specify a directory to read schema from. It cannot be used at the same time as Schema.

func VSchema

func VSchema(vschema interface{}) VitessOption

VSchema is used to create a vschema.json file in the --schema_dir directory. It must be used *after* the Schema or SchemaDirectory option was provided.

func Verbose

func Verbose(verbose bool) VitessOption

Verbose makes the underlying local_cluster verbose.

Jump to

Keyboard shortcuts

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