Skip to content

Commit 608f76e

Browse files
add test criteria
1 parent f27364c commit 608f76e

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed

source/connection-string/tests/valid-srv.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
tests:
2+
- description: SRV uri with one part
3+
uri: mongodb+srv://localhost
4+
valid: true
5+
warning: false
6+
hosts:
7+
- type: hostname
8+
host: localhost
9+
port: ~
10+
auth: ~
11+
options: ~
12+
- description: SRV uri with two parts
13+
uri: mongodb+srv://mongodb.local
14+
valid: true
15+
warning: false
16+
hosts:
17+
- type: hostname
18+
host: mongodb.local
19+
port: ~
20+
auth: ~
21+
options: ~

source/initial-dns-seedlist-discovery/initial-dns-seedlist-discovery.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ parse error and MUST NOT do DNS resolution or contact hosts.
8181
It is an error to specify more than one host name in a connection string with the `mongodb+srv` protocol, and the driver
8282
MUST raise a parse error and MUST NOT do DNS resolution or contact hosts.
8383

84-
A driver MUST verify that in addition to the `{hostname}`, the `{domainname}` consists of at least two parts: the domain
85-
name, and a TLD. In the case that an SRV or TXT record does not have three parts prior to DNS resolution, drivers MUST NOT throw an error.
84+
In the case that an hostname does not have a `{hostname}` and a `{domainname}` (consisting of a domain name and a TLD) prior to DNS resolution, drivers MUST NOT throw an error.
8685

8786
If `mongodb+srv` is used, a driver MUST implicitly also enable TLS. Clients can turn this off by passing `tls=false` in
8887
either the Connection String, or options passed in as parameters in code to the MongoClient constructor (or equivalent
@@ -204,6 +203,18 @@ See README.md in the accompanying [test directory](tests).
204203
Additionally, see the `mongodb+srv` test `invalid-uris.yml` in the
205204
[Connection String Spec tests](../connection-string/tests).
206205

206+
The test plan also contains the following prose tests:
207+
208+
1. The driver should not throw an error when given a SRV record that only contains the name of the domain and the TLD.
209+
a. Stub external DNS resolution to always pass (ex: dns.lookup).
210+
b. Assert that creating a client with the uri 'mongodb+srv//mongodb.localhost' does not cause an error.
211+
c. Assert that connecting the client from 2. to the server does not cause an error.
212+
213+
2. The driver should not throw an error when given a SRV record that only contains the TLD.
214+
a. Stub external DNS resolution to always pass (ex: dns.lookup).
215+
b. Assert that creating a client with the uri 'mongodb+srv//localhost' does not cause an error.
216+
c. Assert that connecting the client from 2. to the server does not cause an error.
217+
207218
## Motivation
208219

209220
Several of our users have asked for this through tickets:

0 commit comments

Comments
 (0)