framework

package
v2.0.0-alpha3+incompat... Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BaseConfig is the base config of the default server.
	BaseConfig tabletserver.Config
	// Target is the target info for the default server.
	Target query.Target
	// DefaultServer is the default server.
	DefaultServer *tabletserver.TabletServer
	// ServerAddress is the http URL for the default server.
	ServerAddress string
)

Functions

func DebugVars

func DebugVars() map[string]interface{}

DebugVars parses /debug/vars and returns a map. The function returns an empty map on error.

func FetchInt

func FetchInt(vars map[string]interface{}, tags string) int

FetchInt fetches the specified dot-separated tag and returns the value as an int. It returns 0 on error, or if not found.

func FetchVal

func FetchVal(vars map[string]interface{}, tags string) interface{}

FetchVal fetches the specified dot-separated tag and returns the value as an interface. It returns nil on error, or if not found.

func NewServer

func NewServer(config tabletserver.Config, connParams sqldb.ConnParams, enableRowcache bool) (*tabletserver.TabletServer, error)

NewServer starts a new unregistered TabletServer. You have to end it with StopService once testing is done.

func StartDefaultServer

func StartDefaultServer(connParams sqldb.ConnParams) error

StartDefaultServer starts the default server and initializes all the global variables. This function should only be called once at the beginning of the test.

func StopDefaultServer

func StopDefaultServer()

StopDefaultServer must be called once all the tests are done.

Types

type QueryClient

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

QueryClient provides a convenient wrapper for TabletServer's query service. It's not thread safe, but you can create multiple clients that point to the same server.

func NewClient

func NewClient(server *tabletserver.TabletServer) *QueryClient

NewClient creates a new client for the specified server.

func NewDefaultClient

func NewDefaultClient() *QueryClient

NewDefaultClient creates a new client for the default server.

func (*QueryClient) Begin

func (client *QueryClient) Begin() error

Begin begins a transaction.

func (*QueryClient) Commit

func (client *QueryClient) Commit() error

Commit commits the current transaction.

func (*QueryClient) Execute

func (client *QueryClient) Execute(query string, bindvars map[string]interface{}) (*mproto.QueryResult, error)

Execute executes a query.

func (*QueryClient) Rollback

func (client *QueryClient) Rollback() error

Rollback rolls back the current transaction.

type QueryFetcher

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

QueryFetcher allows you to capture and fetch queries that are being executed by TabletServer.

func NewQueryFetcher

func NewQueryFetcher() *QueryFetcher

NewQueryFetcher sets up the capture and retuns a QueryFetcher. It has a buffer size of 20. You must call Close once done.

func (*QueryFetcher) Close

func (fetcher *QueryFetcher) Close()

Close closes the QueryFetcher.

func (*QueryFetcher) Next

func (fetcher *QueryFetcher) Next() (*tabletserver.LogStats, error)

Next fetches the next captured query. If the wait is longer than one second, it returns an error.

type TxFetcher

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

TxFetcher allows you to capture and fetch info on the next transaction.

func NewTxFetcher

func NewTxFetcher() *TxFetcher

NewTxFetcher sets up the capture and returns a new TxFetcher.

func (*TxFetcher) Fetch

func (fetcher *TxFetcher) Fetch() (*tabletserver.TxConnection, error)

Fetch fetches the last captured transaction. It must be called only once. If the wait is longer than one second, it returns an error.

Jump to

Keyboard shortcuts

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