Skip to content

Commit ff0c9fb

Browse files
authored
Sync URI options spec tests for CDRIVER-5767 and CDRIVER-5774 (#1780)
1 parent a914924 commit ff0c9fb

12 files changed

+329
-107
lines changed

src/libmongoc/tests/json/uri-options/auth-options.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"tests": [
33
{
44
"description": "Valid auth options are parsed correctly (GSSAPI)",
5-
"uri": "mongodb://foo:[email protected]/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authSource=$external",
5+
"uri": "mongodb://foo:[email protected]/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:forward,SERVICE_HOST:example.com&authSource=$external",
66
"valid": true,
77
"warning": false,
88
"hosts": null,
@@ -11,7 +11,8 @@
1111
"authMechanism": "GSSAPI",
1212
"authMechanismProperties": {
1313
"SERVICE_NAME": "other",
14-
"CANONICALIZE_HOST_NAME": true
14+
"SERVICE_HOST": "example.com",
15+
"CANONICALIZE_HOST_NAME": "forward"
1516
},
1617
"authSource": "$external"
1718
}

src/libmongoc/tests/json/uri-options/compression-options.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"warning": true,
3636
"hosts": null,
3737
"auth": null,
38-
"options": {}
38+
"options": null
3939
},
4040
{
4141
"description": "Too low zlibCompressionLevel causes a warning",
@@ -44,7 +44,7 @@
4444
"warning": true,
4545
"hosts": null,
4646
"auth": null,
47-
"options": {}
47+
"options": null
4848
},
4949
{
5050
"description": "Too high zlibCompressionLevel causes a warning",
@@ -53,7 +53,7 @@
5353
"warning": true,
5454
"hosts": null,
5555
"auth": null,
56-
"options": {}
56+
"options": null
5757
}
5858
]
5959
}

src/libmongoc/tests/json/uri-options/concern-options.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"warning": true,
4444
"hosts": null,
4545
"auth": null,
46-
"options": {}
46+
"options": null
4747
},
4848
{
4949
"description": "Too low wTimeoutMS causes a warning",
@@ -52,7 +52,7 @@
5252
"warning": true,
5353
"hosts": null,
5454
"auth": null,
55-
"options": {}
55+
"options": null
5656
},
5757
{
5858
"description": "Invalid journal causes a warning",
@@ -61,7 +61,7 @@
6161
"warning": true,
6262
"hosts": null,
6363
"auth": null,
64-
"options": {}
64+
"options": null
6565
}
6666
]
6767
}

