localtestcluster

package
v0.0.0-...-ad86efc Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InitSenderFn

type InitSenderFn func(
	nodeDesc *roachpb.NodeDescriptor,
	tracer opentracing.Tracer,
	clock *hlc.Clock,
	latency time.Duration,
	stores client.Sender,
	stopper *stop.Stopper,
	gossip *gossip.Gossip,
) client.Sender

InitSenderFn is a callback used to initiate the txn coordinator (we don't do it directly from this package to avoid a dependency on kv).

type LocalTestCluster

type LocalTestCluster struct {
	Manual            *hlc.ManualClock
	Clock             *hlc.Clock
	Gossip            *gossip.Gossip
	Eng               engine.Engine
	Store             *storage.Store
	DBContext         *client.DBContext
	DB                *client.DB
	RangeRetryOptions *retry.Options
	Stores            *storage.Stores
	Sender            client.Sender
	Stopper           *stop.Stopper
	Latency           time.Duration // sleep for each RPC sent
	// contains filtered or unexported fields
}

A LocalTestCluster encapsulates an in-memory instantiation of a cockroach node with a single store using a local sender. Example usage of a LocalTestCluster follows:

s := &LocalTestCluster{}
s.Start(t, testutils.NewNodeTestBaseContext(),
        kv.InitSenderForLocalTestCluster)
defer s.Stop()

Note that the LocalTestCluster is different from server.TestCluster in that although it uses a distributed sender, there is no RPC traffic.

func (*LocalTestCluster) Start

func (ltc *LocalTestCluster) Start(t util.Tester, baseCtx *base.Context, initSender InitSenderFn)

Start starts the test cluster by bootstrapping an in-memory store (defaults to maximum of 50M). The server is started, launching the node RPC server and all HTTP endpoints. Use the value of TestServer.Addr after Start() for client connections. Use Stop() to shutdown the server after the test completes.

func (*LocalTestCluster) Stop

func (ltc *LocalTestCluster) Stop()

Stop stops the cluster.

Jump to

Keyboard shortcuts

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