mongo-driver: go.mongodb.org/mongo-driver/internal/testutil Index | Files | Directories

package testutil

import "go.mongodb.org/mongo-driver/internal/testutil"

Index

Package Files

config.go ops.go

func AddCompressorToUri Uses

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 Uses

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

AddOptionsToURI appends connection string options to a URI.

func AddTLSConfigToURI Uses

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 Uses

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

AutoCreateIndexes creates an index in the test cluster.

func AutoDropCollection Uses

func AutoDropCollection(t *testing.T)

AutoDropCollection drops the collection in the test cluster.

func AutoInsertDocs Uses

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

AutoInsertDocs inserts the docs into the test cluster.

func ColName Uses

func ColName(t *testing.T) string

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

func CompareVersions Uses

func CompareVersions(t *testing.T, v1 string, v2 string) int

compareVersions compares two version number strings (i.e. positive integers separated by periods). Comparisons are done to the lesser precision of the two versions. For example, 3.2 is considered equal to 3.2.11, whereas 3.2.0 is considered less than 3.2.11.

Returns a positive int if version1 is greater than version2, a negative int if version1 is less than version2, and 0 if version1 is equal to version2.

func ConnString Uses

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

ConnString gets the globally configured connection string.

func DBName Uses

func DBName(t *testing.T) string

DBName gets the globally configured database name.

func DisableMaxTimeFailPoint Uses

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

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

func DropCollection Uses

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

DropCollection drops the collection in the test cluster.

func EnableMaxTimeFailPoint Uses

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

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

func GetConnString Uses

func GetConnString() (connstring.ConnString, error)

func GetDBName Uses

func GetDBName(cs connstring.ConnString) string

func GlobalMonitoredSessionPool Uses

func GlobalMonitoredSessionPool() *session.Pool

GlobalMonitoredSessionPool returns the globally configured session pool. Must be called after GlobalMonitoredTopology()

func GlobalMonitoredTopology Uses

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

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

func InsertDocs Uses

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

InsertDocs inserts the docs into the test cluster.

func Integration Uses

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 Uses

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

MonitoredTopology returns a new topology with the command monitor attached

func RunCommand Uses

func RunCommand(t *testing.T, s *topology.Server, db string, cmd bsoncore.Document) (bsoncore.Document, error)

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

func SessionPool Uses

func SessionPool() *session.Pool

SessionPool gets the globally configured session pool. Must be called after Topology().

func Topology Uses

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

Topology gets the globally configured topology.

func TopologyWithConnString Uses

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

Directories

PathSynopsis
helpers
isracePackage israce reports if the Go race detector is enabled.

Package testutil imports 19 packages (graph) and is imported by 1 packages. Updated 2019-10-10. Refresh now. Tools for package owners.