Skip to content

test(NODE-5643): sync connection string spec tests #3997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions test/spec/connection-string/invalid-uris.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,6 @@
"auth": null,
"options": null
},
{
"description": "Missing delimiting slash between hosts and options",
"uri": "mongodb://example.com?w=1",
"valid": false,
"warning": null,
"hosts": null,
"auth": null,
"options": null
},
{
"description": "Incomplete key value pair for option",
"uri": "mongodb://example.com/?w",
Expand Down
8 changes: 0 additions & 8 deletions test/spec/connection-string/invalid-uris.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,6 @@ tests:
hosts: ~
auth: ~
options: ~
-
description: "Missing delimiting slash between hosts and options"
uri: "mongodb://example.com?w=1"
valid: false
warning: ~
hosts: ~
auth: ~
options: ~
-
description: "Incomplete key value pair for option"
uri: "mongodb://example.com/?w"
Expand Down
17 changes: 17 additions & 0 deletions test/spec/connection-string/valid-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@
"options": {
"authmechanism": "MONGODB-CR"
}
},
{
"description": "Missing delimiting slash between hosts and options",
"uri": "mongodb://example.com?tls=true",
"valid": true,
"warning": false,
"hosts": [
{
"type": "hostname",
"host": "example.com",
"port": null
}
],
"auth": null,
"options": {
"tls": true
}
}
]
}
13 changes: 13 additions & 0 deletions test/spec/connection-string/valid-options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,16 @@ tests:
db: "admin"
options:
authmechanism: "MONGODB-CR"
-
description: "Missing delimiting slash between hosts and options"
uri: "mongodb://example.com?tls=true"
valid: true
warning: false
hosts:
-
type: "hostname"
host: "example.com"
port: ~
auth: ~
options:
tls: true
15 changes: 15 additions & 0 deletions test/spec/connection-string/valid-unix_socket-absolute.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
"auth": null,
"options": null
},
{
"description": "Unix domain socket (mixed case)",
"uri": "mongodb://%2Ftmp%2FMongoDB-27017.sock",
"valid": true,
"warning": false,
"hosts": [
{
"type": "unix",
"host": "/tmp/MongoDB-27017.sock",
"port": null
}
],
"auth": null,
"options": null
},
{
"description": "Unix domain socket (absolute path with spaces in path)",
"uri": "mongodb://%2Ftmp%2F %2Fmongodb-27017.sock",
Expand Down
12 changes: 12 additions & 0 deletions test/spec/connection-string/valid-unix_socket-absolute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ tests:
port: ~
auth: ~
options: ~
-
description: "Unix domain socket (mixed case)"
uri: "mongodb://%2Ftmp%2FMongoDB-27017.sock"
valid: true
warning: false
hosts:
-
type: "unix"
host: "/tmp/MongoDB-27017.sock"
port: ~
auth: ~
options: ~
-
description: "Unix domain socket (absolute path with spaces in path)"
uri: "mongodb://%2Ftmp%2F %2Fmongodb-27017.sock"
Expand Down
15 changes: 15 additions & 0 deletions test/spec/connection-string/valid-unix_socket-relative.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
"auth": null,
"options": null
},
{
"description": "Unix domain socket (mixed case)",
"uri": "mongodb://rel%2FMongoDB-27017.sock",
"valid": true,
"warning": false,
"hosts": [
{
"type": "unix",
"host": "rel/MongoDB-27017.sock",
"port": null
}
],
"auth": null,
"options": null
},
{
"description": "Unix domain socket (relative path with spaces)",
"uri": "mongodb://rel%2F %2Fmongodb-27017.sock",
Expand Down
12 changes: 12 additions & 0 deletions test/spec/connection-string/valid-unix_socket-relative.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ tests:
port: ~
auth: ~
options: ~
-
description: "Unix domain socket (mixed case)"
uri: "mongodb://rel%2FMongoDB-27017.sock"
valid: true
warning: false
hosts:
-
type: "unix"
host: "rel/MongoDB-27017.sock"
port: ~
auth: ~
options: ~
-
description: "Unix domain socket (relative path with spaces)"
uri: "mongodb://rel%2F %2Fmongodb-27017.sock"
Expand Down
30 changes: 30 additions & 0 deletions test/spec/connection-string/valid-warnings.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,36 @@
"options": {
"wtimeoutms": 10
}
},
{
"description": "Empty integer option values are ignored",
"uri": "mongodb://localhost/?maxIdleTimeMS=",
"valid": true,
"warning": true,
"hosts": [
{
"type": "hostname",
"host": "localhost",
"port": null
}
],
"auth": null,
"options": null
},
{
"description": "Empty boolean option value are ignored",
"uri": "mongodb://localhost/?journal=",
"valid": true,
"warning": true,
"hosts": [
{
"type": "hostname",
"host": "localhost",
"port": null
}
],
"auth": null,
"options": null
}
]
}
24 changes: 24 additions & 0 deletions test/spec/connection-string/valid-warnings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,27 @@ tests:
auth: ~
options:
wtimeoutms: 10
-
description: "Empty integer option values are ignored"
uri: "mongodb://localhost/?maxIdleTimeMS="
valid: true
warning: true
hosts:
-
type: "hostname"
host: "localhost"
port: ~
auth: ~
options: ~
-
description: "Empty boolean option value are ignored"
uri: "mongodb://localhost/?journal="
valid: true
warning: true
hosts:
-
type: "hostname"
host: "localhost"
port: ~
auth: ~
options: ~
3 changes: 0 additions & 3 deletions test/unit/connection_string.spec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { loadSpecTests } from '../spec';
import { executeUriValidationTest } from '../tools/uri_spec_runner';

const skipTests = [
// TODO(NODE-3919): fix to match expected behavior
'Missing delimiting slash between hosts and options',

// TODO(NODE-3914): Fix; note that wtimeoutms will be deprecated via DRIVERS-555 (NODE-3078)
'Deprecated (or unknown) options are ignored if replacement exists'
];
Expand Down