testutil

package
v0.0.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCompressorToUri added in v0.0.8

func AddCompressorToUri(uri string) string

AddCompressorToUri checks for the environment variable indicating that the tests are being run with compression enabled. If so, it returns a new URI with the necessary configuration

func AddOptionsToURI

func AddOptionsToURI(uri string, opts ...string) string

AddOptionsToURI appends connection string options to a URI.

func AddTLSConfigToURI

func AddTLSConfigToURI(uri string) string

AddTLSConfigToURI checks for the environmental variable indicating that the tests are being run on an SSL-enabled server, and if so, returns a new URI with the necessary configuration.

func AutoCreateIndexes

func AutoCreateIndexes(t *testing.T, keys []string)

AutoCreateIndexes creates an index in the test cluster.

func AutoDropCollection

func AutoDropCollection(t *testing.T)

AutoDropCollection drops the collection in the test cluster.

func AutoInsertDocs

func AutoInsertDocs(t *testing.T, writeConcern *writeconcern.WriteConcern, docs ...*bson.Document)

AutoInsertDocs inserts the docs into the test cluster.

func ColName

func ColName(t *testing.T) string

ColName gets a collection name that should be unique to the currently executing test.

func ConnString

func ConnString(t *testing.T) connstring.ConnString

ConnString gets the globally configured connection string.

func DBName

func DBName(t *testing.T) string

DBName gets the globally configured database name.

func DisableMaxTimeFailPoint

func DisableMaxTimeFailPoint(t *testing.T, s *topology.Server)

DisableMaxTimeFailPoint turns off the max time fail point in the test cluster.

func DropCollection

func DropCollection(t *testing.T, dbname, colname string)

DropCollection drops the collection in the test cluster.

func EnableMaxTimeFailPoint

func EnableMaxTimeFailPoint(t *testing.T, s *topology.Server) error

EnableMaxTimeFailPoint turns on the max time fail point in the test cluster.

func GetConnString added in v0.0.8

func GetConnString() (connstring.ConnString, error)

func GetDBName added in v0.0.8

func GetDBName(cs connstring.ConnString) string

func InsertDocs

func InsertDocs(t *testing.T, dbname, colname string, writeConcern *writeconcern.WriteConcern, docs ...*bson.Document)

InsertDocs inserts the docs into the test cluster.

func Integration

func Integration(t *testing.T)

Integration should be called at the beginning of integration tests to ensure that they are skipped if integration testing is turned off.

func MonitoredTopology added in v0.0.10

func MonitoredTopology(t *testing.T, monitor *event.CommandMonitor) *topology.Topology

MonitoredTopology gets the globally configured topology and attaches a command monitor.

func RunCommand added in v0.0.12

func RunCommand(t *testing.T, s *topology.Server, db string, b *bson.Document) (bson.Reader, error)

RunCommand runs an arbitrary command on a given database of target server

func Topology

func Topology(t *testing.T) *topology.Topology

Topology gets the globally configured topology.

func TopologyWithConnString added in v0.0.12

func TopologyWithConnString(t *testing.T, cs connstring.ConnString) *topology.Topology

TopologyWithConnString takes a connection string and returns a connected topology, or else bails out of testing

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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