testutil

package
v0.0.0-...-f5dfc89 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package testutil implements functions for filtering and configuring tests.

Index

Constants

View Source
const (
	// Integration tests require a mongod running on localhost:33333. If your
	// mongod uses SSL you need to specify the "ssl" type below, and ditto for
	// if your mongod requires auth.
	IntegrationTestType = "integration"

	// Unit tests don't require a real mongod. They may still do file I/O.
	UnitTestType = "unit"

	// Kerberos tests are a special type of integration test that test tools
	// with Kerberos authentication against the drivers Kerberos testing cluster
	// because setting up a KDC every time is too brittle and expensive.
	// (See https://wiki.mongodb.com/display/DH/Testing+Kerberos)
	KerberosTestType = "kerberos"

	// "ssl" and "auth" are used to configure integration tests to run against
	// different mongod configurations. "ssl" will configure the integration tests
	// to expect an SSL-enabled mongod on localhost:33333. "auth" will do the same
	// for an auth-enabled mongod on localhost:33333.
	SSLTestType  = "ssl"
	AuthTestType = "auth"
)

Variables

View Source
var (
	UserAdmin              = "uAdmin"
	UserAdminPassword      = "password"
	CreatedUserNameEnv     = "AUTH_USERNAME"
	CreatedUserPasswordEnv = "AUTH_PASSWORD"
)
View Source
var (
	WinKerberosPwdEnv = "MONGODB_KERBEROS_PASSWORD"
)

Functions

func CreateUserAdmin

func CreateUserAdmin(session *mgo.Session) error

Initialize a user admin, using the already-connected session passed in. Assumes that there are no existing users, otherwise will fail with a permissions issue.

func CreateUserWithRole

func CreateUserWithRole(session *mgo.Session, user,
	password string, role mgo.Role, needsLogin bool) error

Create a user with the specified password and role, using the already-connected session passed in. If needsLogin is true, then the default user admin and password will be used to log in to the admin db before creating the user.

func GetAuthOptions

func GetAuthOptions() options.Auth

func GetKerberosOptions

func GetKerberosOptions() (*options.ToolOptions, error)

func GetSSLOptions

func GetSSLOptions() commonOpts.SSL

func HasTestType

func HasTestType(testType string) bool

func VerifyTestType

func VerifyTestType(t *testing.T, testType string)

Skip the test if the specified type is not being run.

Types

This section is empty.

Jump to

Keyboard shortcuts

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