src/libmongoc/tests/json/uri-options/connection-options.json

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"tests": [
33
{
44
"description": "Valid connection and timeout options are parsed correctly",
5-
"uri": "mongodb://example.com/?appname=URI-OPTIONS-SPEC-TEST&connectTimeoutMS=20000&heartbeatFrequencyMS=5000&localThresholdMS=3000&maxIdleTimeMS=50000&replicaSet=uri-options-spec&retryWrites=true&serverSelectionTimeoutMS=15000&socketTimeoutMS=7500",
5+
"uri": "mongodb://example.com/?appname=URI-OPTIONS-SPEC-TEST&connectTimeoutMS=20000&heartbeatFrequencyMS=5000&localThresholdMS=3000&maxIdleTimeMS=50000&replicaSet=uri-options-spec&retryWrites=true&serverSelectionTimeoutMS=15000&socketTimeoutMS=7500&timeoutMS=100",
66
"valid": true,
77
"warning": false,
88
"hosts": null,
@@ -16,7 +16,8 @@
1616
"replicaSet": "uri-options-spec",
1717
"retryWrites": true,
1818
"serverSelectionTimeoutMS": 15000,
19-
"socketTimeoutMS": 7500
19+
"socketTimeoutMS": 7500,
20+
"timeoutMS": 100
2021
}
2122
},
2223
{
@@ -26,7 +27,7 @@
2627
"warning": true,
2728
"hosts": null,
2829
"auth": null,
29-
"options": {}
30+
"options": null
3031
},
3132
{
3233
"description": "Too low connectTimeoutMS causes a warning",
@@ -35,7 +36,7 @@
3536
"warning": true,
3637
"hosts": null,
3738
"auth": null,
38-
"options": {}
39+
"options": null
3940
},
4041
{
4142
"description": "Non-numeric heartbeatFrequencyMS causes a warning",
@@ -44,7 +45,7 @@
4445
"warning": true,
4546
"hosts": null,
4647
"auth": null,
47-
"options": {}
48+
"options": null
4849
},
4950
{
5051
"description": "Too low heartbeatFrequencyMS causes a warning",
@@ -53,7 +54,7 @@
5354
"warning": true,
5455
"hosts": null,
5556
"auth": null,
56-
"options": {}
57+
"options": null
5758
},
5859
{
5960
"description": "Non-numeric localThresholdMS causes a warning",
@@ -62,7 +63,7 @@
6263
"warning": true,
6364
"hosts": null,
6465
"auth": null,
65-
"options": {}
66+
"options": null
6667
},
6768
{
6869
"description": "Too low localThresholdMS causes a warning",
@@ -71,7 +72,7 @@
7172
"warning": true,
7273
"hosts": null,
7374
"auth": null,
74-
"options": {}
75+
"options": null
7576
},
7677
{
7778
"description": "Invalid retryWrites causes a warning",
@@ -80,7 +81,7 @@
8081
"warning": true,
8182
"hosts": null,
8283
"auth": null,
83-
"options": {}
84+
"options": null
8485
},
8586
{
8687
"description": "Non-numeric serverSelectionTimeoutMS causes a warning",
@@ -89,7 +90,7 @@
8990
"warning": true,
9091
"hosts": null,
9192
"auth": null,
92-
"options": {}
93+
"options": null
9394
},
9495
{
9596
"description": "Too low serverSelectionTimeoutMS causes a warning",
@@ -98,7 +99,7 @@
9899
"warning": true,
99100
"hosts": null,
100101
"auth": null,
101-
"options": {}
102+
"options": null
102103
},
103104
{
104105
"description": "Non-numeric socketTimeoutMS causes a warning",
@@ -107,7 +108,7 @@
107108
"warning": true,
108109
"hosts": null,
109110
"auth": null,
110-
"options": {}
111+
"options": null
111112
},
112113
{
113114
"description": "Too low socketTimeoutMS causes a warning",
@@ -116,7 +117,7 @@
116117
"warning": true,
117118
"hosts": null,
118119
"auth": null,
119-
"options": {}
120+
"options": null
120121
},
121122
{
122123
"description": "directConnection=true",
@@ -136,7 +137,7 @@
136137
"warning": false,
137138
"hosts": null,
138139
"auth": null,
139-
"options": {}
140+
"options": null
140141
},
141142
{
142143
"description": "directConnection=false",
@@ -167,7 +168,7 @@
167168
"warning": true,
168169
"hosts": null,
169170
"auth": null,
170-
"options": {}
171+
"options": null
171172
},
172173
{
173174
"description": "loadBalanced=true",
@@ -210,7 +211,7 @@
210211
"warning": true,
211212
"hosts": null,
212213
"auth": null,
213-
"options": {}
214+
"options": null
214215
},
215216
{
216217
"description": "loadBalanced=true with multiple hosts causes an error",
@@ -219,7 +220,7 @@
219220
"warning": false,
220221
"hosts": null,
221222
"auth": null,
222-
"options": {}
223+
"options": null
223224
},
224225
{
225226
"description": "loadBalanced=true with directConnection=true causes an error",
@@ -228,7 +229,7 @@
228229
"warning": false,
229230
"hosts": null,
230231
"auth": null,
231-
"options": {}
232+
"options": null
232233
},
233234
{
234235
"description": "loadBalanced=true with replicaSet causes an error",
@@ -237,7 +238,36 @@
237238
"warning": false,
238239
"hosts": null,
239240
"auth": null,
240-
"options": {}
241+
"options": null
242+
},
243+
{
244+
"description": "timeoutMS=0",
245+
"uri": "mongodb://example.com/?timeoutMS=0",
246+
"valid": true,
247+
"warning": false,
248+
"hosts": null,
249+
"auth": null,
250+
"options": {
251+
"timeoutMS": 0
252+
}
253+
},
254+
{
255+
"description": "Non-numeric timeoutMS causes a warning",
256+
"uri": "mongodb://example.com/?timeoutMS=invalid",
257+
"valid": true,
258+
"warning": true,
259+
"hosts": null,
260+
"auth": null,
261+
"options": null
262+
},
263+
{
264+
"description": "Too low timeoutMS causes a warning",
265+
"uri": "mongodb://example.com/?timeoutMS=-2",
266+
"valid": true,
267+
"warning": true,
268+
"hosts": null,
269+
"auth": null,
270+
"options": null
241271
}
242272
]
243273
}

src/libmongoc/tests/json/uri-options/connection-pool-options.json

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
"tests": [
33
{
44
"description": "Valid connection pool options are parsed correctly",
5-
"uri": "mongodb://example.com/?maxIdleTimeMS=50000&maxPoolSize=5&minPoolSize=3",
5+
"uri": "mongodb://example.com/?maxIdleTimeMS=50000&maxPoolSize=5&minPoolSize=3&maxConnecting=1",
66
"valid": true,
77
"warning": false,
88
"hosts": null,
99
"auth": null,
1010
"options": {
1111
"maxIdleTimeMS": 50000,
1212
"maxPoolSize": 5,
13-
"minPoolSize": 3
13+
"minPoolSize": 3,
14+
"maxConnecting": 1
1415
}
1516
},
1617
{
@@ -20,7 +21,7 @@
2021
"warning": true,
2122
"hosts": null,
2223
"auth": null,
23-
"options": {}
24+
"options": null
2425
},
2526
{
2627
"description": "Too low maxIdleTimeMS causes a warning",
@@ -29,7 +30,7 @@
2930
"warning": true,
3031
"hosts": null,
3132
"auth": null,
32-
"options": {}
33+
"options": null
3334
},
3435
{
3536
"description": "maxPoolSize=0 does not error",
@@ -52,6 +53,24 @@
5253
"options": {
5354
"minPoolSize": 0
5455
}
56+
},
57+
{
58+
"description": "maxConnecting=0 causes a warning",
59+
"uri": "mongodb://example.com/?maxConnecting=0",
60+
"valid": true,
61+
"warning": true,
62+
"hosts": null,
63+
"auth": null,
64+
"options": null
65+
},
66+
{
67+
"description": "maxConnecting<0 causes a warning",
68+
"uri": "mongodb://example.com/?maxConnecting=-1",
69+
"valid": true,
70+
"warning": true,
71+
"hosts": null,
72+
"auth": null,
73+
"options": null
5574
}
5675
]
5776
}

0 commit comments

Comments
 (0)