mongo 2.13.2 → 2.14.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mongo.rb +9 -0
- data/lib/mongo/address.rb +1 -1
- data/lib/mongo/address/ipv4.rb +1 -1
- data/lib/mongo/address/ipv6.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.rb +3 -3
- data/lib/mongo/cluster/topology/single.rb +1 -1
- data/lib/mongo/collection.rb +26 -0
- data/lib/mongo/collection/view.rb +24 -20
- 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/crypt/encryption_io.rb +6 -6
- data/lib/mongo/cursor.rb +1 -0
- data/lib/mongo/database.rb +6 -0
- data/lib/mongo/database/view.rb +1 -1
- data/lib/mongo/error.rb +2 -0
- 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/lint.rb +2 -1
- data/lib/mongo/logger.rb +3 -3
- data/lib/mongo/operation.rb +2 -0
- 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/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/result/aggregatable.rb +1 -0
- data/lib/mongo/operation/shared/sessions_supported.rb +1 -0
- 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/query_cache.rb +242 -0
- data/lib/mongo/retryable.rb +8 -1
- data/lib/mongo/server.rb +5 -1
- data/lib/mongo/server/connection_common.rb +2 -2
- data/lib/mongo/server/connection_pool.rb +3 -0
- data/lib/mongo/server/monitor.rb +1 -1
- data/lib/mongo/server/monitor/connection.rb +3 -3
- data/lib/mongo/server/pending_connection.rb +2 -2
- data/lib/mongo/server/push_monitor.rb +1 -1
- data/lib/mongo/server_selector/base.rb +5 -1
- data/lib/mongo/session.rb +3 -0
- data/lib/mongo/socket.rb +6 -4
- 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/srv/monitor.rb +7 -13
- data/lib/mongo/srv/resolver.rb +14 -10
- data/lib/mongo/timeout.rb +2 -0
- data/lib/mongo/uri.rb +21 -390
- data/lib/mongo/uri/options_mapper.rb +582 -0
- data/lib/mongo/uri/srv_protocol.rb +3 -2
- data/lib/mongo/utils.rb +12 -1
- data/lib/mongo/version.rb +1 -1
- 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 +68 -17
- data/spec/integration/sdam_events_spec.rb +5 -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/logger_spec.rb +13 -11
- data/spec/mongo/query_cache_spec.rb +279 -0
- data/spec/mongo/server/app_metadata_shared.rb +1 -1
- data/spec/mongo/server/connection_pool_spec.rb +7 -3
- data/spec/mongo/server/connection_spec.rb +14 -7
- 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/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_macros.rb +11 -2
- 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 -0
- data/spec/support/utils.rb +19 -1
- metadata +1017 -992
- metadata.gz.sig +0 -0
- data/spec/shared/LICENSE +0 -20
- data/spec/shared/lib/mrss/child_process_helper.rb +0 -80
- data/spec/shared/lib/mrss/constraints.rb +0 -303
- data/spec/shared/lib/mrss/lite_constraints.rb +0 -175
- data/spec/shared/lib/mrss/spec_organizer.rb +0 -149
@@ -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
|
+
QTAeFw0xMzAzMDgxMjAwMDBaFw0yMzA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6cJ7/vkLqJiRScHNh49Py8Y
|
38
|
+
Osijdqd0BZnwAdFKpPtmvPNPH9JWu8RlcfWUukJKF1YgzeCjz50DL47Ykqh7C8aA
|
39
|
+
T9B5yzkDNBg65zZSeDnX6FFo0ZC8BMxqN+kCyk3favP3NP8FBmkEZPqY0wMh3Xsd
|
40
|
+
OdSNdcGPBlN4MiTOIkWW6JrZl6y/hQ83ktYG8wwY
|
41
|
+
-----END CERTIFICATE-----
|
@@ -4,8 +4,17 @@ module ClientRegistryMacros
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def new_local_client_nmio(address, options=nil)
|
7
|
-
|
8
|
-
|
7
|
+
# Avoid type converting options.
|
8
|
+
base_options = {monitoring_io: false}
|
9
|
+
if BSON::Document === options || options&.keys&.any? { |key| String === key }
|
10
|
+
base_options = Mongo::Options::Redacted.new(base_options)
|
11
|
+
end
|
12
|
+
options = if options
|
13
|
+
base_options.merge(options)
|
14
|
+
else
|
15
|
+
base_options
|
16
|
+
end
|
17
|
+
new_local_client(address, options)
|
9
18
|
end
|
10
19
|
|
11
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
|