Skip to content

Commit

Permalink
add in prose test ref
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-khare-mongoDB committed Aug 20, 2024
1 parent 726d576 commit 81f43da
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ It is an error to specify more than one host name in a connection string with th
MUST raise a parse error and MUST NOT do DNS resolution or contact hosts.

Prior to DNS resolution. `{hostname}` format can follow any of the following formats:
* `{subdomain}`.`{second-level domain}`.`{top-level domain}` (ex: `{blogs.mongodb.com}`)
* `{second-level domain}`.`{top-level domain}` (ex: `{mongodb.localhost}`)
* `{top-level domain}` (ex: `{localhost}`)

For the purposes of this document, `{domainname}` refers to all parts of the hostname, excluding the `{subdomain}`.
- `{subdomain}`.`{second-level domain}`.`{top-level domain}` (ex: `{blogs.mongodb.com}`)
- `{second-level domain}`.`{top-level domain}` (ex: `{mongodb.localhost}`)
- `{top-level domain}` (ex: `{localhost}`)

For the purposes of this document, `{domainname}` refers to all parts of the hostname, excluding the `{subdomain}`.

Node:

Expand All @@ -97,10 +97,10 @@ API for each driver), but not through a TXT record (discussed in a later section

#### Querying DNS

In this preprocessing step, the driver will query the DNS server for SRV records on the hostname, prefixed
with the SRV service name and protocol. The SRV service name is provided in the `srvServiceName` URI option and defaults
to `mongodb`. The protocol is always `tcp`. After prefixing, the URI should look like:
`_{srvServiceName}._tcp.{hostname}`. This DNS query is expected to respond with one or more SRV records.
In this preprocessing step, the driver will query the DNS server for SRV records on the hostname, prefixed with the SRV
service name and protocol. The SRV service name is provided in the `srvServiceName` URI option and defaults to
`mongodb`. The protocol is always `tcp`. After prefixing, the URI should look like: `_{srvServiceName}._tcp.{hostname}`.
This DNS query is expected to respond with one or more SRV records.

The priority and weight fields in returned SRV records MUST be ignored.

Expand All @@ -124,12 +124,12 @@ randomization.

### Default Connection String Options

As a second preprocessing step, a Client MUST also query the DNS server for TXT records on `{hostname}`. If
available, a TXT record provides default connection string options. The maximum length of a TXT record string is 255
characters, but there can be multiple strings per TXT record. A Client MUST support multiple TXT record strings and
concatenate them as if they were one single string in the order they are defined in each TXT record. The order of
multiple character strings in each TXT record is guaranteed. A Client MUST NOT allow multiple TXT records for the same
host name and MUST raise an error when multiple TXT records are encountered.
As a second preprocessing step, a Client MUST also query the DNS server for TXT records on `{hostname}`. If available, a
TXT record provides default connection string options. The maximum length of a TXT record string is 255 characters, but
there can be multiple strings per TXT record. A Client MUST support multiple TXT record strings and concatenate them as
if they were one single string in the order they are defined in each TXT record. The order of multiple character strings
in each TXT record is guaranteed. A Client MUST NOT allow multiple TXT records for the same host name and MUST raise an
error when multiple TXT records are encountered.

Information returned within a TXT record is a simple URI string, just like the `{options}` in a connection string.

Expand All @@ -154,10 +154,10 @@ the Connection String spec.

### CNAME not supported

The use of DNS CNAME records is not supported. Clients MUST NOT check for a CNAME record on `{hostname}`. A
system's DNS resolver could transparently handle CNAME, but because of how clients validate records returned from SRV
queries, use of CNAME could break validation. Seedlist discovery therefore does not recommend or support the use of
CNAME records in concert with SRV or TXT records.
The use of DNS CNAME records is not supported. Clients MUST NOT check for a CNAME record on `{hostname}`. A system's DNS
resolver could transparently handle CNAME, but because of how clients validate records returned from SRV queries, use of
CNAME could break validation. Seedlist discovery therefore does not recommend or support the use of CNAME records in
concert with SRV or TXT records.

## Example

Expand Down Expand Up @@ -206,7 +206,12 @@ mongodb://mongodb1.mongodb.com:27317,mongodb2.mongodb.com:27107/?ssl=true&replic

## Test Plan

### Spec Tests
### Prose Tests

See README.md in the accompanying [test directory](tests).

### Spec Tests

See README.md in the accompanying [test directory](tests).

Additionally, see the `mongodb+srv` test `invalid-uris.yml` in the
Expand Down Expand Up @@ -261,7 +266,8 @@ In the future we could consider using the priority and weight fields of the SRV

## ChangeLog

- 2024-08-20: Removed requirement for URI to have three '.' separated parts. Replace usage of 'TLD' with 'top-level domain'. `{hostname}` now refers to the entire hostname, not just the `{subdomain}`.
- 2024-08-20: Removed requirement for URI to have three '.' separated parts. Replace usage of 'TLD' with 'top-level
domain'. `{hostname}` now refers to the entire hostname, not just the `{subdomain}`.

- 2024-03-06: Migrated from reStructuredText to Markdown.

Expand Down Expand Up @@ -314,4 +320,4 @@ In the future we could consider using the priority and weight fields of the SRV

- 2017-09-01: Updated test plan with YAML tests, and moved prose tests for URI\
parsing into invalid-uris.yml in the
Connection String Spec tests.
Connection String Spec tests.
5 changes: 3 additions & 2 deletions source/initial-dns-seedlist-discovery/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ This directory contains platform-independent tests that drivers can use to prove
Seedlist Discovery spec.

### Prose Tests

When given a valid SRV with

1. Only one domain level (ex: `{localhost}`)
2. Only two domain levels (ex: `{mongo.local}`)
Parse the connection string without throwing a parse related error.
2. Only two domain levels (ex: `{mongo.local}`) Parse the connection string without throwing a parse related error.

## Test Setup

Expand Down

0 comments on commit 81f43da

Please sign in to comment.