@@ -15,15 +15,12 @@ import (
1515 "runtime"
1616 "strings"
1717 "testing"
18- "time"
1918
2019 "go.mongodb.org/mongo-driver/bson"
2120 "go.mongodb.org/mongo-driver/internal/testutil/assert"
22- "go.mongodb.org/mongo-driver/mongo"
2321 "go.mongodb.org/mongo-driver/mongo/description"
2422 "go.mongodb.org/mongo-driver/mongo/integration/mtest"
2523 "go.mongodb.org/mongo-driver/mongo/options"
26- "go.mongodb.org/mongo-driver/mongo/readpref"
2724 "go.mongodb.org/mongo-driver/x/mongo/driver/connstring"
2825 "go.mongodb.org/mongo-driver/x/mongo/driver/topology"
2926)
@@ -40,26 +37,19 @@ type seedlistTest struct {
4037 NumHosts * int `bson:"numHosts"`
4138 Error bool `bson:"error"`
4239 Options bson.Raw `bson:"options"`
43- Ping * bool `bson:"ping"`
4440}
4541
4642func TestInitialDNSSeedlistDiscoverySpec (t * testing.T ) {
4743 mt := mtest .New (t , noClientOpts )
4844 defer mt .Close ()
4945
5046 mt .RunOpts ("replica set" , mtest .NewOptions ().Topologies (mtest .ReplicaSet ).CreateClient (false ), func (mt * mtest.T ) {
51- mt .Parallel ()
52-
5347 runSeedlistDiscoveryDirectory (mt , "replica-set" )
5448 })
5549 mt .RunOpts ("sharded" , mtest .NewOptions ().Topologies (mtest .Sharded ).CreateClient (false ), func (mt * mtest.T ) {
56- mt .Parallel ()
57-
5850 runSeedlistDiscoveryDirectory (mt , "sharded" )
5951 })
6052 mt .RunOpts ("load balanced" , mtest .NewOptions ().Topologies (mtest .LoadBalanced ).CreateClient (false ), func (mt * mtest.T ) {
61- mt .Parallel ()
62-
6353 runSeedlistDiscoveryDirectory (mt , "load-balanced" )
6454 })
6555}
@@ -73,24 +63,6 @@ func runSeedlistDiscoveryDirectory(mt *mtest.T, subdirectory string) {
7363 }
7464}
7565
76- // runSeedlistDiscoveryPingTest will create a new connection using the test URI and attempt to "ping" the server.
77- func runSeedlistDiscoveryPingTest (mt * mtest.T , clientOpts * options.ClientOptions ) {
78- ctx := context .Background ()
79-
80- client , err := mongo .Connect (ctx , clientOpts )
81- assert .Nil (mt , err , "Connect error: %v" , err )
82-
83- defer func () { _ = client .Disconnect (ctx ) }()
84-
85- // Create a context with a timeout to prevent the ping operation from blocking indefinitely.
86- pingCtx , cancel := context .WithTimeout (ctx , 1 * time .Second )
87- defer cancel ()
88-
89- // Ping the server.
90- err = client .Ping (pingCtx , readpref .Nearest ())
91- assert .Nil (mt , err , "Ping error: %v" , err )
92- }
93-
9466func runSeedlistDiscoveryTest (mt * mtest.T , file string ) {
9567 content , err := ioutil .ReadFile (file )
9668 assert .Nil (mt , err , "ReadFile error for %v: %v" , file , err )
@@ -159,10 +131,6 @@ func runSeedlistDiscoveryTest(mt *mtest.T, file string) {
159131 _ , err := getServerByAddress (host , topo )
160132 assert .Nil (mt , err , "error finding host %q: %v" , host , err )
161133 }
162-
163- if ping := test .Ping ; ping == nil || * ping {
164- runSeedlistDiscoveryPingTest (mt , opts )
165- }
166134}
167135
168136func buildSet (list []string ) map [string ]struct {} {
@@ -262,14 +230,6 @@ func getServerByAddress(address string, topo *topology.Topology) (description.Se
262230 if err != nil {
263231 return description.Server {}, err
264232 }
265-
266- // If the selected server is a topology.SelectedServer, then we can get the description without creating a
267- // connect pool.
268- topologySelectedServer , ok := selectedServer .(* topology.SelectedServer )
269- if ok {
270- return topologySelectedServer .Description ().Server , nil
271- }
272-
273233 selectedServerConnection , err := selectedServer .Connection (context .Background ())
274234 if err != nil {
275235 return description.Server {}, err
0 commit comments