faketopo

package
v0.0.0-...-bc668d9 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2015 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package faketopo contains utitlities for tests that have to interact with a Vitess topology.

Index

Constants

View Source
const (
	// TestShard is the shard we use in tests
	TestShard = "0"

	// TestKeyspace is the keyspace we use in tests
	TestKeyspace = "test_keyspace"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Fixture

type Fixture struct {
	*testing.T

	Topo     topo.Server
	Wrangler *wrangler.Wrangler
	// contains filtered or unexported fields
}

Fixture is a fixture that provides a fresh topology, to which you can add tablets that react to events and have fake MySQL daemons. It uses an in memory fake ZooKeeper to store its data. When you are done with the fixture you have to call its TearDown method.

func New

func New(t *testing.T, logger logutil.Logger, ts topo.Server, cells []string) *Fixture

New creates a topology fixture.

func (*Fixture) AddTablet

func (fix *Fixture) AddTablet(uid int, cell string, tabletType topo.TabletType, master *topo.Tablet) *topo.Tablet

AddTablet adds a new tablet to the topology and starts its event loop.

func (*Fixture) GetTablet

func (fix *Fixture) GetTablet(uid int) *topo.TabletInfo

GetTablet returns a fresh copy of the tablet identified by uid.

func (*Fixture) MakeMySQLMaster

func (fix *Fixture) MakeMySQLMaster(uid int)

MakeMySQLMaster makes the (fake) MySQL used by tablet identified by uid the master.

func (*Fixture) TearDown

func (fix *Fixture) TearDown()

TearDown releases any resources used by the fixture.

Jump to

Keyboard shortcuts

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