Skip to content

Commit 60e31b0

Browse files
author
Thomas Reggi
authored
test: add tls spec tests skip unsupported
Adds spec tests from commit 85343c63dbde030a7e31df0ca63278cdf126b91e of "mongodb/specifications" and skips tests that have "tlsDisableOCSPEndpointCheck" or "tlsDisableCertificateRevocationCheck" in the connection string as there's are not supported by the Node.js driver. NODE-2528
1 parent af57b57 commit 60e31b0

File tree

6 files changed

+838
-17
lines changed

6 files changed

+838
-17
lines changed

test/functional/uri_options_spec.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
const qs = require('qs');
4+
const url = require('url');
35
const chai = require('chai');
46
const expect = chai.expect;
57
chai.use(require('chai-subset'));
@@ -18,6 +20,10 @@ describe('URI Options (spec)', function() {
1820
itFn(test.description, {
1921
metadata: { requires: { topology: 'single' } },
2022
test: function(done) {
23+
const query = qs.parse(url.parse(test.uri).query);
24+
if (query.hasOwnProperty('tlsDisableOCSPEndpointCheck')) return this.skip();
25+
if (query.hasOwnProperty('tlsDisableCertificateRevocationCheck')) return this.skip();
26+
2127
parse(test.uri, {}, (err, result) => {
2228
if (test.valid === true) {
2329
expect(err).to.not.exist;

test/spec/uri-options/README.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ array of test case objects, each of which have the following keys:
2121

2222
- ``description``: A string describing the test.
2323
- ``uri``: A string containing the URI to be parsed.
24-
- ``valid``: A boolean indicating if the URI should be considered valid.
25-
This will always be true, as the Connection String spec tests the validity of the structure, but
26-
it's still included to make it easier to reuse the connection string spec test runners that
27-
drivers already have.
24+
- ``valid``: A boolean indicating if the URI should be considered valid.
2825
- ``warning``: A boolean indicating whether URI parsing should emit a warning.
2926
- ``hosts``: Included for compatibility with the Connection String spec tests. This will always be ``~``.
3027
- ``auth``: Included for compatibility with the Connection String spec tests. This will always be ``~``.

test/spec/uri-options/auth-options.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"tests": [
33
{
4-
"description": "Valid auth options are parsed correctly",
4+
"description": "Valid auth options are parsed correctly (GSSAPI)",
55
"uri": "mongodb://foo:[email protected]/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authSource=$external",
66
"valid": true,
77
"warning": false,
@@ -15,6 +15,18 @@
1515
},
1616
"authSource": "$external"
1717
}
18+
},
19+
{
20+
"description": "Valid auth options are parsed correctly (SCRAM-SHA-1)",
21+
"uri": "mongodb://foo:[email protected]/?authMechanism=SCRAM-SHA-1&authSource=authSourceDB",
22+
"valid": true,
23+
"warning": false,
24+
"hosts": null,
25+
"auth": null,
26+
"options": {
27+
"authMechanism": "SCRAM-SHA-1",
28+
"authSource": "authSourceDB"
29+
}
1830
}
1931
]
2032
}

test/spec/uri-options/auth-options.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
tests:
22
-
3-
description: "Valid auth options are parsed correctly"
3+
description: "Valid auth options are parsed correctly (GSSAPI)"
44
uri: "mongodb://foo:[email protected]/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authSource=$external"
55
valid: true
66
warning: false
@@ -12,3 +12,13 @@ tests:
1212
SERVICE_NAME: "other"
1313
CANONICALIZE_HOST_NAME: true
1414
authSource: "$external"
15+
-
16+
description: "Valid auth options are parsed correctly (SCRAM-SHA-1)"
17+
uri: "mongodb://foo:[email protected]/?authMechanism=SCRAM-SHA-1&authSource=authSourceDB"
18+
valid: true
19+
warning: false
20+
hosts: ~
21+
auth: ~
22+
options:
23+
authMechanism: "SCRAM-SHA-1"
24+
authSource: "authSourceDB"

0 commit comments

Comments
 (0)