diff --git a/mongo/integration/initial_dns_seedlist_discovery_test.go b/mongo/integration/initial_dns_seedlist_discovery_test.go index 10cd49bd0a..3e4ef08d5d 100644 --- a/mongo/integration/initial_dns_seedlist_discovery_test.go +++ b/mongo/integration/initial_dns_seedlist_discovery_test.go @@ -15,12 +15,15 @@ import ( "runtime" "strings" "testing" + "time" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/internal/testutil/assert" + "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/description" "go.mongodb.org/mongo-driver/mongo/integration/mtest" "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/mongo/readpref" "go.mongodb.org/mongo-driver/x/mongo/driver/connstring" "go.mongodb.org/mongo-driver/x/mongo/driver/topology" ) @@ -37,6 +40,7 @@ type seedlistTest struct { NumHosts *int `bson:"numHosts"` Error bool `bson:"error"` Options bson.Raw `bson:"options"` + Ping *bool `bson:"ping"` } func TestInitialDNSSeedlistDiscoverySpec(t *testing.T) { @@ -44,12 +48,18 @@ func TestInitialDNSSeedlistDiscoverySpec(t *testing.T) { defer mt.Close() mt.RunOpts("replica set", mtest.NewOptions().Topologies(mtest.ReplicaSet).CreateClient(false), func(mt *mtest.T) { + mt.Parallel() + runSeedlistDiscoveryDirectory(mt, "replica-set") }) mt.RunOpts("sharded", mtest.NewOptions().Topologies(mtest.Sharded).CreateClient(false), func(mt *mtest.T) { + mt.Parallel() + runSeedlistDiscoveryDirectory(mt, "sharded") }) mt.RunOpts("load balanced", mtest.NewOptions().Topologies(mtest.LoadBalanced).CreateClient(false), func(mt *mtest.T) { + mt.Parallel() + runSeedlistDiscoveryDirectory(mt, "load-balanced") }) } @@ -63,6 +73,24 @@ func runSeedlistDiscoveryDirectory(mt *mtest.T, subdirectory string) { } } +// runSeedlistDiscoveryPingTest will create a new connection using the test URI and attempt to "ping" the server. +func runSeedlistDiscoveryPingTest(mt *mtest.T, clientOpts *options.ClientOptions) { + ctx := context.Background() + + client, err := mongo.Connect(ctx, clientOpts) + assert.Nil(mt, err, "Connect error: %v", err) + + defer func() { _ = client.Disconnect(ctx) }() + + // Create a context with a timeout to prevent the ping operation from blocking indefinitely. + pingCtx, cancel := context.WithTimeout(ctx, 1*time.Second) + defer cancel() + + // Ping the server. + err = client.Ping(pingCtx, readpref.Nearest()) + assert.Nil(mt, err, "Ping error: %v", err) +} + func runSeedlistDiscoveryTest(mt *mtest.T, file string) { content, err := ioutil.ReadFile(file) assert.Nil(mt, err, "ReadFile error for %v: %v", file, err) @@ -131,6 +159,10 @@ func runSeedlistDiscoveryTest(mt *mtest.T, file string) { _, err := getServerByAddress(host, topo) assert.Nil(mt, err, "error finding host %q: %v", host, err) } + + if ping := test.Ping; ping == nil || *ping { + runSeedlistDiscoveryPingTest(mt, opts) + } } func buildSet(list []string) map[string]struct{} { @@ -230,6 +262,14 @@ func getServerByAddress(address string, topo *topology.Topology) (description.Se if err != nil { return description.Server{}, err } + + // If the selected server is a topology.SelectedServer, then we can get the description without creating a + // connect pool. + topologySelectedServer, ok := selectedServer.(*topology.SelectedServer) + if ok { + return topologySelectedServer.Description().Server, nil + } + selectedServerConnection, err := selectedServer.Connection(context.Background()) if err != nil { return description.Server{}, err diff --git a/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-directConnection.json b/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-directConnection.json index 3f500acdc6..8e459115c1 100644 --- a/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-directConnection.json +++ b/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-directConnection.json @@ -10,5 +10,6 @@ "loadBalanced": true, "ssl": true, "directConnection": false - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-directConnection.yml b/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-directConnection.yml index c8395f7786..7a77944a30 100644 --- a/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-directConnection.yml +++ b/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-directConnection.yml @@ -11,3 +11,4 @@ options: loadBalanced: true ssl: true directConnection: false +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-true-txt.json b/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-true-txt.json index f9719e760d..39bff5a23b 100644 --- a/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-true-txt.json +++ b/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-true-txt.json @@ -9,5 +9,6 @@ "options": { "loadBalanced": true, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-true-txt.yml b/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-true-txt.yml index a172bda52b..c373192f01 100644 --- a/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-true-txt.yml +++ b/testdata/initial-dns-seedlist-discovery/load-balanced/loadBalanced-true-txt.yml @@ -8,3 +8,4 @@ hosts: options: loadBalanced: true ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero-txt.json b/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero-txt.json index a18360ea64..474a314fd7 100644 --- a/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero-txt.json +++ b/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero-txt.json @@ -10,5 +10,6 @@ "loadBalanced": true, "srvMaxHosts": 0, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero-txt.yml b/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero-txt.yml index 986164e3b9..f223a8d558 100644 --- a/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero-txt.yml +++ b/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero-txt.yml @@ -8,3 +8,4 @@ options: loadBalanced: true srvMaxHosts: 0 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero.json b/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero.json index bd85418117..dfc90dc96d 100644 --- a/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero.json +++ b/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero.json @@ -10,5 +10,6 @@ "loadBalanced": true, "srvMaxHosts": 0, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero.yml b/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero.yml index 7dc1593484..f8343e0e3e 100644 --- a/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero.yml +++ b/testdata/initial-dns-seedlist-discovery/load-balanced/srvMaxHosts-zero.yml @@ -8,3 +8,4 @@ options: loadBalanced: true srvMaxHosts: 0 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/direct-connection-false.json b/testdata/initial-dns-seedlist-discovery/replica-set/direct-connection-false.json index 1d57bdcb3c..3f14ff94e7 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/direct-connection-false.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/direct-connection-false.json @@ -11,5 +11,6 @@ "options": { "ssl": true, "directConnection": false - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/direct-connection-false.yml b/testdata/initial-dns-seedlist-discovery/replica-set/direct-connection-false.yml index 20a32da594..21de8dc771 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/direct-connection-false.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/direct-connection-false.yml @@ -8,3 +8,4 @@ hosts: options: ssl: true directConnection: false +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/encoded-userinfo-and-db.json b/testdata/initial-dns-seedlist-discovery/replica-set/encoded-userinfo-and-db.json new file mode 100644 index 0000000000..4493628be9 --- /dev/null +++ b/testdata/initial-dns-seedlist-discovery/replica-set/encoded-userinfo-and-db.json @@ -0,0 +1,22 @@ +{ + "uri": "mongodb+srv://b*b%40f3tt%3D:%244to%40L8%3DMC@test3.test.build.10gen.cc/mydb%3F?replicaSet=repl0", + "seeds": [ + "localhost.test.build.10gen.cc:27017" + ], + "hosts": [ + "localhost:27017", + "localhost:27018", + "localhost:27019" + ], + "options": { + "replicaSet": "repl0", + "ssl": true + }, + "parsed_options": { + "user": "b*b@f3tt=", + "password": "$4to@L8=MC", + "db": "mydb?" + }, + "ping": false, + "comment": "Encoded user, pass, and DB parse correctly" +} diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/encoded-userinfo-and-db.yml b/testdata/initial-dns-seedlist-discovery/replica-set/encoded-userinfo-and-db.yml new file mode 100644 index 0000000000..4b25a46db5 --- /dev/null +++ b/testdata/initial-dns-seedlist-discovery/replica-set/encoded-userinfo-and-db.yml @@ -0,0 +1,19 @@ +uri: "mongodb+srv://b*b%40f3tt%3D:%244to%40L8%3DMC@test3.test.build.10gen.cc/mydb%3F?replicaSet=repl0" +seeds: + - localhost.test.build.10gen.cc:27017 +hosts: + - localhost:27017 + - localhost:27018 + - localhost:27019 +options: + replicaSet: repl0 + ssl: true +parsed_options: + user: "b*b@f3tt=" + password: "$4to@L8=MC" + db: "mydb?" +# Don't run a ping for URIs that include userinfo. Ping doesn't require authentication, so missing +# userinfo isn't a problem, but some drivers will fail handshake on a connection if userinfo is +# provided but incorrect. +ping: false +comment: Encoded user, pass, and DB parse correctly diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/loadBalanced-false-txt.json b/testdata/initial-dns-seedlist-discovery/replica-set/loadBalanced-false-txt.json index fd2e565c7b..682d32a742 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/loadBalanced-false-txt.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/loadBalanced-false-txt.json @@ -11,5 +11,6 @@ "options": { "loadBalanced": false, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/loadBalanced-false-txt.yml b/testdata/initial-dns-seedlist-discovery/replica-set/loadBalanced-false-txt.yml index 424d192072..c7e31da131 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/loadBalanced-false-txt.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/loadBalanced-false-txt.yml @@ -8,3 +8,4 @@ hosts: options: loadBalanced: false ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/longer-parent-in-return.json b/testdata/initial-dns-seedlist-discovery/replica-set/longer-parent-in-return.json index 9a8267eaeb..ebe3fe1e77 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/longer-parent-in-return.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/longer-parent-in-return.json @@ -12,5 +12,6 @@ "replicaSet": "repl0", "ssl": true }, + "ping": true, "comment": "Is correct, as returned host name shared the URI root \"test.build.10gen.cc\"." } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/longer-parent-in-return.yml b/testdata/initial-dns-seedlist-discovery/replica-set/longer-parent-in-return.yml index e77c4570d3..92b54ae57f 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/longer-parent-in-return.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/longer-parent-in-return.yml @@ -8,4 +8,5 @@ hosts: options: replicaSet: repl0 ssl: true +ping: true comment: Is correct, as returned host name shared the URI root "test.build.10gen.cc". diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/one-result-default-port.json b/testdata/initial-dns-seedlist-discovery/replica-set/one-result-default-port.json index cebb3b1ec3..9f7733de80 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/one-result-default-port.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/one-result-default-port.json @@ -11,5 +11,6 @@ "options": { "replicaSet": "repl0", "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/one-result-default-port.yml b/testdata/initial-dns-seedlist-discovery/replica-set/one-result-default-port.yml index 395bcdc968..748d4634ea 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/one-result-default-port.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/one-result-default-port.yml @@ -8,3 +8,4 @@ hosts: options: replicaSet: repl0 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record-multiple-strings.json b/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record-multiple-strings.json index 622668c351..1d740b1b59 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record-multiple-strings.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record-multiple-strings.json @@ -11,5 +11,6 @@ "options": { "replicaSet": "repl0", "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record-multiple-strings.yml b/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record-multiple-strings.yml index 90a702cdbe..2f353ffb74 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record-multiple-strings.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record-multiple-strings.yml @@ -8,3 +8,4 @@ hosts: options: replicaSet: repl0 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record.json b/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record.json index 2385021ad4..ecdb0a7e2a 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record.json @@ -12,5 +12,6 @@ "replicaSet": "repl0", "authSource": "thisDB", "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record.yml b/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record.yml index 9356eaa2c2..3bc0f0405c 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/one-txt-record.yml @@ -9,3 +9,4 @@ options: replicaSet: repl0 authSource: thisDB ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srv-service-name.json b/testdata/initial-dns-seedlist-discovery/replica-set/srv-service-name.json index ec36cdbb00..e320c2ca3e 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srv-service-name.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srv-service-name.json @@ -12,5 +12,6 @@ "options": { "ssl": true, "srvServiceName": "customname" - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srv-service-name.yml b/testdata/initial-dns-seedlist-discovery/replica-set/srv-service-name.yml index b6f25d0ca7..3bf9c2c676 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srv-service-name.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srv-service-name.yml @@ -9,3 +9,4 @@ hosts: options: ssl: true srvServiceName: "customname" +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-equal_to_srv_records.json b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-equal_to_srv_records.json index d9765ac663..70edacfd06 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-equal_to_srv_records.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-equal_to_srv_records.json @@ -13,5 +13,6 @@ "options": { "srvMaxHosts": 2, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-equal_to_srv_records.yml b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-equal_to_srv_records.yml index 6d905809b9..b483279614 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-equal_to_srv_records.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-equal_to_srv_records.yml @@ -14,3 +14,4 @@ hosts: options: srvMaxHosts: 2 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-greater_than_srv_records.json b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-greater_than_srv_records.json index 494bb87687..72540ed408 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-greater_than_srv_records.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-greater_than_srv_records.json @@ -12,5 +12,6 @@ "options": { "srvMaxHosts": 3, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-greater_than_srv_records.yml b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-greater_than_srv_records.yml index 03307f8110..363dd4fd8b 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-greater_than_srv_records.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-greater_than_srv_records.yml @@ -13,3 +13,4 @@ hosts: options: srvMaxHosts: 3 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-less_than_srv_records.json b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-less_than_srv_records.json index 66a5e90dad..a9d6dd6fd9 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-less_than_srv_records.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-less_than_srv_records.json @@ -9,5 +9,6 @@ "options": { "srvMaxHosts": 1, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-less_than_srv_records.yml b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-less_than_srv_records.yml index 4ff86a623f..1143ab375f 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-less_than_srv_records.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-less_than_srv_records.yml @@ -13,3 +13,4 @@ hosts: options: srvMaxHosts: 1 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero-txt.json b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero-txt.json index 241a901c64..e232edb9eb 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero-txt.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero-txt.json @@ -13,5 +13,6 @@ "replicaSet": "repl0", "srvMaxHosts": 0, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero-txt.yml b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero-txt.yml index 0df9fb49f4..81e92a09b1 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero-txt.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero-txt.yml @@ -13,3 +13,4 @@ options: replicaSet: repl0 srvMaxHosts: 0 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero.json b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero.json index c68610a201..3421a35a3d 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero.json @@ -13,5 +13,6 @@ "replicaSet": "repl0", "srvMaxHosts": 0, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero.yml b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero.yml index 3092889205..d095b6d677 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/srvMaxHosts-zero.yml @@ -13,3 +13,4 @@ options: replicaSet: repl0 srvMaxHosts: 0 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/two-results-default-port.json b/testdata/initial-dns-seedlist-discovery/replica-set/two-results-default-port.json index 66028310a6..43efcc6310 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/two-results-default-port.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/two-results-default-port.json @@ -12,5 +12,6 @@ "options": { "replicaSet": "repl0", "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/two-results-default-port.yml b/testdata/initial-dns-seedlist-discovery/replica-set/two-results-default-port.yml index 61d38b5e82..c3f7156dc7 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/two-results-default-port.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/two-results-default-port.yml @@ -9,3 +9,4 @@ hosts: options: replicaSet: repl0 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/two-results-nonstandard-port.json b/testdata/initial-dns-seedlist-discovery/replica-set/two-results-nonstandard-port.json index 4900f7cff1..f6e8e415a7 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/two-results-nonstandard-port.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/two-results-nonstandard-port.json @@ -12,5 +12,6 @@ "options": { "replicaSet": "repl0", "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/two-results-nonstandard-port.yml b/testdata/initial-dns-seedlist-discovery/replica-set/two-results-nonstandard-port.yml index 7185f52cd6..fe66308111 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/two-results-nonstandard-port.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/two-results-nonstandard-port.yml @@ -9,3 +9,4 @@ hosts: options: replicaSet: repl0 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-ssl-option.json b/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-ssl-option.json index 0ebc737bd5..3d84cfe446 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-ssl-option.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-ssl-option.json @@ -12,5 +12,6 @@ "replicaSet": "repl0", "authSource": "thisDB", "ssl": false - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-ssl-option.yml b/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-ssl-option.yml index 2a922aa234..8d1a46c396 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-ssl-option.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-ssl-option.yml @@ -9,3 +9,4 @@ options: replicaSet: repl0 authSource: thisDB ssl: false +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-uri-option.json b/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-uri-option.json index 2626ba6083..1a5a240680 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-uri-option.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-uri-option.json @@ -12,5 +12,6 @@ "replicaSet": "repl0", "authSource": "otherDB", "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-uri-option.yml b/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-uri-option.yml index a9015599e7..200ac6803e 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-uri-option.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/txt-record-with-overridden-uri-option.yml @@ -9,3 +9,4 @@ options: replicaSet: repl0 authSource: otherDB ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-admin-database.json b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-admin-database.json index 32710d75f7..c5513a0dad 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-admin-database.json +++ b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-admin-database.json @@ -15,5 +15,6 @@ }, "parsed_options": { "auth_database": "adminDB" - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-admin-database.yml b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-admin-database.yml index fb714bde0e..012e9a023e 100644 --- a/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-admin-database.yml +++ b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-admin-database.yml @@ -11,3 +11,4 @@ options: ssl: true parsed_options: auth_database: adminDB +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-auth.json b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-auth.json new file mode 100644 index 0000000000..872f997cc7 --- /dev/null +++ b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-auth.json @@ -0,0 +1,22 @@ +{ + "uri": "mongodb+srv://auser:apass@test1.test.build.10gen.cc/?replicaSet=repl0", + "seeds": [ + "localhost.test.build.10gen.cc:27017", + "localhost.test.build.10gen.cc:27018" + ], + "hosts": [ + "localhost:27017", + "localhost:27018", + "localhost:27019" + ], + "options": { + "replicaSet": "repl0", + "ssl": true + }, + "parsed_options": { + "user": "auser", + "password": "apass" + }, + "ping": false, + "comment": "Should preserve auth credentials" +} diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-auth.yml b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-auth.yml new file mode 100644 index 0000000000..95f9b96426 --- /dev/null +++ b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-auth.yml @@ -0,0 +1,19 @@ +uri: "mongodb+srv://auser:apass@test1.test.build.10gen.cc/?replicaSet=repl0" +seeds: + - localhost.test.build.10gen.cc:27017 + - localhost.test.build.10gen.cc:27018 +hosts: + - localhost:27017 + - localhost:27018 + - localhost:27019 +options: + replicaSet: repl0 + ssl: true +parsed_options: + user: auser + password: apass +# Don't run a ping for URIs that include userinfo. Ping doesn't require authentication, so missing +# userinfo isn't a problem, but some drivers will fail handshake on a connection if userinfo is +# provided but incorrect. +ping: false +comment: Should preserve auth credentials diff --git a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-equal_to_srv_records.json b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-equal_to_srv_records.json index 46390726f0..7d2f9a6bf8 100644 --- a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-equal_to_srv_records.json +++ b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-equal_to_srv_records.json @@ -12,5 +12,6 @@ "options": { "srvMaxHosts": 2, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-equal_to_srv_records.yml b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-equal_to_srv_records.yml index 89692308b6..84aeac9aec 100644 --- a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-equal_to_srv_records.yml +++ b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-equal_to_srv_records.yml @@ -11,3 +11,4 @@ hosts: options: srvMaxHosts: 2 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-greater_than_srv_records.json b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-greater_than_srv_records.json index e02d72bf28..452c7b54db 100644 --- a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-greater_than_srv_records.json +++ b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-greater_than_srv_records.json @@ -11,5 +11,6 @@ "options": { "srvMaxHosts": 3, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-greater_than_srv_records.yml b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-greater_than_srv_records.yml index 860dfacbb4..8195fd0d33 100644 --- a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-greater_than_srv_records.yml +++ b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-greater_than_srv_records.yml @@ -10,3 +10,4 @@ hosts: options: srvMaxHosts: 3 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-less_than_srv_records.json b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-less_than_srv_records.json index fdcc1692c0..cd3bf65117 100644 --- a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-less_than_srv_records.json +++ b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-less_than_srv_records.json @@ -5,5 +5,6 @@ "options": { "srvMaxHosts": 1, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-less_than_srv_records.yml b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-less_than_srv_records.yml index 31849524df..e33429b67a 100644 --- a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-less_than_srv_records.yml +++ b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-less_than_srv_records.yml @@ -8,3 +8,4 @@ numHosts: 1 options: srvMaxHosts: 1 ssl: true +ping: true diff --git a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-zero.json b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-zero.json index 10ab9e656d..f289628c9c 100644 --- a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-zero.json +++ b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-zero.json @@ -11,5 +11,6 @@ "options": { "srvMaxHosts": 0, "ssl": true - } + }, + "ping": true } diff --git a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-zero.yml b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-zero.yml index 9043409dfd..5692ed09b8 100644 --- a/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-zero.yml +++ b/testdata/initial-dns-seedlist-discovery/sharded/srvMaxHosts-zero.yml @@ -9,3 +9,4 @@ hosts: options: srvMaxHosts: 0 ssl: true +ping: true