-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRIVERS-2789 Convert URI Options Spec to Markdown
- Loading branch information
Showing
9 changed files
with
245 additions
and
641 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,43 @@ | ||
======================= | ||
URI Options Tests | ||
======================= | ||
# URI Options Tests | ||
|
||
The YAML and JSON files in this directory tree are platform-independent tests | ||
that drivers can use to prove their conformance to the URI Options spec. | ||
The YAML and JSON files in this directory tree are platform-independent tests that drivers can use to prove their | ||
conformance to the URI Options spec. | ||
|
||
These tests use the same format as the Connection String spec tests. | ||
|
||
Version | ||
------- | ||
## Version | ||
|
||
Files in the "specifications" repository have no version scheme. They are not | ||
tied to a MongoDB server version. | ||
Files in the "specifications" repository have no version scheme. They are not tied to a MongoDB server version. | ||
|
||
Format | ||
------ | ||
## Format | ||
|
||
Each YAML file contains an object with a single ``tests`` key. This key is an | ||
array of test case objects, each of which have the following keys: | ||
Each YAML file contains an object with a single `tests` key. This key is an array of test case objects, each of which | ||
have the following keys: | ||
|
||
- ``description``: A string describing the test. | ||
- ``uri``: A string containing the URI to be parsed. | ||
- ``valid``: A boolean indicating if the URI should be considered valid. | ||
- ``warning``: A boolean indicating whether URI parsing should emit a warning. | ||
- ``hosts``: Included for compatibility with the Connection String spec tests. This will always be ``~``. | ||
- ``auth``: Included for compatibility with the Connection String spec tests. This will always be ``~``. | ||
- ``options``: An object containing key/value pairs for each parsed query string | ||
option. | ||
- `description`: A string describing the test. | ||
- `uri`: A string containing the URI to be parsed. | ||
- `valid`: A boolean indicating if the URI should be considered valid. | ||
- `warning`: A boolean indicating whether URI parsing should emit a warning. | ||
- `hosts`: Included for compatibility with the Connection String spec tests. This will always be `~`. | ||
- `auth`: Included for compatibility with the Connection String spec tests. This will always be `~`. | ||
- `options`: An object containing key/value pairs for each parsed query string option. | ||
|
||
If a test case includes a null value for one of these keys (e.g. ``auth: ~``, | ||
``hosts: ~``), no assertion is necessary. This both simplifies parsing of the | ||
test files (keys should always exist) and allows flexibility for drivers that | ||
might substitute default values *during* parsing (e.g. omitted ``hosts`` could be | ||
parsed as ``["localhost"]``). | ||
If a test case includes a null value for one of these keys (e.g. `auth: ~`, `hosts: ~`), no assertion is necessary. This | ||
both simplifies parsing of the test files (keys should always exist) and allows flexibility for drivers that might | ||
substitute default values *during* parsing (e.g. omitted `hosts` could be parsed as `["localhost"]`). | ||
|
||
The ``valid`` and ``warning`` fields are boolean in order to keep the tests | ||
flexible. We are not concerned with asserting the format of specific error or | ||
warnings messages strings. | ||
The `valid` and `warning` fields are boolean in order to keep the tests flexible. We are not concerned with asserting | ||
the format of specific error or warnings messages strings. | ||
|
||
Under normal circumstances, it should not be necessary to specify both | ||
``valid: false`` and ``warning: true``. Typically, a URI test case will either | ||
yield an error (e.g. options conflict) or a warning (e.g. invalid type or value | ||
for an option), but not both. | ||
Under normal circumstances, it should not be necessary to specify both `valid: false` and `warning: true`. Typically, a | ||
URI test case will either yield an error (e.g. options conflict) or a warning (e.g. invalid type or value for an | ||
option), but not both. | ||
|
||
Use as unit tests | ||
================= | ||
### Use as unit tests | ||
|
||
Testing whether a URI is valid or not requires testing whether URI parsing (or | ||
MongoClient construction) causes a warning due to a URI option being invalid and asserting that the | ||
options parsed from the URI match those listed in the ``options`` field. | ||
Testing whether a URI is valid or not requires testing whether URI parsing (or MongoClient construction) causes a | ||
warning due to a URI option being invalid and asserting that the options parsed from the URI match those listed in the | ||
`options` field. | ||
|
||
Note that there are tests for each of the options marked as optional; drivers will need to implement | ||
logic to skip over the optional tests that they don’t implement. | ||
Note that there are tests for each of the options marked as optional; drivers will need to implement logic to skip over | ||
the optional tests that they don't implement. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.