Documentation ¶
Overview ¶
Package testutil implements functions for filtering and configuring tests.
Index ¶
- Constants
- Variables
- func CreateUserAdmin(session *mgo.Session) error
- func CreateUserWithRole(session *mgo.Session, user, password string, role mgo.Role, needsLogin bool) error
- func GetAuthOptions() options.Auth
- func GetKerberosOptions() (*options.ToolOptions, error)
- func GetSSLOptions() commonOpts.SSL
- func HasTestType(testType string) bool
- func VerifyTestType(t *testing.T, testType string)
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 GetKerberosOptions ¶
func GetKerberosOptions() (*options.ToolOptions, error)
func GetSSLOptions ¶
func GetSSLOptions() commonOpts.SSL
func HasTestType ¶
func VerifyTestType ¶
Skip the test if the specified type is not being run.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.