mongo 2.13.3 → 2.14.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mongo/address/ipv4.rb +1 -1
- data/lib/mongo/address/ipv6.rb +1 -1
- data/lib/mongo/address.rb +1 -1
- data/lib/mongo/bulk_write.rb +17 -0
- data/lib/mongo/caching_cursor.rb +74 -0
- data/lib/mongo/client.rb +47 -8
- data/lib/mongo/cluster/topology/single.rb +1 -1
- data/lib/mongo/cluster.rb +3 -3
- data/lib/mongo/collection/view/aggregation.rb +25 -4
- data/lib/mongo/collection/view/builder/find_command.rb +38 -18
- data/lib/mongo/collection/view/explainable.rb +27 -8
- data/lib/mongo/collection/view/iterable.rb +72 -12
- data/lib/mongo/collection/view/readable.rb +12 -2
- data/lib/mongo/collection/view/writable.rb +15 -1
- data/lib/mongo/collection/view.rb +24 -20
- data/lib/mongo/collection.rb +26 -2
- data/lib/mongo/crypt/encryption_io.rb +6 -6
- data/lib/mongo/cursor.rb +1 -0
- data/lib/mongo/database/view.rb +1 -1
- data/lib/mongo/database.rb +8 -14
- data/lib/mongo/error/invalid_read_concern.rb +28 -0
- data/lib/mongo/error/server_certificate_revoked.rb +22 -0
- data/lib/mongo/error/unsupported_option.rb +14 -12
- data/lib/mongo/error.rb +2 -0
- data/lib/mongo/grid/fs_bucket.rb +37 -37
- data/lib/mongo/lint.rb +2 -1
- data/lib/mongo/logger.rb +3 -3
- data/lib/mongo/operation/aggregate/result.rb +9 -8
- data/lib/mongo/operation/collections_info/command.rb +0 -5
- data/lib/mongo/operation/collections_info/result.rb +3 -16
- data/lib/mongo/operation/delete/bulk_result.rb +2 -0
- data/lib/mongo/operation/delete/result.rb +3 -0
- data/lib/mongo/operation/explain/command.rb +4 -0
- data/lib/mongo/operation/explain/legacy.rb +4 -0
- data/lib/mongo/operation/explain/op_msg.rb +6 -0
- data/lib/mongo/operation/explain/result.rb +3 -0
- data/lib/mongo/operation/find/legacy/result.rb +2 -0
- data/lib/mongo/operation/find/result.rb +3 -0
- data/lib/mongo/operation/get_more/result.rb +3 -0
- data/lib/mongo/operation/indexes/result.rb +5 -0
- data/lib/mongo/operation/insert/bulk_result.rb +5 -0
- data/lib/mongo/operation/insert/result.rb +5 -0
- data/lib/mongo/operation/list_collections/result.rb +5 -0
- data/lib/mongo/operation/map_reduce/result.rb +10 -0
- data/lib/mongo/operation/parallel_scan/command.rb +2 -1
- data/lib/mongo/operation/parallel_scan/result.rb +4 -0
- data/lib/mongo/operation/result.rb +35 -6
- data/lib/mongo/operation/shared/bypass_document_validation.rb +1 -0
- data/lib/mongo/operation/shared/causal_consistency_supported.rb +1 -0
- data/lib/mongo/operation/shared/collections_info_or_list_collections.rb +2 -0
- data/lib/mongo/operation/shared/executable.rb +1 -0
- data/lib/mongo/operation/shared/idable.rb +2 -1
- data/lib/mongo/operation/shared/limited.rb +1 -0
- data/lib/mongo/operation/shared/object_id_generator.rb +1 -0
- data/lib/mongo/operation/shared/read_preference_supported.rb +36 -38
- data/lib/mongo/operation/shared/result/aggregatable.rb +1 -0
- data/lib/mongo/operation/shared/sessions_supported.rb +3 -3
- data/lib/mongo/operation/shared/specifiable.rb +1 -0
- data/lib/mongo/operation/shared/write.rb +1 -0
- data/lib/mongo/operation/shared/write_concern_supported.rb +1 -0
- data/lib/mongo/operation/update/legacy/result.rb +7 -0
- data/lib/mongo/operation/update/result.rb +8 -0
- data/lib/mongo/operation/users_info/result.rb +3 -0
- data/lib/mongo/operation.rb +2 -0
- data/lib/mongo/protocol/msg.rb +2 -2
- data/lib/mongo/protocol/query.rb +11 -11
- data/lib/mongo/query_cache.rb +242 -0
- data/lib/mongo/retryable.rb +8 -1
- data/lib/mongo/server/connection_common.rb +2 -2
- data/lib/mongo/server/connection_pool.rb +3 -0
- data/lib/mongo/server/monitor/connection.rb +3 -3
- data/lib/mongo/server/monitor.rb +1 -1
- data/lib/mongo/server/pending_connection.rb +2 -2
- data/lib/mongo/server/push_monitor.rb +1 -1
- data/lib/mongo/server.rb +5 -1
- data/lib/mongo/server_selector/base.rb +5 -1
- data/lib/mongo/server_selector/secondary_preferred.rb +7 -2
- data/lib/mongo/session.rb +3 -0
- data/lib/mongo/socket/ocsp_cache.rb +97 -0
- data/lib/mongo/socket/ocsp_verifier.rb +368 -0
- data/lib/mongo/socket/ssl.rb +45 -24
- data/lib/mongo/socket.rb +6 -4
- data/lib/mongo/srv/monitor.rb +7 -13
- data/lib/mongo/srv/resolver.rb +14 -10
- data/lib/mongo/timeout.rb +2 -0
- data/lib/mongo/uri/options_mapper.rb +582 -0
- data/lib/mongo/uri/srv_protocol.rb +3 -2
- data/lib/mongo/uri.rb +21 -390
- data/lib/mongo/utils.rb +12 -1
- data/lib/mongo/version.rb +1 -1
- data/lib/mongo.rb +9 -0
- data/spec/NOTES.aws-auth.md +12 -7
- data/spec/README.md +56 -1
- data/spec/integration/bson_symbol_spec.rb +2 -4
- data/spec/integration/bulk_write_spec.rb +48 -0
- data/spec/integration/client_authentication_options_spec.rb +55 -28
- data/spec/integration/connection_pool_populator_spec.rb +3 -1
- data/spec/integration/cursor_reaping_spec.rb +53 -17
- data/spec/integration/ocsp_connectivity_spec.rb +26 -0
- data/spec/integration/ocsp_verifier_cache_spec.rb +188 -0
- data/spec/integration/ocsp_verifier_spec.rb +334 -0
- data/spec/integration/query_cache_spec.rb +1045 -0
- data/spec/integration/query_cache_transactions_spec.rb +179 -0
- data/spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb +1 -0
- data/spec/integration/retryable_writes/shared/performs_legacy_retries.rb +2 -0
- data/spec/integration/sdam_error_handling_spec.rb +69 -18
- data/spec/integration/sdam_events_spec.rb +7 -8
- data/spec/integration/server_selection_spec.rb +36 -0
- data/spec/integration/srv_monitoring_spec.rb +38 -3
- data/spec/integration/srv_spec.rb +56 -0
- data/spec/lite_spec_helper.rb +4 -2
- data/spec/mongo/address_spec.rb +1 -1
- data/spec/mongo/caching_cursor_spec.rb +70 -0
- data/spec/mongo/client_construction_spec.rb +54 -1
- data/spec/mongo/client_encryption_spec.rb +10 -16
- data/spec/mongo/client_spec.rb +40 -0
- data/spec/mongo/cluster/topology/single_spec.rb +14 -5
- data/spec/mongo/cluster_spec.rb +3 -0
- data/spec/mongo/collection/view/explainable_spec.rb +87 -4
- data/spec/mongo/collection/view/map_reduce_spec.rb +2 -0
- data/spec/mongo/collection_spec.rb +60 -0
- data/spec/mongo/crypt/auto_decryption_context_spec.rb +1 -1
- data/spec/mongo/crypt/auto_encryption_context_spec.rb +1 -1
- data/spec/mongo/crypt/data_key_context_spec.rb +1 -1
- data/spec/mongo/crypt/explicit_decryption_context_spec.rb +1 -1
- data/spec/mongo/crypt/explicit_encryption_context_spec.rb +1 -1
- data/spec/mongo/database_spec.rb +44 -64
- data/spec/mongo/error/no_server_available_spec.rb +1 -1
- data/spec/mongo/index/view_spec.rb +2 -4
- data/spec/mongo/logger_spec.rb +13 -11
- data/spec/mongo/operation/read_preference_legacy_spec.rb +19 -9
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +3 -3
- data/spec/mongo/query_cache_spec.rb +279 -0
- data/spec/mongo/server/app_metadata_shared.rb +7 -33
- data/spec/mongo/server/connection_pool_spec.rb +7 -3
- data/spec/mongo/server/connection_spec.rb +14 -7
- data/spec/mongo/server_selector/secondary_preferred_spec.rb +6 -6
- data/spec/mongo/socket/ssl_spec.rb +1 -1
- data/spec/mongo/socket_spec.rb +1 -1
- data/spec/mongo/uri/srv_protocol_spec.rb +64 -33
- data/spec/mongo/uri_option_parsing_spec.rb +11 -11
- data/spec/mongo/uri_spec.rb +68 -41
- data/spec/mongo/utils_spec.rb +39 -0
- data/spec/runners/auth.rb +3 -0
- data/spec/runners/connection_string.rb +35 -124
- data/spec/runners/transactions/operation.rb +2 -13
- data/spec/spec_tests/cmap_spec.rb +7 -3
- data/spec/spec_tests/data/change_streams/change-streams-errors.yml +0 -1
- data/spec/spec_tests/data/change_streams/change-streams.yml +0 -1
- data/spec/spec_tests/data/cmap/pool-checkout-connection.yml +6 -2
- data/spec/spec_tests/data/cmap/pool-create-min-size.yml +3 -0
- data/spec/spec_tests/data/connection_string/valid-warnings.yml +24 -0
- data/spec/spec_tests/data/sdam_monitoring/discovered_standalone.yml +1 -3
- data/spec/spec_tests/data/sdam_monitoring/standalone.yml +2 -2
- data/spec/spec_tests/data/sdam_monitoring/standalone_repeated.yml +2 -2
- data/spec/spec_tests/data/sdam_monitoring/standalone_suppress_equal_description_changes.yml +2 -2
- data/spec/spec_tests/data/sdam_monitoring/standalone_to_rs_with_me_mismatch.yml +2 -2
- data/spec/spec_tests/data/uri_options/auth-options.yml +25 -0
- data/spec/spec_tests/data/uri_options/compression-options.yml +6 -3
- data/spec/spec_tests/data/uri_options/read-preference-options.yml +24 -0
- data/spec/spec_tests/data/uri_options/ruby-connection-options.yml +1 -0
- data/spec/spec_tests/data/uri_options/tls-options.yml +160 -4
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +9 -1
- data/spec/spec_tests/uri_options_spec.rb +31 -33
- data/spec/support/certificates/atlas-ocsp-ca.crt +28 -0
- data/spec/support/certificates/atlas-ocsp.crt +41 -0
- data/spec/support/client_registry.rb +4 -8
- data/spec/support/client_registry_macros.rb +4 -4
- data/spec/support/common_shortcuts.rb +45 -0
- data/spec/support/constraints.rb +23 -0
- data/spec/support/lite_constraints.rb +24 -0
- data/spec/support/matchers.rb +16 -0
- data/spec/support/ocsp +1 -0
- data/spec/support/session_registry.rb +52 -0
- data/spec/support/spec_config.rb +22 -12
- data/spec/support/spec_setup.rb +38 -48
- data/spec/support/utils.rb +19 -1
- data.tar.gz.sig +1 -3
- metadata +938 -933
- metadata.gz.sig +0 -0
- data/spec/integration/secondary_reads_spec.rb +0 -102
- data/spec/shared/LICENSE +0 -20
- data/spec/shared/bin/get-mongodb-download-url +0 -17
- data/spec/shared/lib/mrss/child_process_helper.rb +0 -80
- data/spec/shared/lib/mrss/cluster_config.rb +0 -221
- data/spec/shared/lib/mrss/constraints.rb +0 -346
- data/spec/shared/lib/mrss/docker_runner.rb +0 -265
- data/spec/shared/lib/mrss/lite_constraints.rb +0 -191
- data/spec/shared/lib/mrss/server_version_registry.rb +0 -115
- data/spec/shared/lib/mrss/spec_organizer.rb +0 -152
- data/spec/shared/lib/mrss/utils.rb +0 -15
- data/spec/shared/share/Dockerfile.erb +0 -231
- data/spec/shared/shlib/distro.sh +0 -73
- data/spec/shared/shlib/server.sh +0 -290
- data/spec/shared/shlib/set_env.sh +0 -128
@@ -12,6 +12,31 @@ tests:
|
|
12
12
|
SERVICE_NAME: "other"
|
13
13
|
CANONICALIZE_HOST_NAME: true
|
14
14
|
authSource: "$external"
|
15
|
+
-
|
16
|
+
description: "Mixed case in auth mechanism properties is preserved"
|
17
|
+
uri: "mongodb://foo:bar@example.com/?authMechanism=GSSAPI&authMechanismProperties=PropertyName:PropertyValue&authSource=$external"
|
18
|
+
valid: true
|
19
|
+
warning: false
|
20
|
+
hosts: ~
|
21
|
+
auth: ~
|
22
|
+
options:
|
23
|
+
authMechanism: "GSSAPI"
|
24
|
+
authMechanismProperties:
|
25
|
+
PropertyName: PropertyValue
|
26
|
+
service_name: mongodb
|
27
|
+
authSource: "$external"
|
28
|
+
-
|
29
|
+
description: "Auth mechanism properties are all invalid"
|
30
|
+
uri: "mongodb://foo:bar@example.com/?authMechanism=GSSAPI&authMechanismProperties=PropertyName&authSource=$external"
|
31
|
+
valid: true
|
32
|
+
warning: true
|
33
|
+
hosts: ~
|
34
|
+
auth: ~
|
35
|
+
options:
|
36
|
+
authMechanism: "GSSAPI"
|
37
|
+
authMechanismProperties:
|
38
|
+
service_name: mongodb
|
39
|
+
authSource: "$external"
|
15
40
|
-
|
16
41
|
description: "Valid auth options are parsed correctly (SCRAM-SHA-1)"
|
17
42
|
uri: "mongodb://foo:bar@example.com/?authMechanism=SCRAM-SHA-1&authSource=authSourceDB"
|
@@ -28,7 +28,8 @@ tests:
|
|
28
28
|
warning: true
|
29
29
|
hosts: ~
|
30
30
|
auth: ~
|
31
|
-
|
31
|
+
# https://jira.mongodb.org/browse/DRIVERS-1368
|
32
|
+
options: ~
|
32
33
|
-
|
33
34
|
description: "Too low zlibCompressionLevel causes a warning"
|
34
35
|
uri: "mongodb://example.com/?compressors=zlib&zlibCompressionLevel=-2"
|
@@ -36,7 +37,8 @@ tests:
|
|
36
37
|
warning: true
|
37
38
|
hosts: ~
|
38
39
|
auth: ~
|
39
|
-
|
40
|
+
# https://jira.mongodb.org/browse/DRIVERS-1368
|
41
|
+
options: ~
|
40
42
|
-
|
41
43
|
description: "Too high zlibCompressionLevel causes a warning"
|
42
44
|
uri: "mongodb://example.com/?compressors=zlib&zlibCompressionLevel=10"
|
@@ -44,5 +46,6 @@ tests:
|
|
44
46
|
warning: true
|
45
47
|
hosts: ~
|
46
48
|
auth: ~
|
47
|
-
|
49
|
+
# https://jira.mongodb.org/browse/DRIVERS-1368
|
50
|
+
options: ~
|
48
51
|
|
@@ -15,6 +15,18 @@ tests:
|
|
15
15
|
-
|
16
16
|
dc: "ny"
|
17
17
|
maxStalenessSeconds: 120
|
18
|
+
-
|
19
|
+
description: "Case is preserved in read preference tag names and values"
|
20
|
+
uri: "mongodb://example.com/?readPreference=secondary&readPreferenceTags=DataCenter:NewYork"
|
21
|
+
valid: true
|
22
|
+
warning: false
|
23
|
+
hosts: ~
|
24
|
+
auth: ~
|
25
|
+
options:
|
26
|
+
readPreference: "secondary"
|
27
|
+
readPreferenceTags:
|
28
|
+
-
|
29
|
+
DataCenter: NewYork
|
18
30
|
-
|
19
31
|
description: "Invalid readPreferenceTags causes a warning"
|
20
32
|
uri: "mongodb://example.com/?readPreferenceTags=invalid"
|
@@ -23,6 +35,18 @@ tests:
|
|
23
35
|
hosts: ~
|
24
36
|
auth: ~
|
25
37
|
options: {}
|
38
|
+
# https://jira.mongodb.org/browse/DRIVERS-1369
|
39
|
+
-
|
40
|
+
description: "Valid and invalid readPreferenceTags mix"
|
41
|
+
uri: "mongodb://example.com/?readPreferenceTags=a:b,invalid"
|
42
|
+
valid: true
|
43
|
+
warning: true
|
44
|
+
hosts: ~
|
45
|
+
auth: ~
|
46
|
+
options:
|
47
|
+
readPreferenceTags:
|
48
|
+
-
|
49
|
+
a: b
|
26
50
|
-
|
27
51
|
description: "Non-numeric maxStalenessSeconds causes a warning"
|
28
52
|
uri: "mongodb://example.com/?maxStalenessSeconds=invalid"
|
@@ -149,7 +149,8 @@ tests:
|
|
149
149
|
warning: false
|
150
150
|
hosts: ~
|
151
151
|
auth: ~
|
152
|
-
|
152
|
+
# https://jira.mongodb.org/browse/DRIVERS-1368
|
153
|
+
options: ~
|
153
154
|
-
|
154
155
|
description: "tls=false and ssl=false doesn't warn"
|
155
156
|
uri: "mongodb://example.com/?tls=false&ssl=false"
|
@@ -157,7 +158,8 @@ tests:
|
|
157
158
|
warning: false
|
158
159
|
hosts: ~
|
159
160
|
auth: ~
|
160
|
-
|
161
|
+
# https://jira.mongodb.org/browse/DRIVERS-1368
|
162
|
+
options: ~
|
161
163
|
-
|
162
164
|
description: "ssl=true and tls=true doesn't warn"
|
163
165
|
uri: "mongodb://example.com/?ssl=true&tls=true"
|
@@ -165,7 +167,8 @@ tests:
|
|
165
167
|
warning: false
|
166
168
|
hosts: ~
|
167
169
|
auth: ~
|
168
|
-
|
170
|
+
# https://jira.mongodb.org/browse/DRIVERS-1368
|
171
|
+
options: ~
|
169
172
|
-
|
170
173
|
description: "ssl=false and tls=false doesn't warn"
|
171
174
|
uri: "mongodb://example.com/?ssl=false&tls=false"
|
@@ -173,7 +176,8 @@ tests:
|
|
173
176
|
warning: false
|
174
177
|
hosts: ~
|
175
178
|
auth: ~
|
176
|
-
|
179
|
+
# https://jira.mongodb.org/browse/DRIVERS-1368
|
180
|
+
options: ~
|
177
181
|
-
|
178
182
|
description: "tls=false and ssl=true raises error"
|
179
183
|
uri: "mongodb://example.com/?tls=false&ssl=true"
|
@@ -206,3 +210,155 @@ tests:
|
|
206
210
|
hosts: ~
|
207
211
|
auth: ~
|
208
212
|
options: {}
|
213
|
+
-
|
214
|
+
description: "tlsDisableOCSPEndpointCheck can be set to true"
|
215
|
+
uri: "mongodb://example.com/?tls=true&tlsDisableOCSPEndpointCheck=true"
|
216
|
+
valid: true
|
217
|
+
warning: false
|
218
|
+
hosts: ~
|
219
|
+
auth: ~
|
220
|
+
options:
|
221
|
+
tls: true
|
222
|
+
tlsDisableOCSPEndpointCheck: true
|
223
|
+
-
|
224
|
+
description: "tlsDisableOCSPEndpointCheck can be set to false"
|
225
|
+
uri: "mongodb://example.com/?tls=true&tlsDisableOCSPEndpointCheck=false"
|
226
|
+
valid: true
|
227
|
+
warning: false
|
228
|
+
hosts: ~
|
229
|
+
auth: ~
|
230
|
+
options:
|
231
|
+
tls: true
|
232
|
+
tlsDisableOCSPEndpointCheck: false
|
233
|
+
# 4 permutations of [tlsInsecure=true/false, tlsDisableOCSPEndpointCheck=true/false]
|
234
|
+
-
|
235
|
+
description: "tlsInsecure and tlsDisableOCSPEndpointCheck both present (and true) raises an error"
|
236
|
+
uri: "mongodb://example.com/?tlsInsecure=true&tlsDisableOCSPEndpointCheck=true"
|
237
|
+
valid: false
|
238
|
+
warning: false
|
239
|
+
hosts: ~
|
240
|
+
auth: ~
|
241
|
+
options: {}
|
242
|
+
-
|
243
|
+
description: "tlsInsecure=true and tlsDisableOCSPEndpointCheck=false raises an error"
|
244
|
+
uri: "mongodb://example.com/?tlsInsecure=true&tlsDisableOCSPEndpointCheck=false"
|
245
|
+
valid: false
|
246
|
+
warning: false
|
247
|
+
hosts: ~
|
248
|
+
auth: ~
|
249
|
+
options: {}
|
250
|
+
-
|
251
|
+
description: "tlsInsecure=false and tlsDisableOCSPEndpointCheck=true raises an error"
|
252
|
+
uri: "mongodb://example.com/?tlsInsecure=false&tlsDisableOCSPEndpointCheck=true"
|
253
|
+
valid: false
|
254
|
+
warning: false
|
255
|
+
hosts: ~
|
256
|
+
auth: ~
|
257
|
+
options: {}
|
258
|
+
-
|
259
|
+
description: "tlsInsecure and tlsDisableOCSPEndpointCheck both present (and false) raises an error"
|
260
|
+
uri: "mongodb://example.com/?tlsInsecure=false&tlsDisableOCSPEndpointCheck=false"
|
261
|
+
valid: false
|
262
|
+
warning: false
|
263
|
+
hosts: ~
|
264
|
+
auth: ~
|
265
|
+
options: {}
|
266
|
+
# 4 permutations of [tlsDisableOCSPEndpointCheck=true/false, tlsInsecure=true/false]
|
267
|
+
-
|
268
|
+
description: "tlsDisableOCSPEndpointCheck and tlsInsecure both present (and true) raises an error"
|
269
|
+
uri: "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsInsecure=true"
|
270
|
+
valid: false
|
271
|
+
warning: false
|
272
|
+
hosts: ~
|
273
|
+
auth: ~
|
274
|
+
options: {}
|
275
|
+
-
|
276
|
+
description: "tlsDisableOCSPEndpointCheck=true and tlsInsecure=false raises an error"
|
277
|
+
uri: "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsInsecure=false"
|
278
|
+
valid: false
|
279
|
+
warning: false
|
280
|
+
hosts: ~
|
281
|
+
auth: ~
|
282
|
+
options: {}
|
283
|
+
-
|
284
|
+
description: "tlsDisableOCSPEndpointCheck=false and tlsInsecure=true raises an error"
|
285
|
+
uri: "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsInsecure=true"
|
286
|
+
valid: false
|
287
|
+
warning: false
|
288
|
+
hosts: ~
|
289
|
+
auth: ~
|
290
|
+
options: {}
|
291
|
+
-
|
292
|
+
description: "tlsDisableOCSPEndpointCheck and tlsInsecure both present (and false) raises an error"
|
293
|
+
uri: "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsInsecure=false"
|
294
|
+
valid: false
|
295
|
+
warning: false
|
296
|
+
hosts: ~
|
297
|
+
auth: ~
|
298
|
+
options: {}
|
299
|
+
# 4 permutations of [tlsAllowInvalidCertificates=true/false, tlsDisableOCSPEndpointCheck=true/false]
|
300
|
+
-
|
301
|
+
description: "tlsAllowInvalidCertificates and tlsDisableOCSPEndpointCheck both present (and true) raises an error"
|
302
|
+
uri: "mongodb://example.com/?tlsAllowInvalidCertificates=true&tlsDisableOCSPEndpointCheck=true"
|
303
|
+
valid: false
|
304
|
+
warning: false
|
305
|
+
hosts: ~
|
306
|
+
auth: ~
|
307
|
+
options: {}
|
308
|
+
-
|
309
|
+
description: "tlsAllowInvalidCertificates=true and tlsDisableOCSPEndpointCheck=false raises an error"
|
310
|
+
uri: "mongodb://example.com/?tlsAllowInvalidCertificates=true&tlsDisableOCSPEndpointCheck=false"
|
311
|
+
valid: false
|
312
|
+
warning: false
|
313
|
+
hosts: ~
|
314
|
+
auth: ~
|
315
|
+
options: {}
|
316
|
+
-
|
317
|
+
description: "tlsAllowInvalidCertificates=false and tlsDisableOCSPEndpointCheck=true raises an error"
|
318
|
+
uri: "mongodb://example.com/?tlsAllowInvalidCertificates=false&tlsDisableOCSPEndpointCheck=true"
|
319
|
+
valid: false
|
320
|
+
warning: false
|
321
|
+
hosts: ~
|
322
|
+
auth: ~
|
323
|
+
options: {}
|
324
|
+
-
|
325
|
+
description: "tlsAllowInvalidCertificates and tlsDisableOCSPEndpointCheck both present (and false) raises an error"
|
326
|
+
uri: "mongodb://example.com/?tlsAllowInvalidCertificates=false&tlsDisableOCSPEndpointCheck=false"
|
327
|
+
valid: false
|
328
|
+
warning: false
|
329
|
+
hosts: ~
|
330
|
+
auth: ~
|
331
|
+
options: {}
|
332
|
+
# 4 permutations of [tlsDisableOCSPEndpointCheck=true/false, tlsAllowInvalidCertificates=true/false]
|
333
|
+
-
|
334
|
+
description: "tlsDisableOCSPEndpointCheck and tlsAllowInvalidCertificates both present (and true) raises an error"
|
335
|
+
uri: "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsAllowInvalidCertificates=true"
|
336
|
+
valid: false
|
337
|
+
warning: false
|
338
|
+
hosts: ~
|
339
|
+
auth: ~
|
340
|
+
options: {}
|
341
|
+
-
|
342
|
+
description: "tlsDisableOCSPEndpointCheck=true and tlsAllowInvalidCertificates=false raises an error"
|
343
|
+
uri: "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsAllowInvalidCertificates=false"
|
344
|
+
valid: false
|
345
|
+
warning: false
|
346
|
+
hosts: ~
|
347
|
+
auth: ~
|
348
|
+
options: {}
|
349
|
+
-
|
350
|
+
description: "tlsDisableOCSPEndpointCheck=false and tlsAllowInvalidCertificates=true raises an error"
|
351
|
+
uri: "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsAllowInvalidCertificates=true"
|
352
|
+
valid: false
|
353
|
+
warning: false
|
354
|
+
hosts: ~
|
355
|
+
auth: ~
|
356
|
+
options: {}
|
357
|
+
-
|
358
|
+
description: "tlsDisableOCSPEndpointCheck and tlsAllowInvalidCertificates both present (and false) raises an error"
|
359
|
+
uri: "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsAllowInvalidCertificates=false"
|
360
|
+
valid: false
|
361
|
+
warning: false
|
362
|
+
hosts: ~
|
363
|
+
auth: ~
|
364
|
+
options: {}
|
@@ -60,7 +60,15 @@ describe 'DNS Seedlist Discovery' do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'creates a client with the correct options' do
|
63
|
-
|
63
|
+
mapped = Mongo::URI::OptionsMapper.new.ruby_to_smc(test.client.options)
|
64
|
+
# Connection string spec tests do not use canonical URI option names
|
65
|
+
actual = Utils.downcase_keys(mapped)
|
66
|
+
expected = Utils.downcase_keys(test.options)
|
67
|
+
# SRV tests use ssl URI option instead of tls one
|
68
|
+
if expected.key?('ssl') && !expected.key?('tls')
|
69
|
+
expected['tls'] = expected.delete('ssl')
|
70
|
+
end
|
71
|
+
actual.should == expected
|
64
72
|
end
|
65
73
|
end
|
66
74
|
end
|
@@ -2,7 +2,7 @@ require 'lite_spec_helper'
|
|
2
2
|
|
3
3
|
require 'runners/connection_string'
|
4
4
|
|
5
|
-
describe '
|
5
|
+
describe 'URI options' do
|
6
6
|
include Mongo::ConnectionString
|
7
7
|
|
8
8
|
# Since the tests issue global assertions on Mongo::Logger,
|
@@ -22,39 +22,23 @@ describe 'Uri Options' do
|
|
22
22
|
require_mongo_kerberos
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
if test.valid?
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
test.uri
|
41
|
-
}.to raise_exception(Mongo::Error::InvalidURI)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'when the uri should not warn', if: !test.warn? && test.valid? do
|
46
|
-
|
47
|
-
before do
|
48
|
-
expect(Mongo::Logger.logger).not_to receive(:warn)
|
27
|
+
# The warning assertion needs to be first because the test caches
|
28
|
+
# the client instance, and subsequent examples don't instantiate it
|
29
|
+
# again.
|
30
|
+
if test.warn?
|
31
|
+
it 'warns' do
|
32
|
+
expect(Mongo::Logger.logger).to receive(:warn)#.and_call_original
|
33
|
+
expect(test.client).to be_a(Mongo::Client)
|
34
|
+
end
|
35
|
+
else
|
36
|
+
it 'does not warn' do
|
37
|
+
expect(Mongo::Logger.logger).not_to receive(:warn)
|
38
|
+
expect(test.client).to be_a(Mongo::Client)
|
39
|
+
end
|
49
40
|
end
|
50
41
|
|
51
|
-
it 'does not raise an exception or warning' do
|
52
|
-
expect(test.client).to be_a(Mongo::Client)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'when the uri is valid', if: test.valid? do
|
57
|
-
|
58
42
|
if test.hosts
|
59
43
|
it 'creates a client with the correct hosts' do
|
60
44
|
expect(test.client).to have_hosts(test, test.hosts)
|
@@ -65,8 +49,22 @@ describe 'Uri Options' do
|
|
65
49
|
expect(test.client).to match_auth(test)
|
66
50
|
end
|
67
51
|
|
68
|
-
|
69
|
-
|
52
|
+
if test.options
|
53
|
+
it 'creates a client with the correct options' do
|
54
|
+
mapped = Mongo::URI::OptionsMapper.new.ruby_to_smc(test.client.options)
|
55
|
+
expected = Mongo::ConnectionString.adjust_expected_mongo_client_options(
|
56
|
+
test.options,
|
57
|
+
)
|
58
|
+
mapped.should == expected
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
else
|
63
|
+
|
64
|
+
it 'raises an error' do
|
65
|
+
expect{
|
66
|
+
test.uri
|
67
|
+
}.to raise_exception(Mongo::Error::InvalidURI)
|
70
68
|
end
|
71
69
|
end
|
72
70
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIElDCCA3ygAwIBAgIQAf2j627KdciIQ4tyS8+8kTANBgkqhkiG9w0BAQsFADBh
|
3
|
+
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
4
|
+
d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
|
5
|
+
QTAeFw0xMzAzMDgxMjAwMDBaFw0yMzAzMDgxMjAwMDBaME0xCzAJBgNVBAYTAlVT
|
6
|
+
MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxJzAlBgNVBAMTHkRpZ2lDZXJ0IFNIQTIg
|
7
|
+
U2VjdXJlIFNlcnZlciBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
|
8
|
+
ANyuWJBNwcQwFZA1W248ghX1LFy949v/cUP6ZCWA1O4Yok3wZtAKc24RmDYXZK83
|
9
|
+
nf36QYSvx6+M/hpzTc8zl5CilodTgyu5pnVILR1WN3vaMTIa16yrBvSqXUu3R0bd
|
10
|
+
KpPDkC55gIDvEwRqFDu1m5K+wgdlTvza/P96rtxcflUxDOg5B6TXvi/TC2rSsd9f
|
11
|
+
/ld0Uzs1gN2ujkSYs58O09rg1/RrKatEp0tYhG2SS4HD2nOLEpdIkARFdRrdNzGX
|
12
|
+
kujNVA075ME/OV4uuPNcfhCOhkEAjUVmR7ChZ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k5Qjl6qSe0c4V5UKq1LoGpCWZDaOHtGFAAABYXEIehQAAAQDAEgwRgIhAJao
|
31
|
+
S5aKuudv9ZA4dUD/gEzdHZsF3M9xsa+KZHZzinT1AiEA1zAQMKp2pa8/Or5soC7M
|
32
|
+
HrsykWEXY3lpFCsyQM+RPHUAdwBvU3asMfAxGdiZAKRRFf93FRwR2QLBACkGjbII
|
33
|
+
mjfZEwAAAWFxCHyrAAAEAwBIMEYCIQDhtxcQCz916LqV/RKhTNOi39LW4dMPAl7Q
|
34
|
+
eWPTaUk3dAIhAOgQiFAYkgJvun9hZk/wWZ8PaZJOGnKnkLdTM3j7ZdTNMA0GCSqG
|
35
|
+
SIb3DQEBCwUAA4IBAQB6rK1wA1IsQCZVSXooVt79EgF3JMlgyCRZKTFD1KZtkKG7
|
36
|
+
n9YI0Aatw3hvKpo8OV4KC1Iw1Ie6JwbVTczyHApROLSeSHTtxbfiNXmYqNVECSQt
|
37
|
+
I+dHAYc38EKCb/XgxqfFra0vJRcCzd1yHLKJ6uERI6cJ7/vkLqJiRScHNh49Py8Y
|
38
|
+
Osijdqd0BZnwAdFKpPtmvPNPH9JWu8RlcfWUukJKF1YgzeCjz50DL47Ykqh7C8aA
|
39
|
+
T9B5yzkDNBg65zZSeDnX6FFo0ZC8BMxqN+kCyk3favP3NP8FBmkEZPqY0wMh3Xsd
|
40
|
+
OdSNdcGPBlN4MiTOIkWW6JrZl6y/hQ83ktYG8wwY
|
41
|
+
-----END CERTIFICATE-----
|
@@ -188,14 +188,10 @@ class ClientRegistry
|
|
188
188
|
end
|
189
189
|
private :new_global_client
|
190
190
|
|
191
|
-
def new_local_client(*args
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
Mongo::Client.new(*args).tap do |client|
|
196
|
-
@lock.synchronize do
|
197
|
-
@local_clients << client
|
198
|
-
end
|
191
|
+
def new_local_client(*args)
|
192
|
+
Mongo::Client.new(*args).tap do |client|
|
193
|
+
@lock.synchronize do
|
194
|
+
@local_clients << client
|
199
195
|
end
|
200
196
|
end
|
201
197
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module ClientRegistryMacros
|
2
|
-
def new_local_client(address, options=nil
|
3
|
-
ClientRegistry.instance.new_local_client(address, options
|
2
|
+
def new_local_client(address, options=nil)
|
3
|
+
ClientRegistry.instance.new_local_client(address, options)
|
4
4
|
end
|
5
5
|
|
6
|
-
def new_local_client_nmio(address, options=nil
|
6
|
+
def new_local_client_nmio(address, options=nil)
|
7
7
|
# Avoid type converting options.
|
8
8
|
base_options = {monitoring_io: false}
|
9
9
|
if BSON::Document === options || options&.keys&.any? { |key| String === key }
|
@@ -14,7 +14,7 @@ module ClientRegistryMacros
|
|
14
14
|
else
|
15
15
|
base_options
|
16
16
|
end
|
17
|
-
new_local_client(address, options
|
17
|
+
new_local_client(address, options)
|
18
18
|
end
|
19
19
|
|
20
20
|
def close_local_clients
|
@@ -96,6 +96,51 @@ module CommonShortcuts
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
|
+
|
100
|
+
def clear_ocsp_cache
|
101
|
+
before do
|
102
|
+
Mongo.clear_ocsp_cache
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def with_ocsp_mock(ca_file_path, responder_cert_path, responder_key_path,
|
107
|
+
fault: nil, port: 8100
|
108
|
+
)
|
109
|
+
clear_ocsp_cache
|
110
|
+
|
111
|
+
around do |example|
|
112
|
+
args = [
|
113
|
+
SpecConfig.instance.ocsp_files_dir.join('ocsp_mock.py').to_s,
|
114
|
+
'--ca_file', ca_file_path.to_s,
|
115
|
+
'--ocsp_responder_cert', responder_cert_path.to_s,
|
116
|
+
'--ocsp_responder_key', responder_key_path.to_s,
|
117
|
+
'-p', port.to_s,
|
118
|
+
]
|
119
|
+
if SpecConfig.instance.client_debug?
|
120
|
+
# Use when debugging - tests run faster without -v.
|
121
|
+
args << '-v'
|
122
|
+
end
|
123
|
+
if fault
|
124
|
+
args += ['--fault', fault]
|
125
|
+
end
|
126
|
+
process = ChildProcess.new(*args)
|
127
|
+
|
128
|
+
process.io.inherit!
|
129
|
+
process.start
|
130
|
+
|
131
|
+
begin
|
132
|
+
sleep 0.4
|
133
|
+
example.run
|
134
|
+
ensure
|
135
|
+
if process.exited?
|
136
|
+
raise "Spawned process exited before we stopped it"
|
137
|
+
end
|
138
|
+
|
139
|
+
process.stop
|
140
|
+
process.wait
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
99
144
|
end
|
100
145
|
|
101
146
|
module InstanceMethods
|
data/spec/support/constraints.rb
CHANGED
@@ -101,8 +101,18 @@ module Constraints
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
# Some tests hardcode the TLS certificates shipped with the driver's
|
105
|
+
# test suite, and will fail when using TLS connections that use other
|
106
|
+
# certificates.
|
104
107
|
def require_local_tls
|
105
108
|
require_tls
|
109
|
+
|
110
|
+
before(:all) do
|
111
|
+
# TODO This isn't actually the foolproof check
|
112
|
+
if ENV['OCSP_ALGORITHM']
|
113
|
+
skip 'Driver TLS certificate required, OCSP certificates are not acceptable'
|
114
|
+
end
|
115
|
+
end
|
106
116
|
end
|
107
117
|
|
108
118
|
def require_no_retry_writes
|
@@ -260,4 +270,17 @@ module Constraints
|
|
260
270
|
end
|
261
271
|
end
|
262
272
|
end
|
273
|
+
|
274
|
+
# Some tests perform assertions on what the driver is logging.
|
275
|
+
# Some test configurations, for example OCSP with unknown response,
|
276
|
+
# produce warnings due to optional checks failing.
|
277
|
+
# This constraint skips tests that issue logging assertions on configurations
|
278
|
+
# that may produce non-test-originated log entries.
|
279
|
+
def require_warning_clean
|
280
|
+
before(:all) do
|
281
|
+
if ENV['OCSP_STATUS'] == 'unknown'
|
282
|
+
skip 'Unknown OCSP status is not global warning-clean'
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
263
286
|
end
|
@@ -138,4 +138,28 @@ module LiteConstraints
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
141
|
+
|
142
|
+
def require_ocsp
|
143
|
+
before(:all) do
|
144
|
+
if !SpecConfig.instance.ocsp?
|
145
|
+
skip 'Set OCSP=1 in environment to run OCSP tests'
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def require_ocsp_verifier
|
151
|
+
before(:all) do
|
152
|
+
if !SpecConfig.instance.ocsp_verifier?
|
153
|
+
skip 'Set OCSP_VERIFIER=1 in environment to run OCSP verifier tests'
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def require_ocsp_connectivity
|
159
|
+
before(:all) do
|
160
|
+
if !SpecConfig.instance.ocsp_connectivity?
|
161
|
+
skip 'Set OCSP_CONNECTIVITY=pass or OCSP_CONNECTIVITY=fail in environment to run OCSP connectivity tests'
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
141
165
|
end
|
data/spec/support/matchers.rb
CHANGED
@@ -54,3 +54,19 @@ RSpec::Matchers.define :be_uuid do
|
|
54
54
|
object.is_a?(BSON::Binary) && object.type == :uuid
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
RSpec::Matchers.define :take_longer_than do |min_expected_time|
|
59
|
+
match do |proc|
|
60
|
+
start_time = Time.now
|
61
|
+
proc.call
|
62
|
+
(Time.now - start_time).should > min_expected_time
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
RSpec::Matchers.define :take_shorter_than do |min_expected_time|
|
67
|
+
match do |proc|
|
68
|
+
start_time = Time.now
|
69
|
+
proc.call
|
70
|
+
(Time.now - start_time).should < min_expected_time
|
71
|
+
end
|
72
|
+
end
|
data/spec/support/ocsp
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
spec/support/../../.mod/drivers-evergreen-tools/.evergreen/ocsp
|