@@ -8,9 +8,22 @@ to prove their conformance to the Initial DNS Seedlist Discovery spec.
8
8
Test Setup
9
9
----------
10
10
11
- Start a three-node replica set on localhost, on ports 27017, 27018, and 27019,
12
- with replica set name "repl0". The replica set MUST be started with SSL
13
- enabled.
11
+ The tests in the ``replica-set `` directory MUST be executed against a
12
+ three-node replica set on localhost ports 27017, 27018, and 27019 with
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 (corresponding to the script in `drivers-evergreen-tools `_). The
18
+ load balancers, shard servers, and config servers may run on any open ports.
19
+
20
+ .. _`drivers-evergreen-tools` : ../../connection-string/connection-string-spec.rst
21
+
22
+ The tests in the ``sharded `` directory MUST be executed against a sharded
23
+ cluster with the mongos servers running on localhost ports 27017 and 27018.
24
+ Shard servers and config servers may run on any open ports.
25
+
26
+ In all cases, the clusters MUST be started with SSL enabled.
14
27
15
28
To run the tests that accompany this spec, you need to configure the SRV and
16
29
TXT records with a real name server. The following records are required for
@@ -20,27 +33,30 @@ these tests::
20
33
localhost.test.build.10gen.cc. 86400 IN A 127.0.0.1
21
34
localhost.sub.test.build.10gen.cc. 86400 IN A 127.0.0.1
22
35
23
- Record TTL Class Port Target
24
- _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
25
- _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc.
26
- _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc.
27
- _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27019 localhost.test.build.10gen.cc.
28
- _mongodb._tcp.test3.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
29
- _mongodb._tcp.test5.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
30
- _mongodb._tcp.test6.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
31
- _mongodb._tcp.test7.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
32
- _mongodb._tcp.test8.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
33
- _mongodb._tcp.test10.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
34
- _mongodb._tcp.test11.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
35
- _mongodb._tcp.test12.test.build.10gen.cc. 86400 IN SRV 27017 localhost.build.10gen.cc.
36
- _mongodb._tcp.test13.test.build.10gen.cc. 86400 IN SRV 27017 test.build.10gen.cc.
37
- _mongodb._tcp.test14.test.build.10gen.cc. 86400 IN SRV 27017 localhost.not-test.build.10gen.cc.
38
- _mongodb._tcp.test15.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.not-build.10gen.cc.
39
- _mongodb._tcp.test16.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.not-10gen.cc.
40
- _mongodb._tcp.test17.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.not-cc.
41
- _mongodb._tcp.test18.test.build.10gen.cc. 86400 IN SRV 27017 localhost.sub.test.build.10gen.cc.
42
- _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.evil.build.10gen.cc.
43
- _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
36
+ Record TTL Class Port Target
37
+ _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
38
+ _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc.
39
+ _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc.
40
+ _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27019 localhost.test.build.10gen.cc.
41
+ _mongodb._tcp.test3.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
42
+ _mongodb._tcp.test5.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
43
+ _mongodb._tcp.test6.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
44
+ _mongodb._tcp.test7.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
45
+ _mongodb._tcp.test8.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
46
+ _mongodb._tcp.test10.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
47
+ _mongodb._tcp.test11.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
48
+ _mongodb._tcp.test12.test.build.10gen.cc. 86400 IN SRV 27017 localhost.build.10gen.cc.
49
+ _mongodb._tcp.test13.test.build.10gen.cc. 86400 IN SRV 27017 test.build.10gen.cc.
50
+ _mongodb._tcp.test14.test.build.10gen.cc. 86400 IN SRV 27017 localhost.not-test.build.10gen.cc.
51
+ _mongodb._tcp.test15.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.not-build.10gen.cc.
52
+ _mongodb._tcp.test16.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.not-10gen.cc.
53
+ _mongodb._tcp.test17.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.not-cc.
54
+ _mongodb._tcp.test18.test.build.10gen.cc. 86400 IN SRV 27017 localhost.sub.test.build.10gen.cc.
55
+ _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.evil.build.10gen.cc.
56
+ _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
57
+ _mongodb._tcp.test20.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
58
+ _mongodb._tcp.test21.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc.
59
+ _customname._tcp.test22.test.build.10gen.cc 86400 IN SRV 27017 localhost.test.build.10gen.cc
44
60
45
61
Record TTL Class Text
46
62
test5.test.build.10gen.cc. 86400 IN TXT "replicaSet=repl0&authSource=thisDB"
@@ -50,11 +66,14 @@ these tests::
50
66
test8.test.build.10gen.cc. 86400 IN TXT "authSource"
51
67
test10.test.build.10gen.cc. 86400 IN TXT "socketTimeoutMS=500"
52
68
test11.test.build.10gen.cc. 86400 IN TXT "replicaS" "et=rep" "l0"
69
+ test20.test.build.10gen.cc. 86400 IN TXT "loadBalanced=true"
70
+ test21.test.build.10gen.cc. 86400 IN TXT "loadBalanced=false"
53
71
54
72
Note that ``test4 `` is omitted deliberately to test what happens with no SRV
55
73
record. ``test9 `` is missing because it was deleted during the development of
56
74
the tests. The missing ``test. `` sub-domain in the SRV record target for
57
- ``test12 `` is deliberate.
75
+ ``test12 `` is deliberate. ``test22 `` is used to test a custom service name
76
+ (``customname ``).
58
77
59
78
In our tests we have used ``localhost.test.build.10gen.cc `` as the domain, and
60
79
then configured ``localhost.test.build.10gen.cc `` to resolve to 127.0.0.1.
@@ -68,20 +87,49 @@ Test Format and Use
68
87
69
88
These YAML and JSON files contain the following fields:
70
89
71
- - ``uri ``: a mongodb+srv connection string
90
+ - ``uri ``: a `` mongodb+srv `` connection string
72
91
- ``seeds ``: the expected set of initial seeds discovered from the SRV record
92
+ - ``numSeeds ``: the expected number of initial seeds discovered from the SRV
93
+ record. This is mainly used to test ``srvMaxHosts ``, since randomly selected
94
+ hosts cannot be deterministically asserted.
73
95
- ``hosts ``: the discovered topology's list of hosts once SDAM completes a scan
74
- - ``options ``: the parsed connection string options as discovered from URI and
75
- TXT records
96
+ - ``numHosts ``: the expected number of hosts discovered once SDAM completes a
97
+ scan. This is mainly used to test ``srvMaxHosts ``, since randomly selected
98
+ hosts cannot be deterministically asserted.
99
+ - ``options ``: the parsed `URI options `_ as discovered from the
100
+ `Connection String `_'s "Connection Options" component and SRV resolution
101
+ (e.g. TXT records, implicit ``ssl `` default).
102
+ - ``parsed_options ``: additional, parsed options from other `Connection String `_
103
+ components. This is mainly used for asserting ``UserInfo `` (as ``user `` and
104
+ ``password ``) and ``Auth database `` (as ``auth_database ``).
76
105
- ``error ``: indicates that the parsing of the URI, or the resolving or
77
106
contents of the SRV or TXT records included errors.
78
107
- ``comment ``: a comment to indicate why a test would fail.
79
108
80
- For each file, create MongoClient initialized with the mongodb+srv connection
81
- string. You SHOULD verify that the client's initial seed list matches the list of
82
- seeds. You MUST verify that the set of ServerDescriptions in the client's
83
- TopologyDescription eventually matches the list of hosts. You MUST verify that
84
- each of the values of the Connection String Options under ``options `` match the
85
- Client's parsed value for that option. There may be other options parsed by
86
- the Client as well, which a test does not verify. You MUST verify that an
87
- error has been thrown if ``error `` is present.
109
+ .. _`Connection String` : ../../connection-string/connection-string-spec.rst
110
+ .. _`URI options` : ../../uri-options/uri-options.rst
111
+
112
+ For each file, create MongoClient initialized with the ``mongodb+srv ``
113
+ connection string.
114
+
115
+ If ``seeds `` is specified, drivers SHOULD verify that the set of hosts in the
116
+ client's initial seedlist matches the list in ``seeds ``. If ``numSeeds `` is
117
+ specified, drivers SHOULD verify that the size of that set matches ``numSeeds ``.
118
+
119
+ If ``hosts `` is specified, drivers MUST verify that the set of
120
+ ServerDescriptions in the client's TopologyDescription eventually matches the
121
+ list in ``hosts ``. If ``numHosts `` is specified, drivers MUST verify that the
122
+ size of that set matches ``numHosts ``.
123
+
124
+ If ``options `` is specified, drivers MUST verify each of the values under
125
+ ``options `` match the MongoClient's parsed value for that option. There may be
126
+ other options parsed by the Client as well, which a test does not verify.
127
+
128
+ If ``parsed_options `` is specified, drivers MUST verify that each of the values
129
+ under ``parsed_options `` match the MongoClient's parsed value for that option.
130
+ Support values include, but are not limited to, ``user `` and ``password ``
131
+ (parsed from ``UserInfo ``) and ``auth_database `` (parsed from
132
+ ``Auth database ``).
133
+
134
+ If ``error `` is specified and ``true ``, drivers MUST verify that an error has
135
+ been thrown.
0 commit comments