@@ -10,11 +10,21 @@ Test Setup
1010
1111The tests in the ``replica-set `` directory MUST be executed against a
1212three-node replica set on localhost ports 27017, 27018, and 27019 with
13- replica set name ``repl0 ``. The tests in ``load-balanced `` MUST be executed
14- against a load-balanced sharded cluster with the mongos servers running on
15- localhost ports 27017 and 27018 and load balancers, shard servers, and config
16- servers running on any open ports. In both cases, the clusters MUST be
17- started with SSL enabled.
13+ replica set name ``repl0 ``.
14+
15+ The tests in the ``load-balanced `` directory MUST be executed against a
16+ load-balanced sharded cluster with the mongos servers running on localhost ports
17+ 27017 and 27018 and ``--loadBalancerPort `` 27050 and 27051, respectively
18+ (corresponding to the script in `drivers-evergreen-tools `_). The load balancers,
19+ shard servers, and config servers may run on any open ports.
20+
21+ .. _`drivers-evergreen-tools` : https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-load-balancer.sh
22+
23+ The tests in the ``sharded `` directory MUST be executed against a sharded
24+ cluster with the mongos servers running on localhost ports 27017 and 27018.
25+ Shard servers and config servers may run on any open ports.
26+
27+ In all cases, the clusters MUST be started with SSL enabled.
1828
1929To run the tests that accompany this spec, you need to configure the SRV and
2030TXT records with a real name server. The following records are required for
@@ -24,29 +34,32 @@ these tests::
2434 localhost.test.build.10gen.cc. 86400 IN A 127.0.0.1
2535 localhost.sub.test.build.10gen.cc. 86400 IN A 127.0.0.1
2636
27- Record TTL Class Port Target
28- _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
29- _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc.
30- _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc.
31- _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27019 localhost.test.build.10gen.cc.
32- _mongodb._tcp.test3.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
33- _mongodb._tcp.test5.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
34- _mongodb._tcp.test6.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
35- _mongodb._tcp.test7.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
36- _mongodb._tcp.test8.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
37- _mongodb._tcp.test10.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
38- _mongodb._tcp.test11.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
39- _mongodb._tcp.test12.test.build.10gen.cc. 86400 IN SRV 27017 localhost.build.10gen.cc.
40- _mongodb._tcp.test13.test.build.10gen.cc. 86400 IN SRV 27017 test.build.10gen.cc.
41- _mongodb._tcp.test14.test.build.10gen.cc. 86400 IN SRV 27017 localhost.not-test.build.10gen.cc.
42- _mongodb._tcp.test15.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.not-build.10gen.cc.
43- _mongodb._tcp.test16.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.not-10gen.cc.
44- _mongodb._tcp.test17.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.not-cc.
45- _mongodb._tcp.test18.test.build.10gen.cc. 86400 IN SRV 27017 localhost.sub.test.build.10gen.cc.
46- _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.evil.build.10gen.cc.
47- _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
48- _mongodb._tcp.test20.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
49- _mongodb._tcp.test21.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
37+ Record TTL Class Port Target
38+ _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
39+ _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc.
40+ _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc.
41+ _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27019 localhost.test.build.10gen.cc.
42+ _mongodb._tcp.test3.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
43+ _mongodb._tcp.test5.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
44+ _mongodb._tcp.test6.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
45+ _mongodb._tcp.test7.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
46+ _mongodb._tcp.test8.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
47+ _mongodb._tcp.test10.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
48+ _mongodb._tcp.test11.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
49+ _mongodb._tcp.test12.test.build.10gen.cc. 86400 IN SRV 27017 localhost.build.10gen.cc.
50+ _mongodb._tcp.test13.test.build.10gen.cc. 86400 IN SRV 27017 test.build.10gen.cc.
51+ _mongodb._tcp.test14.test.build.10gen.cc. 86400 IN SRV 27017 localhost.not-test.build.10gen.cc.
52+ _mongodb._tcp.test15.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.not-build.10gen.cc.
53+ _mongodb._tcp.test16.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.not-10gen.cc.
54+ _mongodb._tcp.test17.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.not-cc.
55+ _mongodb._tcp.test18.test.build.10gen.cc. 86400 IN SRV 27017 localhost.sub.test.build.10gen.cc.
56+ _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.evil.build.10gen.cc.
57+ _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
58+ _mongodb._tcp.test20.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
59+ _mongodb._tcp.test21.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
60+ _customname._tcp.test22.test.build.10gen.cc 86400 IN SRV 27017 localhost.test.build.10gen.cc.
61+ _mongodb._tcp.test23.test.build.10gen.cc. 86400 IN SRV 8000 localhost.test.build.10gen.cc.
62+ _mongodb._tcp.test24.test.build.10gen.cc. 86400 IN SRV 8000 localhost.test.build.10gen.cc.
5063
5164 Record TTL Class Text
5265 test5.test.build.10gen.cc. 86400 IN TXT "replicaSet=repl0&authSource=thisDB"
@@ -58,11 +71,18 @@ these tests::
5871 test11.test.build.10gen.cc. 86400 IN TXT "replicaS" "et=rep" "l0"
5972 test20.test.build.10gen.cc. 86400 IN TXT "loadBalanced=true"
6073 test21.test.build.10gen.cc. 86400 IN TXT "loadBalanced=false"
74+ test24.test.build.10gen.cc. 86400 IN TXT "loadBalanced=true"
75+
76+ Notes:
6177
62- Note that ``test4 `` is omitted deliberately to test what happens with no SRV
63- record. ``test9 `` is missing because it was deleted during the development of
64- the tests. The missing ``test. `` sub-domain in the SRV record target for
65- ``test12 `` is deliberate.
78+ - ``test4 `` is omitted deliberately to test what happens with no SRV record.
79+ - ``test9 `` is missing because it was deleted during the development of the
80+ tests.
81+ - The missing ``test. `` sub-domain in the SRV record target for ``test12 `` is
82+ deliberate.
83+ - ``test22 `` is used to test a custom service name (``customname ``).
84+ - ``test23 `` and ``test24 `` point to port 8000 (HAProxy) and are used for
85+ load-balanced tests.
6686
6787In our tests we have used ``localhost.test.build.10gen.cc `` as the domain, and
6888then configured ``localhost.test.build.10gen.cc `` to resolve to 127.0.0.1.
@@ -76,28 +96,49 @@ Test Format and Use
7696
7797These YAML and JSON files contain the following fields:
7898
79- - ``uri ``: a mongodb+srv connection string
99+ - ``uri ``: a `` mongodb+srv `` connection string
80100- ``seeds ``: the expected set of initial seeds discovered from the SRV record
101+ - ``numSeeds ``: the expected number of initial seeds discovered from the SRV
102+ record. This is mainly used to test ``srvMaxHosts ``, since randomly selected
103+ hosts cannot be deterministically asserted.
81104- ``hosts ``: the discovered topology's list of hosts once SDAM completes a scan
82- - ``options ``: the parsed connection string options as discovered from URI and
83- TXT records
84- - ``parsed_options ``: additional options present in the `Connection String `_
85- URI such as ``Userinfo `` (as ``user `` and ``password ``), and ``Auth
86- database `` (as ``auth_database ``).
105+ - ``numHosts ``: the expected number of hosts discovered once SDAM completes a
106+ scan. This is mainly used to test ``srvMaxHosts ``, since randomly selected
107+ hosts cannot be deterministically asserted.
108+ - ``options ``: the parsed `URI options `_ as discovered from the
109+ `Connection String `_'s "Connection Options" component and SRV resolution
110+ (e.g. TXT records, implicit ``tls `` default).
111+ - ``parsed_options ``: additional, parsed options from other `Connection String `_
112+ components. This is mainly used for asserting ``UserInfo `` (as ``user `` and
113+ ``password ``) and ``Auth database `` (as ``auth_database ``).
87114- ``error ``: indicates that the parsing of the URI, or the resolving or
88115 contents of the SRV or TXT records included errors.
89116- ``comment ``: a comment to indicate why a test would fail.
90117
91118.. _`Connection String` : ../../connection-string/connection-string-spec.rst
119+ .. _`URI options` : ../../uri-options/uri-options.rst
120+
121+ For each file, create a MongoClient initialized with the ``mongodb+srv ``
122+ connection string.
123+
124+ If ``seeds `` is specified, drivers SHOULD verify that the set of hosts in the
125+ client's initial seedlist matches the list in ``seeds ``. If ``numSeeds `` is
126+ specified, drivers SHOULD verify that the size of that set matches ``numSeeds ``.
127+
128+ If ``hosts `` is specified, drivers MUST verify that the set of
129+ ServerDescriptions in the client's TopologyDescription eventually matches the
130+ list in ``hosts ``. If ``numHosts `` is specified, drivers MUST verify that the
131+ size of that set matches ``numHosts ``.
132+
133+ If ``options `` is specified, drivers MUST verify each of the values under
134+ ``options `` match the MongoClient's parsed value for that option. There may be
135+ other options parsed by the MongoClient as well, which a test does not verify.
136+
137+ If ``parsed_options `` is specified, drivers MUST verify that each of the values
138+ under ``parsed_options `` match the MongoClient's parsed value for that option.
139+ Supported values include, but are not limited to, ``user `` and ``password ``
140+ (parsed from ``UserInfo ``) and ``auth_database `` (parsed from
141+ ``Auth database ``).
92142
93- For each file, create MongoClient initialized with the mongodb+srv connection
94- string. You SHOULD verify that the client's initial seed list matches the list of
95- seeds. You MUST verify that the set of ServerDescriptions in the client's
96- TopologyDescription eventually matches the list of hosts. You MUST verify that
97- each of the values of the Connection String Options under ``options `` match the
98- Client's parsed value for that option. There may be other options parsed by
99- the Client as well, which a test does not verify. In ``uri-with-auth `` the URI
100- contains a user/password set and additional options are provided in
101- ``parsed_options `` so that tests can verify authentication is maintained when
102- evaluating URIs. You MUST verify that an error has been thrown if ``error `` is
103- present.
143+ If ``error `` is specified and ``true ``, drivers MUST verify that an error has
144+ been thrown.
0 commit comments