summaryrefslogtreecommitdiff
path: root/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go')
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go
index 48ef3611587..18eb9b4b64f 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go
@@ -15,12 +15,15 @@ import (
"github.com/mongodb/mongo-tools/common/testtype"
"github.com/mongodb/mongo-tools/common/testutil"
. "github.com/smartystreets/goconvey/convey"
- "gopkg.in/mgo.v2"
)
func TestVanillaDBConnector(t *testing.T) {
- testtype.VerifyTestType(t, "db")
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
+ // VanillaDBConnector can't connect if SSL or Auth are enabled
+ if testtype.HasTestType(testtype.SSLTestType) || testtype.HasTestType(testtype.AuthTestType) {
+ t.SkipNow()
+ }
Convey("With a vanilla db connector", t, func() {
@@ -72,22 +75,17 @@ func TestVanillaDBConnector(t *testing.T) {
}
func TestVanillaDBConnectorWithAuth(t *testing.T) {
- testtype.VerifyTestType(t, "auth")
- session, err := mgo.Dial("localhost:33333")
- if err != nil {
- t.Fatalf("error dialing server: %v", err)
+ testtype.SkipUnlessTestType(t, testtype.AuthTestType)
+ // VanillaDBConnector can't connect if SSL is enabled
+ if testtype.HasTestType(testtype.SSLTestType) {
+ t.SkipNow()
}
- err = testutil.CreateUserAdmin(session)
- So(err, ShouldBeNil)
- err = testutil.CreateUserWithRole(session, "cAdmin", "password",
- mgo.RoleClusterAdmin, true)
- So(err, ShouldBeNil)
- session.Close()
-
Convey("With a vanilla db connector and a mongod running with"+
" auth", t, func() {
+ auth := testutil.GetAuthOptions()
+
var connector *db.VanillaDBConnector
Convey("connecting without authentication should not be able"+
@@ -123,10 +121,7 @@ func TestVanillaDBConnectorWithAuth(t *testing.T) {
Host: "localhost",
Port: db.DefaultTestPort,
},
- Auth: &options.Auth{
- Username: "cAdmin",
- Password: "password",
- },
+ Auth: &auth,
}
So(connector.Configure(opts), ShouldBeNil)