testutil

package
v0.0.0-...-95a44f4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package testutil implements functions for filtering and configuring tests.

Index

Constants

This section is empty.

Variables

View Source
var (
	UserAdmin              = "uAdmin"
	UserAdminPassword      = "password"
	CreatedUserNameEnv     = "TOOLS_TESTING_AUTH_USERNAME"
	CreatedUserPasswordEnv = "TOOLS_TESTING_AUTH_PASSWORD"
)

Functions

func CompareFCV

func CompareFCV(x, y string) (int, error)

CompareFCV compares two strings as dot-delimited tuples of integers.

func GetAuthArgs

func GetAuthArgs() []string

func GetAuthOptions

func GetAuthOptions() options.Auth

func GetBareArgs

func GetBareArgs() []string

func GetBareSession

func GetBareSession() (*mongo.Client, error)

GetBareSession returns an mgo.Session from the environment or from a default host and port.

func GetBareSessionProvider

func GetBareSessionProvider() (*db.SessionProvider, *options.ToolOptions, error)

GetBareSessionProvider returns a session provider from the environment or from a default host and port.

func GetFCV

func GetFCV(s *mongo.Client) string

GetFCV returns the featureCompatibilityVersion string for an mgo Session or the empty string if it can't be found.

func GetSSLArgs

func GetSSLArgs() []string

func GetSSLOptions

func GetSSLOptions() commonOpts.SSL

func MakeTempDir

func MakeTempDir(t *testing.T) (string, func())

MakeTempDir will attempt to create a temp directory. If it fails it will abort the test. It returns two values. The first is the string containing the path to the temp directory. The second is a cleanup func that will remove the temp directory. You should always call the cleanup func with `defer` immedatiately after calling this function:

dir, cleanup := testutil.MakeTempDir(t)
defer cleanup()

If the `TOOLS_TESTING_NO_CLEANUP` env var is not empty, then the cleanup function will not delete the directory. This can be useful when investigating test failures.

func MergeOplogStreams

func MergeOplogStreams(input [][]db.Oplog) []db.Oplog

MergeOplogStreams combines oplog arrays such that the order of entries is random, but order-preserving with respect to each initial stream.

Types

This section is empty.

Jump to

Keyboard shortcuts

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