Skip to content

Commit b6de209

Browse files
authored
test(NODE-5643): sync connection string spec tests (#3997)
1 parent e0a37e5 commit b6de209

11 files changed

+138
-20
lines changed

test/spec/connection-string/invalid-uris.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,6 @@
162162
"auth": null,
163163
"options": null
164164
},
165-
{
166-
"description": "Missing delimiting slash between hosts and options",
167-
"uri": "mongodb://example.com?w=1",
168-
"valid": false,
169-
"warning": null,
170-
"hosts": null,
171-
"auth": null,
172-
"options": null
173-
},
174165
{
175166
"description": "Incomplete key value pair for option",
176167
"uri": "mongodb://example.com/?w",

test/spec/connection-string/invalid-uris.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,6 @@ tests:
143143
hosts: ~
144144
auth: ~
145145
options: ~
146-
-
147-
description: "Missing delimiting slash between hosts and options"
148-
uri: "mongodb://example.com?w=1"
149-
valid: false
150-
warning: ~
151-
hosts: ~
152-
auth: ~
153-
options: ~
154146
-
155147
description: "Incomplete key value pair for option"
156148
uri: "mongodb://example.com/?w"

test/spec/connection-string/valid-options.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@
2020
"options": {
2121
"authmechanism": "MONGODB-CR"
2222
}
23+
},
24+
{
25+
"description": "Missing delimiting slash between hosts and options",
26+
"uri": "mongodb://example.com?tls=true",
27+
"valid": true,
28+
"warning": false,
29+
"hosts": [
30+
{
31+
"type": "hostname",
32+
"host": "example.com",
33+
"port": null
34+
}
35+
],
36+
"auth": null,
37+
"options": {
38+
"tls": true
39+
}
2340
}
2441
]
2542
}

test/spec/connection-string/valid-options.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,16 @@ tests:
1515
db: "admin"
1616
options:
1717
authmechanism: "MONGODB-CR"
18+
-
19+
description: "Missing delimiting slash between hosts and options"
20+
uri: "mongodb://example.com?tls=true"
21+
valid: true
22+
warning: false
23+
hosts:
24+
-
25+
type: "hostname"
26+
host: "example.com"
27+
port: ~
28+
auth: ~
29+
options:
30+
tls: true

test/spec/connection-string/valid-unix_socket-absolute.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@
3030
"auth": null,
3131
"options": null
3232
},
33+
{
34+
"description": "Unix domain socket (mixed case)",
35+
"uri": "mongodb://%2Ftmp%2FMongoDB-27017.sock",
36+
"valid": true,
37+
"warning": false,
38+
"hosts": [
39+
{
40+
"type": "unix",
41+
"host": "/tmp/MongoDB-27017.sock",
42+
"port": null
43+
}
44+
],
45+
"auth": null,
46+
"options": null
47+
},
3348
{
3449
"description": "Unix domain socket (absolute path with spaces in path)",
3550
"uri": "mongodb://%2Ftmp%2F %2Fmongodb-27017.sock",

test/spec/connection-string/valid-unix_socket-absolute.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ tests:
2323
port: ~
2424
auth: ~
2525
options: ~
26+
-
27+
description: "Unix domain socket (mixed case)"
28+
uri: "mongodb://%2Ftmp%2FMongoDB-27017.sock"
29+
valid: true
30+
warning: false
31+
hosts:
32+
-
33+
type: "unix"
34+
host: "/tmp/MongoDB-27017.sock"
35+
port: ~
36+
auth: ~
37+
options: ~
2638
-
2739
description: "Unix domain socket (absolute path with spaces in path)"
2840
uri: "mongodb://%2Ftmp%2F %2Fmongodb-27017.sock"

test/spec/connection-string/valid-unix_socket-relative.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@
3030
"auth": null,
3131
"options": null
3232
},
33+
{
34+
"description": "Unix domain socket (mixed case)",
35+
"uri": "mongodb://rel%2FMongoDB-27017.sock",
36+
"valid": true,
37+
"warning": false,
38+
"hosts": [
39+
{
40+
"type": "unix",
41+
"host": "rel/MongoDB-27017.sock",
42+
"port": null
43+
}
44+
],
45+
"auth": null,
46+
"options": null
47+
},
3348
{
3449
"description": "Unix domain socket (relative path with spaces)",
3550
"uri": "mongodb://rel%2F %2Fmongodb-27017.sock",

test/spec/connection-string/valid-unix_socket-relative.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ tests:
2323
port: ~
2424
auth: ~
2525
options: ~
26+
-
27+
description: "Unix domain socket (mixed case)"
28+
uri: "mongodb://rel%2FMongoDB-27017.sock"
29+
valid: true
30+
warning: false
31+
hosts:
32+
-
33+
type: "unix"
34+
host: "rel/MongoDB-27017.sock"
35+
port: ~
36+
auth: ~
37+
options: ~
2638
-
2739
description: "Unix domain socket (relative path with spaces)"
2840
uri: "mongodb://rel%2F %2Fmongodb-27017.sock"

test/spec/connection-string/valid-warnings.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,36 @@
6363
"options": {
6464
"wtimeoutms": 10
6565
}
66+
},
67+
{
68+
"description": "Empty integer option values are ignored",
69+
"uri": "mongodb://localhost/?maxIdleTimeMS=",
70+
"valid": true,
71+
"warning": true,
72+
"hosts": [
73+
{
74+
"type": "hostname",
75+
"host": "localhost",
76+
"port": null
77+
}
78+
],
79+
"auth": null,
80+
"options": null
81+
},
82+
{
83+
"description": "Empty boolean option value are ignored",
84+
"uri": "mongodb://localhost/?journal=",
85+
"valid": true,
86+
"warning": true,
87+
"hosts": [
88+
{
89+
"type": "hostname",
90+
"host": "localhost",
91+
"port": null
92+
}
93+
],
94+
"auth": null,
95+
"options": null
6696
}
6797
]
6898
}

test/spec/connection-string/valid-warnings.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,27 @@ tests:
4949
auth: ~
5050
options:
5151
wtimeoutms: 10
52+
-
53+
description: "Empty integer option values are ignored"
54+
uri: "mongodb://localhost/?maxIdleTimeMS="
55+
valid: true
56+
warning: true
57+
hosts:
58+
-
59+
type: "hostname"
60+
host: "localhost"
61+
port: ~
62+
auth: ~
63+
options: ~
64+
-
65+
description: "Empty boolean option value are ignored"
66+
uri: "mongodb://localhost/?journal="
67+
valid: true
68+
warning: true
69+
hosts:
70+
-
71+
type: "hostname"
72+
host: "localhost"
73+
port: ~
74+
auth: ~
75+
options: ~

test/unit/connection_string.spec.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { loadSpecTests } from '../spec';
44
import { executeUriValidationTest } from '../tools/uri_spec_runner';
55

66
const skipTests = [
7-
// TODO(NODE-3919): fix to match expected behavior
8-
'Missing delimiting slash between hosts and options',
9-
107
// TODO(NODE-3914): Fix; note that wtimeoutms will be deprecated via DRIVERS-555 (NODE-3078)
118
'Deprecated (or unknown) options are ignored if replacement exists'
129
];

0 commit comments

Comments
 (0)