mongo 2.10.5 → 2.15.1
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/CONTRIBUTING.md +8 -36
- data/LICENSE +1 -1
- data/README.md +57 -53
- data/Rakefile +76 -16
- data/lib/mongo/active_support.rb +4 -1
- data/lib/mongo/address/ipv4.rb +35 -5
- data/lib/mongo/address/ipv6.rb +35 -5
- data/lib/mongo/address/unix.rb +6 -3
- data/lib/mongo/address/validator.rb +102 -0
- data/lib/mongo/address.rb +121 -46
- data/lib/mongo/auth/aws/conversation.rb +128 -0
- data/lib/mongo/auth/aws/credentials_retriever.rb +222 -0
- data/lib/mongo/auth/aws/request.rb +286 -0
- data/lib/mongo/auth/aws.rb +40 -0
- data/lib/mongo/auth/base.rb +138 -0
- data/lib/mongo/auth/conversation_base.rb +87 -0
- data/lib/mongo/auth/cr/conversation.rb +24 -89
- data/lib/mongo/auth/cr.rb +13 -36
- data/lib/mongo/auth/credential_cache.rb +54 -0
- data/lib/mongo/auth/gssapi/conversation.rb +100 -0
- data/lib/mongo/auth/gssapi.rb +41 -0
- data/lib/mongo/auth/ldap/conversation.rb +12 -63
- data/lib/mongo/auth/ldap.rb +13 -34
- data/lib/mongo/auth/roles.rb +4 -1
- data/lib/mongo/auth/sasl_conversation_base.rb +102 -0
- data/lib/mongo/auth/scram/conversation.rb +16 -491
- data/lib/mongo/auth/scram.rb +43 -51
- data/lib/mongo/auth/scram256/conversation.rb +66 -0
- data/lib/mongo/auth/scram256.rb +34 -0
- data/lib/mongo/auth/scram_conversation_base.rb +378 -0
- data/lib/mongo/auth/stringprep/profiles/sasl.rb +5 -1
- data/lib/mongo/auth/stringprep/tables.rb +5 -1
- data/lib/mongo/auth/stringprep/unicode_normalize/normalize.rb +3 -2
- data/lib/mongo/auth/stringprep/unicode_normalize/tables.rb +2 -1
- data/lib/mongo/auth/stringprep.rb +9 -5
- data/lib/mongo/auth/user/view.rb +30 -14
- data/lib/mongo/auth/user.rb +17 -8
- data/lib/mongo/auth/x509/conversation.rb +26 -62
- data/lib/mongo/auth/x509.rb +29 -33
- data/lib/mongo/auth.rb +84 -23
- data/lib/mongo/background_thread.rb +173 -0
- data/lib/mongo/bson.rb +4 -1
- data/lib/mongo/bulk_write/combineable.rb +23 -8
- data/lib/mongo/bulk_write/ordered_combiner.rb +4 -1
- data/lib/mongo/bulk_write/result.rb +4 -1
- data/lib/mongo/bulk_write/result_combiner.rb +4 -1
- data/lib/mongo/bulk_write/transformable.rb +12 -10
- data/lib/mongo/bulk_write/unordered_combiner.rb +4 -1
- data/lib/mongo/bulk_write/validatable.rb +8 -1
- data/lib/mongo/bulk_write.rb +85 -26
- data/lib/mongo/caching_cursor.rb +77 -0
- data/lib/mongo/client.rb +584 -66
- data/lib/mongo/client_encryption.rb +106 -0
- data/lib/mongo/cluster/periodic_executor.rb +35 -44
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +26 -7
- data/lib/mongo/cluster/reapers/socket_reaper.rb +4 -1
- data/lib/mongo/cluster/sdam_flow.rb +165 -26
- data/lib/mongo/cluster/topology/base.rb +4 -1
- data/lib/mongo/cluster/topology/no_replica_set_options.rb +4 -1
- data/lib/mongo/cluster/topology/replica_set_no_primary.rb +7 -3
- data/lib/mongo/cluster/topology/replica_set_with_primary.rb +4 -1
- data/lib/mongo/cluster/topology/sharded.rb +5 -2
- data/lib/mongo/cluster/topology/single.rb +6 -3
- data/lib/mongo/cluster/topology/unknown.rb +4 -1
- data/lib/mongo/cluster/topology.rb +22 -2
- data/lib/mongo/cluster.rb +426 -150
- data/lib/mongo/cluster_time.rb +4 -1
- data/lib/mongo/collection/view/aggregation.rb +35 -8
- data/lib/mongo/collection/view/builder/aggregation.rb +4 -1
- data/lib/mongo/collection/view/builder/find_command.rb +50 -19
- data/lib/mongo/collection/view/builder/flags.rb +4 -1
- data/lib/mongo/collection/view/builder/map_reduce.rb +4 -1
- data/lib/mongo/collection/view/builder/modifiers.rb +4 -1
- data/lib/mongo/collection/view/builder/op_query.rb +4 -1
- data/lib/mongo/collection/view/builder.rb +4 -1
- data/lib/mongo/collection/view/change_stream/retryable.rb +4 -1
- data/lib/mongo/collection/view/change_stream.rb +23 -10
- data/lib/mongo/collection/view/explainable.rb +31 -9
- data/lib/mongo/collection/view/immutable.rb +4 -1
- data/lib/mongo/collection/view/iterable.rb +106 -18
- data/lib/mongo/collection/view/map_reduce.rb +12 -6
- data/lib/mongo/collection/view/readable.rb +81 -25
- data/lib/mongo/collection/view/writable.rb +127 -28
- data/lib/mongo/collection/view.rb +33 -22
- data/lib/mongo/collection.rb +129 -41
- data/lib/mongo/crypt/auto_decryption_context.rb +43 -0
- data/lib/mongo/crypt/auto_encrypter.rb +182 -0
- data/lib/mongo/crypt/auto_encryption_context.rb +47 -0
- data/lib/mongo/crypt/binary.rb +158 -0
- data/lib/mongo/crypt/binding.rb +1232 -0
- data/lib/mongo/crypt/context.rb +138 -0
- data/lib/mongo/crypt/data_key_context.rb +165 -0
- data/lib/mongo/crypt/encryption_io.rb +309 -0
- data/lib/mongo/crypt/explicit_decryption_context.rb +43 -0
- data/lib/mongo/crypt/explicit_encrypter.rb +120 -0
- data/lib/mongo/crypt/explicit_encryption_context.rb +92 -0
- data/lib/mongo/crypt/handle.rb +318 -0
- data/lib/mongo/crypt/hooks.rb +93 -0
- data/lib/mongo/crypt/kms_context.rb +70 -0
- data/lib/mongo/crypt/status.rb +134 -0
- data/lib/mongo/crypt.rb +36 -0
- data/lib/mongo/cursor/builder/get_more_command.rb +4 -1
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +4 -1
- data/lib/mongo/cursor/builder/op_get_more.rb +4 -1
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +4 -1
- data/lib/mongo/cursor/builder.rb +4 -1
- data/lib/mongo/cursor.rb +97 -38
- data/lib/mongo/database/view.rb +34 -7
- data/lib/mongo/database.rb +87 -14
- data/lib/mongo/dbref.rb +13 -3
- data/lib/mongo/distinguishing_semaphore.rb +58 -0
- data/lib/mongo/error/auth_error.rb +5 -2
- data/lib/mongo/error/bulk_write_error.rb +34 -15
- data/lib/mongo/error/change_stream_resumable.rb +4 -1
- data/lib/mongo/error/closed_stream.rb +4 -1
- data/lib/mongo/error/connection_check_out_timeout.rb +11 -9
- data/lib/mongo/error/connection_perished.rb +26 -0
- data/lib/mongo/error/credential_check_error.rb +29 -0
- data/lib/mongo/error/crypt_error.rb +34 -0
- data/lib/mongo/error/extra_file_chunk.rb +4 -1
- data/lib/mongo/error/{failed_stringprep_validation.rb → failed_string_prep_validation.rb} +3 -0
- data/lib/mongo/error/file_not_found.rb +4 -1
- data/lib/mongo/error/handshake_error.rb +4 -1
- data/lib/mongo/error/insufficient_iteration_count.rb +4 -1
- data/lib/mongo/error/internal_driver_error.rb +25 -0
- data/lib/mongo/error/invalid_address.rb +27 -0
- data/lib/mongo/error/invalid_application_name.rb +4 -1
- data/lib/mongo/error/invalid_bulk_operation.rb +4 -1
- data/lib/mongo/error/invalid_bulk_operation_type.rb +4 -1
- data/lib/mongo/error/invalid_collection_name.rb +4 -1
- data/lib/mongo/error/invalid_cursor_operation.rb +30 -0
- data/lib/mongo/error/invalid_database_name.rb +4 -1
- data/lib/mongo/error/invalid_document.rb +4 -1
- data/lib/mongo/error/invalid_file.rb +4 -1
- data/lib/mongo/error/invalid_file_revision.rb +4 -1
- data/lib/mongo/error/invalid_min_pool_size.rb +4 -1
- data/lib/mongo/error/invalid_nonce.rb +5 -2
- data/lib/mongo/error/invalid_read_concern.rb +31 -0
- data/lib/mongo/error/invalid_read_option.rb +4 -1
- data/lib/mongo/error/invalid_replacement_document.rb +4 -1
- data/lib/mongo/error/invalid_server_auth_host.rb +25 -0
- data/lib/mongo/error/invalid_server_auth_response.rb +26 -0
- data/lib/mongo/error/invalid_server_preference.rb +9 -1
- data/lib/mongo/error/invalid_session.rb +6 -2
- data/lib/mongo/error/invalid_signature.rb +4 -1
- data/lib/mongo/error/invalid_transaction_operation.rb +4 -1
- data/lib/mongo/error/invalid_txt_record.rb +4 -1
- data/lib/mongo/error/invalid_update_document.rb +4 -1
- data/lib/mongo/error/invalid_uri.rb +4 -1
- data/lib/mongo/error/invalid_write_concern.rb +4 -1
- data/{spec/support/crud/context.rb → lib/mongo/error/kms_error.rb} +8 -6
- data/lib/mongo/error/lint_error.rb +4 -1
- data/lib/mongo/error/max_bson_size.rb +18 -4
- data/lib/mongo/error/max_message_size.rb +4 -1
- data/lib/mongo/error/mismatched_domain.rb +4 -1
- data/lib/mongo/error/missing_file_chunk.rb +4 -1
- data/lib/mongo/error/missing_password.rb +4 -1
- data/lib/mongo/error/missing_resume_token.rb +4 -1
- data/lib/mongo/error/missing_scram_server_signature.rb +30 -0
- data/lib/mongo/error/mongocryptd_spawn_error.rb +25 -0
- data/lib/mongo/error/multi_index_drop.rb +4 -1
- data/lib/mongo/error/need_primary_server.rb +4 -1
- data/lib/mongo/error/no_server_available.rb +12 -4
- data/lib/mongo/error/no_srv_records.rb +4 -1
- data/lib/mongo/error/notable.rb +22 -19
- data/lib/mongo/error/operation_failure.rb +92 -50
- data/lib/mongo/error/parser.rb +85 -18
- data/lib/mongo/error/pool_closed_error.rb +15 -5
- data/lib/mongo/error/raise_original_error.rb +32 -0
- data/lib/mongo/error/sdam_error_detection.rb +16 -5
- data/lib/mongo/error/server_api_conflict.rb +26 -0
- data/lib/mongo/error/server_api_not_supported.rb +27 -0
- data/lib/mongo/error/server_certificate_revoked.rb +25 -0
- data/lib/mongo/error/session_ended.rb +4 -1
- data/lib/mongo/error/sessions_not_supported.rb +38 -0
- data/lib/mongo/error/socket_error.rb +4 -1
- data/lib/mongo/error/socket_timeout_error.rb +4 -1
- data/lib/mongo/error/unchangeable_collection_option.rb +4 -1
- data/lib/mongo/error/unexpected_chunk_length.rb +4 -1
- data/lib/mongo/error/unexpected_response.rb +4 -1
- data/lib/mongo/error/unknown_payload_type.rb +4 -1
- data/lib/mongo/error/unmet_dependency.rb +24 -0
- data/lib/mongo/error/unsupported_array_filters.rb +10 -2
- data/lib/mongo/error/unsupported_collation.rb +10 -2
- data/lib/mongo/error/unsupported_features.rb +4 -1
- data/lib/mongo/error/unsupported_message_type.rb +4 -1
- data/lib/mongo/error/unsupported_option.rb +104 -0
- data/lib/mongo/error/write_retryable.rb +4 -1
- data/lib/mongo/error.rb +48 -4
- data/lib/mongo/event/base.rb +10 -1
- data/lib/mongo/event/listeners.rb +4 -1
- data/lib/mongo/event/publisher.rb +4 -1
- data/lib/mongo/event/subscriber.rb +4 -1
- data/lib/mongo/event.rb +5 -2
- data/lib/mongo/grid/file/chunk.rb +5 -2
- data/lib/mongo/grid/file/info.rb +7 -3
- data/lib/mongo/grid/file.rb +4 -1
- data/lib/mongo/grid/fs_bucket.rb +74 -48
- data/lib/mongo/grid/stream/read.rb +23 -8
- data/lib/mongo/grid/stream/write.rb +4 -1
- data/lib/mongo/grid/stream.rb +4 -1
- data/lib/mongo/grid.rb +4 -1
- data/lib/mongo/id.rb +4 -1
- data/lib/mongo/index/view.rb +78 -15
- data/lib/mongo/index.rb +5 -1
- data/lib/mongo/lint.rb +14 -0
- data/lib/mongo/loggable.rb +9 -2
- data/lib/mongo/logger.rb +7 -4
- data/lib/mongo/monitoring/cmap_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/command_log_subscriber.rb +24 -4
- data/lib/mongo/monitoring/event/cmap/base.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb +12 -2
- data/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/connection_checked_in.rb +15 -4
- data/lib/mongo/monitoring/event/cmap/connection_checked_out.rb +15 -4
- data/lib/mongo/monitoring/event/cmap/connection_closed.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/connection_created.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/connection_ready.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/pool_cleared.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/pool_closed.rb +15 -4
- data/lib/mongo/monitoring/event/cmap/pool_created.rb +16 -4
- data/lib/mongo/monitoring/event/cmap.rb +4 -1
- data/lib/mongo/monitoring/event/command_failed.rb +44 -6
- data/lib/mongo/monitoring/event/command_started.rb +79 -5
- data/lib/mongo/monitoring/event/command_succeeded.rb +41 -4
- data/lib/mongo/monitoring/event/secure.rb +44 -4
- data/lib/mongo/monitoring/event/server_closed.rb +5 -2
- data/lib/mongo/monitoring/event/server_description_changed.rb +31 -5
- data/lib/mongo/monitoring/event/server_heartbeat_failed.rb +39 -18
- data/lib/mongo/monitoring/event/server_heartbeat_started.rb +13 -3
- data/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb +34 -13
- data/lib/mongo/monitoring/event/server_opening.rb +5 -2
- data/lib/mongo/monitoring/event/topology_changed.rb +5 -2
- data/lib/mongo/monitoring/event/topology_closed.rb +5 -2
- data/lib/mongo/monitoring/event/topology_opening.rb +5 -2
- data/lib/mongo/monitoring/event.rb +4 -1
- data/lib/mongo/monitoring/publishable.rb +41 -17
- data/lib/mongo/monitoring/sdam_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/server_closed_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/server_description_changed_log_subscriber.rb +13 -2
- data/lib/mongo/monitoring/server_opening_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/topology_changed_log_subscriber.rb +5 -2
- data/lib/mongo/monitoring/topology_closed_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/topology_opening_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/unified_sdam_log_subscriber.rb +65 -0
- data/lib/mongo/monitoring.rb +52 -1
- data/lib/mongo/operation/aggregate/command.rb +8 -5
- data/lib/mongo/operation/aggregate/op_msg.rb +4 -1
- data/lib/mongo/operation/aggregate/result.rb +13 -9
- data/lib/mongo/operation/aggregate.rb +4 -1
- data/lib/mongo/operation/collections_info/command.rb +48 -0
- data/lib/mongo/operation/collections_info/result.rb +22 -2
- data/lib/mongo/operation/collections_info.rb +18 -28
- data/lib/mongo/operation/command/command.rb +6 -3
- data/lib/mongo/operation/command/op_msg.rb +4 -1
- data/lib/mongo/operation/command.rb +4 -1
- data/lib/mongo/operation/context.rb +102 -0
- data/lib/mongo/operation/count/command.rb +6 -3
- data/lib/mongo/operation/count/op_msg.rb +4 -1
- data/lib/mongo/operation/count.rb +4 -1
- data/lib/mongo/operation/create/command.rb +6 -3
- data/lib/mongo/operation/create/op_msg.rb +4 -1
- data/lib/mongo/operation/create.rb +4 -1
- data/lib/mongo/operation/create_index/command.rb +7 -4
- data/lib/mongo/operation/create_index/op_msg.rb +9 -3
- data/lib/mongo/operation/create_index.rb +4 -1
- data/lib/mongo/operation/create_user/command.rb +8 -4
- data/lib/mongo/operation/create_user/op_msg.rb +5 -2
- data/lib/mongo/operation/create_user.rb +4 -1
- data/lib/mongo/operation/delete/bulk_result.rb +6 -1
- data/lib/mongo/operation/delete/command.rb +7 -4
- data/lib/mongo/operation/delete/legacy.rb +5 -2
- data/lib/mongo/operation/delete/op_msg.rb +8 -5
- data/lib/mongo/operation/delete/result.rb +8 -2
- data/lib/mongo/operation/delete.rb +4 -1
- data/lib/mongo/operation/distinct/command.rb +6 -3
- data/lib/mongo/operation/distinct/op_msg.rb +4 -1
- data/lib/mongo/operation/distinct.rb +4 -1
- data/lib/mongo/operation/drop/command.rb +6 -3
- data/lib/mongo/operation/drop/op_msg.rb +4 -1
- data/lib/mongo/operation/drop.rb +4 -1
- data/lib/mongo/operation/drop_database/command.rb +6 -3
- data/lib/mongo/operation/drop_database/op_msg.rb +4 -1
- data/lib/mongo/operation/drop_database.rb +4 -1
- data/lib/mongo/operation/drop_index/command.rb +7 -4
- data/lib/mongo/operation/drop_index/op_msg.rb +5 -2
- data/lib/mongo/operation/drop_index.rb +4 -1
- data/lib/mongo/operation/explain/command.rb +10 -3
- data/lib/mongo/operation/explain/legacy.rb +10 -3
- data/lib/mongo/operation/explain/op_msg.rb +10 -1
- data/lib/mongo/operation/explain/result.rb +7 -1
- data/lib/mongo/operation/explain.rb +4 -1
- data/lib/mongo/operation/find/command.rb +6 -3
- data/lib/mongo/operation/find/legacy/result.rb +6 -1
- data/lib/mongo/operation/find/legacy.rb +6 -3
- data/lib/mongo/operation/find/op_msg.rb +5 -9
- data/lib/mongo/operation/find/result.rb +17 -1
- data/lib/mongo/operation/find.rb +4 -1
- data/lib/mongo/operation/get_more/command.rb +6 -3
- data/lib/mongo/operation/get_more/legacy.rb +5 -2
- data/lib/mongo/operation/get_more/op_msg.rb +5 -9
- data/lib/mongo/operation/get_more/result.rb +7 -1
- data/lib/mongo/operation/get_more.rb +4 -1
- data/lib/mongo/operation/indexes/command.rb +6 -3
- data/lib/mongo/operation/indexes/legacy.rb +7 -4
- data/lib/mongo/operation/indexes/op_msg.rb +4 -1
- data/lib/mongo/operation/indexes/result.rb +9 -1
- data/lib/mongo/operation/indexes.rb +19 -2
- data/lib/mongo/operation/insert/bulk_result.rb +14 -2
- data/lib/mongo/operation/insert/command.rb +11 -7
- data/lib/mongo/operation/insert/legacy.rb +13 -5
- data/lib/mongo/operation/insert/op_msg.rb +10 -7
- data/lib/mongo/operation/insert/result.rb +15 -4
- data/lib/mongo/operation/insert.rb +6 -2
- data/lib/mongo/operation/kill_cursors/command.rb +6 -3
- data/lib/mongo/operation/kill_cursors/legacy.rb +5 -2
- data/lib/mongo/operation/kill_cursors/op_msg.rb +4 -1
- data/lib/mongo/operation/kill_cursors.rb +4 -1
- data/lib/mongo/operation/list_collections/command.rb +7 -4
- data/lib/mongo/operation/list_collections/op_msg.rb +5 -2
- data/lib/mongo/operation/list_collections/result.rb +13 -2
- data/lib/mongo/operation/list_collections.rb +4 -1
- data/lib/mongo/operation/map_reduce/command.rb +6 -3
- data/lib/mongo/operation/map_reduce/op_msg.rb +4 -1
- data/lib/mongo/operation/map_reduce/result.rb +14 -1
- data/lib/mongo/operation/map_reduce.rb +4 -1
- data/lib/mongo/operation/op_msg_base.rb +6 -3
- data/lib/mongo/operation/parallel_scan/command.rb +8 -6
- data/lib/mongo/operation/parallel_scan/op_msg.rb +5 -2
- data/lib/mongo/operation/parallel_scan/result.rb +8 -1
- data/lib/mongo/operation/parallel_scan.rb +4 -1
- data/lib/mongo/operation/remove_user/command.rb +8 -4
- data/lib/mongo/operation/remove_user/op_msg.rb +5 -2
- data/lib/mongo/operation/remove_user.rb +4 -1
- data/lib/mongo/operation/result.rb +104 -37
- data/lib/mongo/operation/shared/bypass_document_validation.rb +14 -4
- data/lib/mongo/operation/shared/causal_consistency_supported.rb +7 -3
- data/lib/mongo/operation/shared/executable.rb +60 -34
- data/lib/mongo/operation/shared/executable_no_validate.rb +6 -3
- data/lib/mongo/operation/shared/executable_transaction_label.rb +4 -1
- data/lib/mongo/operation/shared/idable.rb +6 -2
- data/lib/mongo/operation/shared/limited.rb +14 -2
- data/lib/mongo/operation/shared/object_id_generator.rb +5 -1
- data/lib/mongo/operation/shared/op_msg_or_command.rb +7 -8
- data/lib/mongo/operation/shared/op_msg_or_find_command.rb +8 -9
- data/lib/mongo/operation/shared/polymorphic_lookup.rb +4 -1
- data/lib/mongo/operation/shared/polymorphic_operation.rb +42 -0
- data/lib/mongo/operation/shared/polymorphic_result.rb +4 -1
- data/lib/mongo/operation/shared/read_preference_supported.rb +80 -23
- data/lib/mongo/operation/shared/response_handling.rb +91 -13
- data/lib/mongo/operation/shared/result/aggregatable.rb +5 -1
- data/lib/mongo/operation/shared/result/use_legacy_error_parser.rb +4 -1
- data/lib/mongo/operation/shared/sessions_supported.rb +104 -28
- data/lib/mongo/operation/shared/specifiable.rb +36 -20
- data/lib/mongo/operation/shared/write.rb +31 -24
- data/lib/mongo/operation/shared/write_concern_supported.rb +10 -6
- data/lib/mongo/operation/update/bulk_result.rb +4 -1
- data/lib/mongo/operation/update/command.rb +7 -4
- data/lib/mongo/operation/update/legacy/result.rb +11 -1
- data/lib/mongo/operation/update/legacy.rb +5 -2
- data/lib/mongo/operation/update/op_msg.rb +8 -5
- data/lib/mongo/operation/update/result.rb +13 -2
- data/lib/mongo/operation/update.rb +4 -1
- data/lib/mongo/operation/update_user/command.rb +8 -4
- data/lib/mongo/operation/update_user/op_msg.rb +5 -2
- data/lib/mongo/operation/update_user.rb +4 -1
- data/lib/mongo/operation/users_info/command.rb +7 -4
- data/lib/mongo/operation/users_info/op_msg.rb +5 -2
- data/lib/mongo/operation/users_info/result.rb +7 -1
- data/lib/mongo/operation/users_info.rb +4 -1
- data/lib/mongo/operation.rb +7 -1
- data/lib/mongo/options/mapper.rb +4 -1
- data/lib/mongo/options/redacted.rb +4 -1
- data/lib/mongo/options.rb +4 -1
- data/lib/mongo/protocol/bit_vector.rb +6 -2
- data/lib/mongo/protocol/compressed.rb +61 -11
- data/lib/mongo/protocol/delete.rb +4 -1
- data/lib/mongo/protocol/get_more.rb +4 -1
- data/lib/mongo/protocol/insert.rb +7 -2
- data/lib/mongo/protocol/kill_cursors.rb +4 -1
- data/lib/mongo/protocol/message.rb +158 -21
- data/lib/mongo/protocol/msg.rb +248 -41
- data/lib/mongo/protocol/query.rb +62 -24
- data/lib/mongo/protocol/registry.rb +4 -1
- data/lib/mongo/protocol/reply.rb +4 -1
- data/lib/mongo/protocol/serializers.rb +47 -16
- data/lib/mongo/protocol/update.rb +4 -1
- data/lib/mongo/protocol.rb +3 -0
- data/lib/mongo/query_cache.rb +275 -0
- data/lib/mongo/retryable.rb +36 -13
- data/lib/mongo/semaphore.rb +5 -2
- data/lib/mongo/server/app_metadata.rb +128 -35
- data/lib/mongo/server/connection.rb +52 -111
- data/lib/mongo/server/connection_base.rb +167 -35
- data/lib/mongo/server/connection_common.rb +168 -0
- data/lib/mongo/server/connection_pool/populator.rb +61 -0
- data/lib/mongo/server/connection_pool.rb +315 -42
- data/lib/mongo/server/context.rb +4 -1
- data/lib/mongo/server/description/features.rb +23 -10
- data/lib/mongo/server/description.rb +135 -46
- data/lib/mongo/server/monitor/app_metadata.rb +5 -2
- data/lib/mongo/server/monitor/connection.rb +142 -116
- data/lib/mongo/server/monitor.rb +197 -131
- data/lib/mongo/server/pending_connection.rb +237 -1
- data/lib/mongo/server/push_monitor/connection.rb +31 -0
- data/lib/mongo/server/push_monitor.rb +194 -0
- data/lib/mongo/server/round_trip_time_averager.rb +18 -6
- data/lib/mongo/server.rb +197 -68
- data/lib/mongo/server_selector/{selectable.rb → base.rb} +183 -95
- data/lib/mongo/server_selector/nearest.rb +32 -25
- data/lib/mongo/server_selector/primary.rb +30 -32
- data/lib/mongo/server_selector/primary_preferred.rb +38 -29
- data/lib/mongo/server_selector/secondary.rb +32 -25
- data/lib/mongo/server_selector/secondary_preferred.rb +30 -38
- data/lib/mongo/server_selector.rb +5 -2
- data/lib/mongo/session/server_session.rb +4 -1
- data/lib/mongo/session/session_pool.rb +14 -4
- data/lib/mongo/session.rb +48 -37
- data/lib/mongo/socket/ocsp_cache.rb +100 -0
- data/lib/mongo/socket/ocsp_verifier.rb +376 -0
- data/lib/mongo/socket/ssl.rb +165 -55
- data/lib/mongo/socket/tcp.rb +45 -25
- data/lib/mongo/socket/unix.rb +17 -6
- data/lib/mongo/socket.rb +176 -42
- data/lib/mongo/srv/monitor.rb +113 -0
- data/lib/mongo/srv/resolver.rb +137 -0
- data/lib/mongo/srv/result.rb +128 -0
- data/lib/mongo/srv.rb +20 -0
- data/lib/mongo/timeout.rb +54 -0
- data/lib/mongo/topology_version.rb +92 -0
- data/lib/mongo/uri/options_mapper.rb +623 -0
- data/lib/mongo/uri/srv_protocol.rb +105 -46
- data/lib/mongo/uri.rb +102 -471
- data/lib/mongo/utils.rb +118 -0
- data/lib/mongo/version.rb +5 -2
- data/lib/mongo/write_concern/acknowledged.rb +4 -1
- data/lib/mongo/write_concern/base.rb +4 -1
- data/lib/mongo/write_concern/unacknowledged.rb +4 -1
- data/lib/mongo/write_concern.rb +4 -1
- data/lib/mongo.rb +47 -2
- data/mongo.gemspec +14 -8
- data/spec/NOTES.aws-auth.md +296 -0
- data/spec/README.aws-auth.md +318 -0
- data/spec/README.md +491 -24
- data/spec/USERS.md +72 -0
- data/spec/atlas/atlas_connectivity_spec.rb +3 -0
- data/spec/atlas/operations_spec.rb +3 -0
- data/spec/integration/auth_spec.rb +135 -16
- data/spec/integration/awaited_ismaster_spec.rb +31 -0
- data/spec/integration/aws_auth_request_spec.rb +77 -0
- data/spec/integration/aws_credentials_retriever_spec.rb +106 -0
- data/spec/integration/bson_symbol_spec.rb +8 -3
- data/spec/integration/bulk_insert_spec.rb +3 -0
- data/spec/integration/bulk_write_error_message_spec.rb +41 -0
- data/spec/integration/bulk_write_spec.rb +70 -0
- data/spec/integration/change_stream_examples_spec.rb +9 -6
- data/spec/integration/change_stream_spec.rb +128 -53
- data/spec/integration/check_clean_slate_spec.rb +19 -0
- data/spec/integration/client_authentication_options_spec.rb +514 -0
- data/spec/integration/client_connectivity_spec.rb +4 -1
- data/spec/integration/client_construction_aws_auth_spec.rb +194 -0
- data/spec/integration/client_construction_spec.rb +134 -3
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +360 -0
- data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +306 -0
- data/spec/integration/client_side_encryption/auto_encryption_mongocryptd_spawn_spec.rb +75 -0
- data/spec/integration/client_side_encryption/auto_encryption_old_wire_version_spec.rb +82 -0
- data/spec/integration/client_side_encryption/auto_encryption_reconnect_spec.rb +224 -0
- data/spec/integration/client_side_encryption/auto_encryption_spec.rb +604 -0
- data/spec/integration/client_side_encryption/bson_size_limit_spec.rb +190 -0
- data/spec/integration/client_side_encryption/bypass_mongocryptd_spawn_spec.rb +81 -0
- data/spec/integration/client_side_encryption/client_close_spec.rb +66 -0
- data/spec/integration/client_side_encryption/corpus_spec.rb +236 -0
- data/spec/integration/client_side_encryption/custom_endpoint_spec.rb +135 -0
- data/spec/integration/client_side_encryption/data_key_spec.rb +168 -0
- data/spec/integration/client_side_encryption/explicit_encryption_spec.rb +117 -0
- data/spec/integration/client_side_encryption/external_key_vault_spec.rb +144 -0
- data/spec/integration/client_side_encryption/views_spec.rb +47 -0
- data/spec/integration/client_spec.rb +5 -2
- data/spec/integration/client_update_spec.rb +157 -0
- data/spec/integration/collection_indexes_prose_spec.rb +58 -0
- data/spec/integration/command_monitoring_spec.rb +97 -30
- data/spec/integration/command_spec.rb +58 -19
- data/spec/integration/connect_single_rs_name_spec.rb +17 -9
- data/spec/integration/connection_pool_populator_spec.rb +305 -0
- data/spec/integration/connection_spec.rb +159 -34
- data/spec/integration/crud_spec.rb +152 -4
- data/spec/integration/cursor_reaping_spec.rb +71 -28
- data/spec/integration/docs_examples_spec.rb +13 -1
- data/spec/integration/error_detection_spec.rb +3 -0
- data/spec/integration/fork_reconnect_spec.rb +204 -0
- data/spec/integration/get_more_spec.rb +13 -3
- data/spec/integration/grid_fs_bucket_spec.rb +4 -1
- data/spec/integration/heartbeat_events_spec.rb +27 -41
- data/spec/integration/mmapv1_spec.rb +3 -0
- data/spec/integration/mongos_pinning_spec.rb +3 -0
- data/spec/integration/ocsp_connectivity_spec.rb +29 -0
- data/spec/integration/ocsp_verifier_cache_spec.rb +191 -0
- data/spec/integration/ocsp_verifier_spec.rb +355 -0
- data/spec/integration/operation_failure_code_spec.rb +4 -1
- data/spec/integration/operation_failure_message_spec.rb +90 -0
- data/spec/integration/query_cache_spec.rb +1093 -0
- data/spec/integration/query_cache_transactions_spec.rb +193 -0
- data/spec/integration/read_concern_spec.rb +4 -1
- data/spec/integration/read_preference_spec.rb +70 -11
- data/spec/integration/reconnect_spec.rb +147 -1
- data/spec/integration/retryable_errors_spec.rb +38 -17
- data/spec/integration/{retryable_writes_spec.rb → retryable_writes/retryable_writes_36_and_older_spec.rb} +58 -51
- data/spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb +405 -0
- data/spec/integration/retryable_writes/shared/adds_diagnostics.rb +18 -0
- data/spec/integration/retryable_writes/shared/does_not_support_retries.rb +27 -0
- data/spec/integration/retryable_writes/shared/only_supports_legacy_retries.rb +28 -0
- data/spec/integration/retryable_writes/shared/performs_legacy_retries.rb +220 -0
- data/spec/integration/retryable_writes/shared/performs_modern_retries.rb +235 -0
- data/spec/integration/retryable_writes/shared/performs_no_retries.rb +113 -0
- data/spec/integration/retryable_writes/shared/supports_legacy_retries.rb +22 -0
- data/spec/integration/retryable_writes/shared/supports_modern_retries.rb +28 -0
- data/spec/integration/retryable_writes/shared/supports_retries.rb +19 -0
- data/spec/integration/retryable_writes_errors_spec.rb +14 -14
- data/spec/integration/sdam_error_handling_spec.rb +257 -43
- data/spec/integration/sdam_events_spec.rb +88 -13
- data/spec/integration/sdam_prose_spec.rb +67 -0
- data/spec/integration/secondary_reads_spec.rb +102 -0
- data/spec/integration/server_description_spec.rb +3 -0
- data/spec/integration/server_monitor_spec.rb +55 -0
- data/spec/integration/server_selection_spec.rb +39 -0
- data/spec/integration/server_selector_spec.rb +10 -5
- data/spec/integration/server_spec.rb +45 -26
- data/spec/integration/shell_examples_spec.rb +3 -0
- data/spec/integration/{size_limit_spec.rb~12e1e9c4f... RUBY-2242 Fix zlib compression (#2021) → size_limit_spec.rb} +26 -9
- data/spec/integration/snappy_compression_spec.rb +28 -0
- data/spec/integration/srv_monitoring_spec.rb +406 -0
- data/spec/integration/srv_spec.rb +59 -0
- data/spec/integration/ssl_uri_options_spec.rb +5 -2
- data/spec/integration/step_down_spec.rb +19 -18
- data/spec/integration/time_zone_querying_spec.rb +3 -0
- data/spec/integration/transactions_api_examples_spec.rb +62 -0
- data/spec/integration/transactions_examples_spec.rb +31 -9
- data/spec/integration/truncated_utf8_spec.rb +26 -0
- data/spec/integration/versioned_api_examples_spec.rb +69 -0
- data/spec/integration/x509_auth_spec.rb +112 -0
- data/spec/integration/zlib_compression_spec.rb +28 -0
- data/spec/integration/zstd_compression_spec.rb +29 -0
- data/spec/kerberos/kerberos_spec.rb +94 -0
- data/spec/lite_spec_helper.rb +85 -33
- data/spec/mongo/address/ipv4_spec.rb +4 -1
- data/spec/mongo/address/ipv6_spec.rb +3 -0
- data/spec/mongo/address/unix_spec.rb +3 -0
- data/spec/mongo/address/validator_spec.rb +54 -0
- data/spec/mongo/address_spec.rb +37 -24
- data/spec/mongo/auth/aws/request_region_spec.rb +45 -0
- data/spec/mongo/auth/aws/request_spec.rb +79 -0
- data/spec/mongo/auth/cr_spec.rb +19 -36
- data/spec/mongo/auth/gssapi/conversation_spec.rb +124 -0
- data/spec/mongo/auth/invalid_mechanism_spec.rb +4 -1
- data/spec/mongo/auth/ldap/conversation_spec.rb +6 -3
- data/spec/mongo/auth/ldap_spec.rb +17 -34
- data/spec/mongo/auth/scram/conversation_spec.rb +124 -328
- data/spec/mongo/auth/scram256/conversation_spec.rb +174 -0
- data/spec/mongo/auth/{scram/negotiation_spec.rb → scram_negotiation_spec.rb} +83 -76
- data/spec/mongo/auth/scram_spec.rb +56 -110
- data/spec/mongo/auth/stringprep/profiles/sasl_spec.rb +3 -0
- data/spec/mongo/auth/stringprep_spec.rb +3 -0
- data/spec/mongo/auth/user/view_spec.rb +108 -7
- data/spec/mongo/auth/user_spec.rb +61 -17
- data/spec/mongo/auth/x509/conversation_spec.rb +8 -5
- data/spec/mongo/auth/x509_spec.rb +42 -33
- data/spec/mongo/auth_spec.rb +7 -4
- data/spec/mongo/bson_spec.rb +3 -0
- data/spec/mongo/bulk_write/ordered_combiner_spec.rb +3 -0
- data/spec/mongo/bulk_write/result_spec.rb +14 -7
- data/spec/mongo/bulk_write/unordered_combiner_spec.rb +3 -0
- data/spec/mongo/bulk_write_spec.rb +209 -2
- data/spec/mongo/caching_cursor_spec.rb +73 -0
- data/spec/mongo/client_construction_spec.rb +1296 -305
- data/spec/mongo/client_encryption_spec.rb +414 -0
- data/spec/mongo/client_spec.rb +157 -32
- data/spec/mongo/cluster/cursor_reaper_spec.rb +15 -8
- data/spec/mongo/cluster/periodic_executor_spec.rb +19 -0
- data/spec/mongo/cluster/socket_reaper_spec.rb +17 -3
- data/spec/mongo/cluster/topology/replica_set_spec.rb +81 -30
- data/spec/mongo/cluster/topology/sharded_spec.rb +18 -12
- data/spec/mongo/cluster/topology/single_spec.rb +44 -21
- data/spec/mongo/cluster/topology/unknown_spec.rb +4 -1
- data/spec/mongo/cluster/topology_spec.rb +4 -1
- data/spec/mongo/cluster_spec.rb +114 -48
- data/spec/mongo/cluster_time_spec.rb +3 -0
- data/spec/mongo/collection/view/aggregation_spec.rb +9 -4
- data/spec/mongo/collection/view/builder/find_command_spec.rb +20 -6
- data/spec/mongo/collection/view/builder/flags_spec.rb +3 -0
- data/spec/mongo/collection/view/builder/modifiers_spec.rb +3 -0
- data/spec/mongo/collection/view/builder/op_query_spec.rb +3 -0
- data/spec/mongo/collection/view/change_stream_resume_spec.rb +397 -0
- data/spec/mongo/collection/view/change_stream_spec.rb +21 -323
- data/spec/mongo/collection/view/explainable_spec.rb +90 -4
- data/spec/mongo/collection/view/immutable_spec.rb +3 -0
- data/spec/mongo/collection/view/iterable_spec.rb +41 -0
- data/spec/mongo/collection/view/map_reduce_spec.rb +29 -15
- data/spec/mongo/collection/view/readable_spec.rb +92 -21
- data/spec/mongo/collection/view/writable_spec.rb +211 -1
- data/spec/mongo/collection/view_spec.rb +4 -1
- data/spec/mongo/collection_crud_spec.rb +4360 -0
- data/spec/mongo/collection_ddl_spec.rb +537 -0
- data/spec/mongo/collection_spec.rb +21 -4361
- data/spec/mongo/crypt/auto_decryption_context_spec.rb +93 -0
- data/spec/mongo/crypt/auto_encrypter_spec.rb +190 -0
- data/spec/mongo/crypt/auto_encryption_context_spec.rb +110 -0
- data/spec/mongo/crypt/binary_spec.rb +113 -0
- data/spec/mongo/crypt/binding/binary_spec.rb +54 -0
- data/spec/mongo/crypt/binding/context_spec.rb +255 -0
- data/spec/mongo/crypt/binding/helpers_spec.rb +44 -0
- data/spec/mongo/crypt/binding/mongocrypt_spec.rb +142 -0
- data/spec/mongo/crypt/binding/status_spec.rb +97 -0
- data/spec/mongo/crypt/binding/version_spec.rb +20 -0
- data/spec/mongo/crypt/binding_unloaded_spec.rb +23 -0
- data/spec/mongo/crypt/data_key_context_spec.rb +216 -0
- data/spec/mongo/crypt/encryption_io_spec.rb +139 -0
- data/spec/mongo/crypt/explicit_decryption_context_spec.rb +75 -0
- data/spec/mongo/crypt/explicit_encryption_context_spec.rb +173 -0
- data/spec/mongo/crypt/handle_spec.rb +235 -0
- data/spec/mongo/crypt/helpers/mongo_crypt_spec_helper.rb +111 -0
- data/spec/mongo/crypt/status_spec.rb +150 -0
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +11 -1
- data/spec/mongo/cursor/builder/op_get_more_spec.rb +11 -1
- data/spec/mongo/cursor/builder/op_kill_cursors_spec.rb +11 -1
- data/spec/mongo/cursor_spec.rb +130 -15
- data/spec/mongo/database_spec.rb +451 -17
- data/spec/mongo/dbref_spec.rb +3 -0
- data/spec/mongo/distinguishing_semaphore_spec.rb +66 -0
- data/spec/mongo/error/bulk_write_error_spec.rb +52 -0
- data/spec/mongo/error/crypt_error_spec.rb +29 -0
- data/spec/mongo/error/max_bson_size_spec.rb +38 -0
- data/spec/mongo/error/no_server_available_spec.rb +15 -2
- data/spec/mongo/error/notable_spec.rb +62 -0
- data/spec/mongo/error/operation_failure_heavy_spec.rb +61 -0
- data/spec/mongo/error/operation_failure_spec.rb +231 -70
- data/spec/mongo/error/parser_spec.rb +40 -6
- data/spec/mongo/error/unsupported_option_spec.rb +57 -0
- data/spec/mongo/event/publisher_spec.rb +3 -0
- data/spec/mongo/event/subscriber_spec.rb +3 -0
- data/spec/mongo/grid/file/chunk_spec.rb +7 -4
- data/spec/mongo/grid/file/info_spec.rb +3 -0
- data/spec/mongo/grid/file_spec.rb +4 -1
- data/spec/mongo/grid/fs_bucket_spec.rb +40 -5
- data/spec/mongo/grid/stream/read_spec.rb +33 -10
- data/spec/mongo/grid/stream/write_spec.rb +35 -0
- data/spec/mongo/grid/stream_spec.rb +3 -0
- data/spec/mongo/id_spec.rb +3 -0
- data/spec/mongo/index/view_spec.rb +321 -0
- data/spec/mongo/lint_spec.rb +3 -0
- data/spec/mongo/logger_spec.rb +16 -11
- data/spec/mongo/monitoring/command_log_subscriber_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_check_out_failed_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_check_out_started_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_checked_in_spec.rb +13 -3
- data/spec/mongo/monitoring/event/cmap/connection_checked_out_spec.rb +13 -3
- data/spec/mongo/monitoring/event/cmap/connection_closed_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_created_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_ready_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/pool_cleared_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/pool_closed_spec.rb +13 -3
- data/spec/mongo/monitoring/event/cmap/pool_created_spec.rb +13 -3
- data/spec/mongo/monitoring/event/command_failed_spec.rb +59 -2
- data/spec/mongo/monitoring/event/command_started_spec.rb +3 -0
- data/spec/mongo/monitoring/event/command_succeeded_spec.rb +46 -6
- data/spec/mongo/monitoring/event/secure_spec.rb +28 -4
- data/spec/mongo/monitoring/event/server_closed_spec.rb +4 -1
- data/spec/mongo/monitoring/event/server_description_changed_spec.rb +4 -4
- data/spec/mongo/monitoring/event/server_heartbeat_failed_spec.rb +4 -1
- data/spec/mongo/monitoring/event/server_heartbeat_started_spec.rb +3 -0
- data/spec/mongo/monitoring/event/server_heartbeat_succeeded_spec.rb +4 -1
- data/spec/mongo/monitoring/event/server_opening_spec.rb +4 -1
- data/spec/mongo/monitoring/event/topology_changed_spec.rb +4 -1
- data/spec/mongo/monitoring/event/topology_closed_spec.rb +4 -1
- data/spec/mongo/monitoring/event/topology_opening_spec.rb +4 -1
- data/spec/mongo/monitoring_spec.rb +3 -0
- data/spec/mongo/operation/aggregate/result_spec.rb +11 -1
- data/spec/mongo/operation/aggregate_spec.rb +5 -1
- data/spec/mongo/operation/collections_info_spec.rb +7 -1
- data/spec/mongo/operation/command_spec.rb +11 -5
- data/spec/mongo/operation/create_index_spec.rb +9 -3
- data/spec/mongo/operation/create_user_spec.rb +9 -3
- data/spec/mongo/operation/delete/bulk_spec.rb +24 -6
- data/spec/mongo/operation/delete/command_spec.rb +3 -0
- data/spec/mongo/operation/delete/op_msg_spec.rb +36 -21
- data/spec/mongo/operation/delete_spec.rb +14 -7
- data/spec/mongo/operation/drop_index_spec.rb +9 -2
- data/spec/mongo/operation/find/legacy_spec.rb +33 -7
- data/spec/mongo/operation/get_more_spec.rb +11 -1
- data/spec/mongo/operation/indexes_spec.rb +8 -1
- data/spec/mongo/operation/insert/bulk_spec.rb +27 -7
- data/spec/mongo/operation/insert/command_spec.rb +7 -0
- data/spec/mongo/operation/insert/op_msg_spec.rb +67 -44
- data/spec/mongo/operation/insert_spec.rb +18 -12
- data/spec/mongo/operation/kill_cursors_spec.rb +3 -0
- data/spec/mongo/operation/limited_spec.rb +8 -3
- data/spec/mongo/operation/map_reduce_spec.rb +8 -2
- data/spec/mongo/operation/read_preference_legacy_spec.rb +356 -0
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +307 -0
- data/spec/mongo/operation/remove_user_spec.rb +9 -3
- data/spec/mongo/operation/result_spec.rb +14 -4
- data/spec/mongo/operation/specifiable_spec.rb +3 -0
- data/spec/mongo/operation/update/bulk_spec.rb +24 -6
- data/spec/mongo/operation/update/command_spec.rb +7 -0
- data/spec/mongo/operation/update/op_msg_spec.rb +35 -20
- data/spec/mongo/operation/update_spec.rb +13 -7
- data/spec/mongo/operation/update_user_spec.rb +7 -1
- data/spec/mongo/options/redacted_spec.rb +3 -0
- data/spec/mongo/protocol/compressed_spec.rb +29 -13
- data/spec/mongo/protocol/delete_spec.rb +12 -8
- data/spec/mongo/protocol/get_more_spec.rb +12 -8
- data/spec/mongo/protocol/insert_spec.rb +12 -8
- data/spec/mongo/protocol/kill_cursors_spec.rb +9 -5
- data/spec/mongo/protocol/msg_spec.rb +70 -53
- data/spec/mongo/protocol/query_spec.rb +18 -15
- data/spec/mongo/protocol/registry_spec.rb +4 -1
- data/spec/mongo/protocol/reply_spec.rb +4 -1
- data/spec/mongo/protocol/update_spec.rb +13 -9
- data/spec/mongo/query_cache_middleware_spec.rb +55 -0
- data/spec/mongo/query_cache_spec.rb +283 -0
- data/spec/mongo/retryable_spec.rb +77 -72
- data/spec/mongo/semaphore_spec.rb +54 -0
- data/spec/mongo/server/app_metadata_spec.rb +53 -29
- data/spec/mongo/server/connection_auth_spec.rb +45 -23
- data/spec/mongo/server/connection_common_spec.rb +24 -0
- data/spec/mongo/server/connection_pool/populator_spec.rb +106 -0
- data/spec/mongo/server/connection_pool_spec.rb +259 -130
- data/spec/mongo/server/connection_spec.rb +277 -121
- data/spec/mongo/server/description/features_spec.rb +3 -0
- data/spec/mongo/server/description_query_methods_spec.rb +4 -1
- data/spec/mongo/server/description_spec.rb +630 -561
- data/spec/mongo/server/monitor/app_metadata_spec.rb +10 -1
- data/spec/mongo/server/monitor/connection_spec.rb +66 -79
- data/spec/mongo/server/monitor_spec.rb +173 -126
- data/spec/mongo/server/round_trip_time_averager_spec.rb +8 -3
- data/spec/mongo/server_selector/nearest_spec.rb +32 -25
- data/spec/mongo/server_selector/primary_preferred_spec.rb +35 -28
- data/spec/mongo/server_selector/primary_spec.rb +35 -11
- data/spec/mongo/server_selector/secondary_preferred_spec.rb +52 -29
- data/spec/mongo/server_selector/secondary_spec.rb +27 -20
- data/spec/mongo/server_selector_spec.rb +11 -8
- data/spec/mongo/server_spec.rb +100 -62
- data/spec/mongo/session/server_session_spec.rb +3 -0
- data/spec/mongo/session/session_pool_spec.rb +11 -8
- data/spec/mongo/session_spec.rb +38 -4
- data/spec/mongo/session_transaction_spec.rb +7 -12
- data/spec/mongo/socket/ssl_spec.rb +180 -103
- data/spec/mongo/socket/tcp_spec.rb +6 -11
- data/spec/mongo/socket/unix_spec.rb +5 -2
- data/spec/mongo/socket_spec.rb +14 -11
- data/spec/mongo/srv/monitor_spec.rb +233 -0
- data/spec/mongo/srv/result_spec.rb +57 -0
- data/spec/mongo/timeout_spec.rb +42 -0
- data/spec/mongo/tls_context_hooks_spec.rb +40 -0
- data/spec/mongo/uri/srv_protocol_spec.rb +95 -58
- data/spec/mongo/uri_option_parsing_spec.rb +14 -19
- data/spec/mongo/uri_spec.rb +253 -54
- data/spec/mongo/utils_spec.rb +56 -0
- data/spec/mongo/write_concern/acknowledged_spec.rb +3 -0
- data/spec/mongo/write_concern/unacknowledged_spec.rb +3 -0
- data/spec/mongo/write_concern_spec.rb +16 -1
- data/spec/runners/auth.rb +140 -0
- data/spec/runners/change_streams/outcome.rb +45 -0
- data/spec/runners/change_streams/spec.rb +60 -0
- data/spec/runners/change_streams/test.rb +232 -0
- data/spec/{support → runners}/cmap/verifier.rb +8 -6
- data/spec/{support → runners}/cmap.rb +29 -23
- data/spec/{support → runners}/command_monitoring.rb +10 -43
- data/spec/runners/connection_string.rb +381 -0
- data/spec/{support/transactions → runners/crud}/context.rb +12 -15
- data/spec/{support → runners}/crud/operation.rb +187 -58
- data/spec/{support → runners}/crud/outcome.rb +4 -1
- data/spec/runners/crud/requirement.rb +133 -0
- data/spec/{support → runners}/crud/spec.rb +20 -16
- data/spec/{support → runners}/crud/test.rb +11 -26
- data/spec/runners/crud/test_base.rb +53 -0
- data/spec/{support → runners}/crud/verifier.rb +40 -13
- data/spec/{support → runners}/crud.rb +33 -11
- data/spec/{support → runners}/gridfs.rb +8 -8
- data/spec/runners/read_write_concern_document.rb +70 -0
- data/spec/runners/sdam/verifier.rb +35 -11
- data/spec/{support/server_discovery_and_monitoring.rb → runners/sdam.rb} +51 -32
- data/spec/runners/server_selection.rb +365 -0
- data/spec/{support → runners}/server_selection_rtt.rb +8 -8
- data/spec/runners/transactions/operation.rb +328 -0
- data/spec/{support → runners}/transactions/spec.rb +4 -1
- data/spec/runners/transactions/test.rb +326 -0
- data/spec/{support → runners}/transactions.rb +19 -19
- data/spec/runners/unified/assertions.rb +282 -0
- data/spec/runners/unified/change_stream_operations.rb +29 -0
- data/spec/runners/unified/crud_operations.rb +206 -0
- data/spec/runners/unified/ddl_operations.rb +106 -0
- data/spec/runners/unified/entity_map.rb +42 -0
- data/spec/runners/unified/error.rb +28 -0
- data/spec/runners/unified/event_subscriber.rb +104 -0
- data/spec/runners/unified/exceptions.rb +24 -0
- data/spec/runners/unified/grid_fs_operations.rb +58 -0
- data/spec/runners/unified/support_operations.rb +253 -0
- data/spec/runners/unified/test.rb +423 -0
- data/spec/runners/unified/test_group.rb +31 -0
- data/spec/runners/unified/using_hash.rb +34 -0
- data/spec/runners/unified.rb +99 -0
- data/spec/shared/LICENSE +20 -0
- data/spec/shared/bin/get-mongodb-download-url +17 -0
- data/spec/shared/bin/s3-copy +45 -0
- data/spec/shared/bin/s3-upload +69 -0
- data/spec/shared/lib/mrss/child_process_helper.rb +80 -0
- data/spec/shared/lib/mrss/cluster_config.rb +226 -0
- data/spec/shared/lib/mrss/constraints.rb +379 -0
- data/spec/shared/lib/mrss/docker_runner.rb +271 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +191 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +115 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +179 -0
- data/spec/shared/lib/mrss/utils.rb +15 -0
- data/spec/shared/share/Dockerfile.erb +322 -0
- data/spec/shared/share/haproxy-1.conf +16 -0
- data/spec/shared/share/haproxy-2.conf +17 -0
- data/spec/shared/shlib/distro.sh +73 -0
- data/spec/shared/shlib/server.sh +317 -0
- data/spec/shared/shlib/set_env.sh +131 -0
- data/spec/solo/clean_exit_spec.rb +24 -0
- data/spec/spec_helper.rb +15 -7
- data/spec/spec_tests/auth_spec.rb +58 -0
- data/spec/spec_tests/change_streams_spec.rb +58 -5
- data/spec/spec_tests/change_streams_unified_spec.rb +13 -0
- data/spec/spec_tests/client_side_encryption_spec.rb +14 -0
- data/spec/spec_tests/cmap_spec.rb +67 -8
- data/spec/spec_tests/collection_management_spec.rb +13 -0
- data/spec/spec_tests/command_monitoring_spec.rb +51 -33
- data/spec/spec_tests/command_monitoring_unified_spec.rb +13 -0
- data/spec/spec_tests/connection_string_spec.rb +6 -83
- data/spec/spec_tests/crud_spec.rb +6 -1
- data/spec/spec_tests/crud_unified_spec.rb +13 -0
- data/spec/spec_tests/data/auth/connection-string.yml +366 -0
- data/spec/spec_tests/data/change_streams/change-streams-errors.yml +30 -5
- data/spec/spec_tests/data/change_streams/change-streams-resume-allowlist.yml +1173 -0
- data/spec/spec_tests/data/change_streams/change-streams-resume-errorLabels.yml +1105 -0
- data/spec/spec_tests/data/change_streams/change-streams.yml +83 -16
- data/spec/spec_tests/data/change_streams_unified/change-streams.yml +72 -0
- data/spec/spec_tests/data/client_side_encryption/aggregate.yml +134 -0
- data/spec/spec_tests/data/client_side_encryption/badQueries.yml +526 -0
- data/spec/spec_tests/data/client_side_encryption/badSchema.yml +73 -0
- data/spec/spec_tests/data/client_side_encryption/basic.yml +116 -0
- data/spec/spec_tests/data/client_side_encryption/bulk.yml +88 -0
- data/spec/spec_tests/data/client_side_encryption/bypassAutoEncryption.yml +100 -0
- data/spec/spec_tests/data/client_side_encryption/bypassedCommand.yml +42 -0
- data/spec/spec_tests/data/client_side_encryption/count.yml +61 -0
- data/spec/spec_tests/data/client_side_encryption/countDocuments.yml +59 -0
- data/spec/spec_tests/data/client_side_encryption/delete.yml +105 -0
- data/spec/spec_tests/data/client_side_encryption/distinct.yml +73 -0
- data/spec/spec_tests/data/client_side_encryption/explain.yml +64 -0
- data/spec/spec_tests/data/client_side_encryption/find.yml +119 -0
- data/spec/spec_tests/data/client_side_encryption/findOneAndDelete.yml +57 -0
- data/spec/spec_tests/data/client_side_encryption/findOneAndReplace.yml +57 -0
- data/spec/spec_tests/data/client_side_encryption/findOneAndUpdate.yml +57 -0
- data/spec/spec_tests/data/client_side_encryption/getMore.yml +68 -0
- data/spec/spec_tests/data/client_side_encryption/insert.yml +102 -0
- data/spec/spec_tests/data/client_side_encryption/keyAltName.yml +71 -0
- data/spec/spec_tests/data/client_side_encryption/localKMS.yml +54 -0
- data/spec/spec_tests/data/client_side_encryption/localSchema.yml +72 -0
- data/spec/spec_tests/data/client_side_encryption/malformedCiphertext.yml +69 -0
- data/spec/spec_tests/data/client_side_encryption/maxWireVersion.yml +20 -0
- data/spec/spec_tests/data/client_side_encryption/missingKey.yml +49 -0
- data/spec/spec_tests/data/client_side_encryption/replaceOne.yml +64 -0
- data/spec/spec_tests/data/client_side_encryption/types.yml +527 -0
- data/spec/spec_tests/data/client_side_encryption/unsupportedCommand.yml +25 -0
- data/spec/spec_tests/data/client_side_encryption/updateMany.yml +77 -0
- data/spec/spec_tests/data/client_side_encryption/updateOne.yml +171 -0
- data/spec/spec_tests/data/cmap/connection-must-have-id.yml +6 -0
- data/spec/spec_tests/data/cmap/connection-must-order-ids.yml +6 -0
- data/spec/spec_tests/data/cmap/pool-checkin-destroy-closed.yml +3 -0
- data/spec/spec_tests/data/cmap/pool-checkin-destroy-stale.yml +3 -0
- data/spec/spec_tests/data/cmap/pool-checkin-make-available.yml +3 -0
- data/spec/spec_tests/data/cmap/pool-checkin.yml +1 -0
- data/spec/spec_tests/data/cmap/pool-checkout-connection.yml +8 -2
- data/spec/spec_tests/data/cmap/pool-checkout-error-closed.yml +9 -1
- data/spec/spec_tests/data/cmap/pool-checkout-multiple.yml +3 -0
- data/spec/spec_tests/data/cmap/pool-checkout-no-idle.yml +4 -0
- data/spec/spec_tests/data/cmap/pool-checkout-no-stale.yml +4 -0
- data/spec/spec_tests/data/cmap/pool-close-destroy-conns.yml +2 -0
- data/spec/spec_tests/data/cmap/pool-create-max-size.yml +15 -0
- data/spec/spec_tests/data/cmap/pool-create-min-size.yml +7 -0
- data/spec/spec_tests/data/cmap/pool-create-with-options.yml +1 -0
- data/spec/spec_tests/data/cmap/wait-queue-fairness.yml +31 -1
- data/spec/spec_tests/data/cmap/wait-queue-timeout.yml +5 -0
- data/spec/spec_tests/data/collection_management/timeseries-collection.yml +129 -0
- data/spec/spec_tests/data/command_monitoring/insertMany.yml +1 -1
- data/spec/spec_tests/data/command_monitoring_unified/redacted-commands.yml +340 -0
- data/spec/spec_tests/data/connection_string/invalid-uris.yml +20 -0
- data/spec/spec_tests/data/connection_string/valid-auth.yml +16 -0
- data/spec/spec_tests/data/connection_string/valid-warnings.yml +50 -30
- data/spec/spec_tests/data/crud/write/bulkWrite.yml +26 -22
- data/spec/spec_tests/data/crud/write/insertMany.yml +26 -22
- data/spec/spec_tests/data/crud_unified/estimatedDocumentCount.yml +267 -0
- data/spec/spec_tests/data/crud_unified/updateWithPipelines.yml +305 -0
- data/spec/spec_tests/data/crud_v2/aggregate-merge.yml +1 -1
- data/spec/spec_tests/data/crud_v2/aggregate-out-readConcern.yml +1 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-arrayFilters.yml +33 -11
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint-clientError.yml +63 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint-serverError.yml +92 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint.yml +103 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint-clientError.yml +90 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint-serverError.yml +147 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint.yml +164 -0
- data/spec/spec_tests/data/crud_v2/db-aggregate.yml +1 -0
- data/spec/spec_tests/data/crud_v2/deleteMany-hint-clientError.yml +43 -0
- data/spec/spec_tests/data/crud_v2/deleteMany-hint-serverError.yml +62 -0
- data/spec/spec_tests/data/crud_v2/deleteMany-hint.yml +58 -0
- data/spec/spec_tests/data/crud_v2/deleteOne-hint-clientError.yml +41 -0
- data/spec/spec_tests/data/crud_v2/deleteOne-hint-serverError.yml +60 -0
- data/spec/spec_tests/data/crud_v2/deleteOne-hint.yml +57 -0
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse-clientError.yml +28 -0
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse-serverError.yml +44 -0
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse.yml +50 -0
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint-clientError.yml +45 -0
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint-serverError.yml +60 -0
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint.yml +56 -0
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint-serverError.yml +59 -0
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint.yml +55 -0
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint-serverError.yml +58 -0
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint.yml +55 -0
- data/spec/spec_tests/data/crud_v2/replaceOne-hint.yml +61 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-bulkWrite-delete-hint-clientError.yml +60 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-bulkWrite-update-hint-clientError.yml +88 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-deleteMany-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-deleteOne-hint-clientError.yml +38 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndDelete-hint-clientError.yml +42 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndReplace-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndUpdate-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-replaceOne-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-updateMany-hint-clientError.yml +43 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-updateOne-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/updateMany-hint-clientError.yml +45 -0
- data/spec/spec_tests/data/crud_v2/updateMany-hint-serverError.yml +66 -0
- data/spec/spec_tests/data/crud_v2/updateMany-hint.yml +65 -0
- data/spec/spec_tests/data/crud_v2/updateOne-hint-clientError.yml +43 -0
- data/spec/spec_tests/data/crud_v2/updateOne-hint-serverError.yml +62 -0
- data/spec/spec_tests/data/crud_v2/updateOne-hint.yml +61 -0
- data/spec/spec_tests/data/crud_v2/updateWithPipelines.yml +65 -0
- data/spec/spec_tests/data/dns_seedlist_discovery/direct-connection-false.yml +10 -0
- data/spec/spec_tests/data/dns_seedlist_discovery/direct-connection-true.yml +5 -0
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/MaxStalenessTooSmall.yml +15 -0
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/NoKnownServers.yml +4 -3
- data/spec/spec_tests/data/max_staleness/Unknown/SmallMaxStaleness.yml +1 -0
- data/spec/spec_tests/data/read_write_concern/connection-string/read-concern.yml +32 -0
- data/spec/spec_tests/data/read_write_concern/connection-string/write-concern.yml +79 -0
- data/spec/spec_tests/data/read_write_concern/document/read-concern.yml +37 -0
- data/spec/spec_tests/data/read_write_concern/document/write-concern.yml +100 -0
- data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-2.6.yml +215 -0
- data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-3.2.yml +58 -0
- data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-3.4.yml +95 -0
- data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-4.2.yml +36 -0
- data/spec/spec_tests/data/retryable_reads/aggregate-merge.yml +39 -0
- data/spec/spec_tests/data/retryable_reads/aggregate-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml +2 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml +2 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml +2 -1
- data/spec/spec_tests/data/retryable_reads/count-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/countDocuments-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/distinct-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-4.9.yml +60 -0
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount.yml → estimatedDocumentCount-pre4.9.yml} +2 -0
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors-4.9.yml +146 -0
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount-serverErrors.yml → estimatedDocumentCount-serverErrors-pre4.9.yml} +4 -2
- data/spec/spec_tests/data/retryable_reads/find-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/findOne-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/gridfs-download-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/gridfs-downloadByName-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listCollectionNames-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listCollectionObjects-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listCollections-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listDatabaseNames-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listDatabaseObjects-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listDatabases-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listIndexNames-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listIndexNames.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listIndexes-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_writes/bulkWrite-errorLabels.yml +77 -0
- data/spec/spec_tests/data/retryable_writes/bulkWrite-serverErrors.yml +37 -0
- data/spec/spec_tests/data/retryable_writes/bulkWrite.yml +30 -24
- data/spec/spec_tests/data/retryable_writes/deleteOne-errorLabels.yml +48 -0
- data/spec/spec_tests/data/retryable_writes/deleteOne-serverErrors.yml +22 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndDelete-errorLabels.yml +49 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndDelete-serverErrors.yml +23 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndReplace-errorLabels.yml +52 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndReplace-serverErrors.yml +25 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndUpdate-errorLabels.yml +52 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndUpdate-serverErrors.yml +24 -0
- data/spec/spec_tests/data/retryable_writes/insertMany-errorLabels.yml +54 -0
- data/spec/spec_tests/data/retryable_writes/insertMany-serverErrors.yml +24 -0
- data/spec/spec_tests/data/retryable_writes/insertOne-errorLabels.yml +44 -0
- data/spec/spec_tests/data/retryable_writes/insertOne-serverErrors.yml +94 -3
- data/spec/spec_tests/data/retryable_writes/replaceOne-errorLabels.yml +53 -0
- data/spec/spec_tests/data/retryable_writes/replaceOne-serverErrors.yml +23 -0
- data/spec/spec_tests/data/retryable_writes/updateOne-errorLabels.yml +53 -0
- data/spec/spec_tests/data/retryable_writes/updateOne-serverErrors.yml +23 -0
- data/spec/spec_tests/data/sdam/errors/error_handling_handshake.yml +55 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-network-error.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-network-timeout-error.yml +38 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-InterruptedAtShutdown.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-InterruptedDueToReplStateChange.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-LegacyNotPrimary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-NotPrimaryNoSecondaryOk.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-NotPrimaryOrSecondary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-NotWritablePrimary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-PrimarySteppedDown.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-ShutdownInProgress.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-InterruptedAtShutdown.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-InterruptedDueToReplStateChange.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-LegacyNotPrimary.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-NotPrimaryNoSecondaryOk.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-NotPrimaryOrSecondary.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-NotWritablePrimary.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-PrimarySteppedDown.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-ShutdownInProgress.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-InterruptedAtShutdown.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-InterruptedDueToReplStateChange.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-LegacyNotPrimary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-NotPrimaryNoSecondaryOk.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-NotPrimaryOrSecondary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-NotWritablePrimary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-PrimarySteppedDown.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-ShutdownInProgress.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/post-42-InterruptedAtShutdown.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-InterruptedDueToReplStateChange.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-LegacyNotPrimary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-NotPrimaryNoSecondaryOk.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-NotPrimaryOrSecondary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-NotWritablePrimary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-PrimarySteppedDown.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-ShutdownInProgress.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-InterruptedAtShutdown.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-InterruptedDueToReplStateChange.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-LegacyNotPrimary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-NotPrimaryNoSecondaryOk.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-NotPrimaryOrSecondary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-NotWritablePrimary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-PrimarySteppedDown.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-ShutdownInProgress.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/prefer-error-code.yml +54 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-InterruptedAtShutdown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-InterruptedDueToReplStateChange.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-NotPrimaryNoSecondaryOk.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-NotPrimaryOrSecondary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-NotWritablePrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-PrimarySteppedDown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-ShutdownInProgress.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-InterruptedAtShutdown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-InterruptedDueToReplStateChange.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-LegacyNotPrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotPrimaryNoSecondaryOk.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotPrimaryOrSecondary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotWritablePrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-PrimarySteppedDown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-ShutdownInProgress.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-network.yml +82 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-timeout.yml +82 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-InterruptedAtShutdown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-InterruptedDueToReplStateChange.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-LegacyNotPrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotPrimaryNoSecondaryOk.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotPrimaryOrSecondary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotWritablePrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-PrimarySteppedDown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-ShutdownInProgress.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-network.yml +82 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-timeout.yml +82 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-InterruptedAtShutdown.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-InterruptedDueToReplStateChange.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-LegacyNotPrimary.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-NotPrimaryNoSecondaryOk.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-NotPrimaryOrSecondary.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-NotWritablePrimary.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-PrimarySteppedDown.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-ShutdownInProgress.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/write_errors_ignored.yml +42 -0
- data/spec/spec_tests/data/sdam/rs/compatible.yml +6 -2
- data/spec/spec_tests/data/sdam/rs/compatible_unknown.yml +4 -1
- data/spec/spec_tests/data/sdam/rs/discover_arbiters.yml +4 -3
- data/spec/spec_tests/data/sdam/rs/discover_arbiters_replicaset.yml +44 -0
- data/spec/spec_tests/data/sdam/rs/discover_ghost.yml +36 -0
- data/spec/spec_tests/data/sdam/rs/{ghost_discovered.yml → discover_ghost_replicaset.yml} +3 -2
- data/spec/spec_tests/data/sdam/rs/discover_hidden.yml +51 -0
- data/spec/spec_tests/data/sdam/rs/discover_hidden_replicaset.yml +51 -0
- data/spec/spec_tests/data/sdam/rs/discover_passives.yml +6 -4
- data/spec/spec_tests/data/sdam/rs/discover_passives_replicaset.yml +83 -0
- data/spec/spec_tests/data/sdam/rs/discover_primary.yml +4 -3
- data/spec/spec_tests/data/sdam/rs/discover_primary_replicaset.yml +43 -0
- data/spec/spec_tests/data/sdam/rs/discover_rsother.yml +50 -0
- data/spec/spec_tests/data/sdam/rs/{rsother_discovered.yml → discover_rsother_replicaset.yml} +5 -3
- data/spec/spec_tests/data/sdam/rs/discover_secondary.yml +4 -3
- data/spec/spec_tests/data/sdam/rs/discover_secondary_replicaset.yml +44 -0
- data/spec/spec_tests/data/sdam/rs/discovery.yml +8 -4
- data/spec/spec_tests/data/sdam/rs/equal_electionids.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/hosts_differ_from_seeds.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/incompatible_arbiter.yml +5 -1
- data/spec/spec_tests/data/sdam/rs/incompatible_ghost.yml +7 -5
- data/spec/spec_tests/data/sdam/rs/incompatible_other.yml +6 -2
- data/spec/spec_tests/data/sdam/rs/ls_timeout.yml +12 -6
- data/spec/spec_tests/data/sdam/rs/member_reconfig.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/member_standalone.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/new_primary.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/new_primary_new_electionid.yml +6 -3
- data/spec/spec_tests/data/sdam/rs/new_primary_new_setversion.yml +6 -3
- data/spec/spec_tests/data/sdam/rs/new_primary_wrong_set_name.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/non_rs_member.yml +1 -0
- data/spec/spec_tests/data/sdam/rs/normalize_case.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/normalize_case_me.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/null_election_id.yml +8 -4
- data/spec/spec_tests/data/sdam/rs/primary_becomes_ghost.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_becomes_mongos.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_becomes_standalone.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/primary_changes_set_name.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_disconnect.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/primary_disconnect_electionid.yml +10 -5
- data/spec/spec_tests/data/sdam/rs/primary_disconnect_setversion.yml +10 -5
- data/spec/spec_tests/data/sdam/rs/primary_hint_from_secondary_with_mismatched_me.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_mismatched_me.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/primary_mismatched_me_not_removed.yml +75 -0
- data/spec/spec_tests/data/sdam/rs/primary_reports_new_member.yml +8 -4
- data/spec/spec_tests/data/sdam/rs/primary_to_no_primary_mismatched_me.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_wrong_set_name.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/repeated.yml +105 -0
- data/spec/spec_tests/data/sdam/rs/replicaset_rsnp.yml +21 -0
- data/spec/spec_tests/data/sdam/rs/response_from_removed.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/ruby_primary_address_change.yml +31 -0
- data/spec/spec_tests/data/sdam/rs/{secondary_wrong_set_name_with_primary_second.yml → ruby_secondary_wrong_set_name_with_primary_second.yml} +0 -0
- data/spec/spec_tests/data/sdam/rs/sec_not_auth.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/secondary_ignore_ok_0.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/secondary_mismatched_me.yml +5 -3
- data/spec/spec_tests/data/sdam/rs/secondary_wrong_set_name.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/secondary_wrong_set_name_with_primary.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/setversion_without_electionid.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/stepdown_change_set_name.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/too_new.yml +6 -2
- data/spec/spec_tests/data/sdam/rs/too_old.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/topology_version_equal.yml +68 -0
- data/spec/spec_tests/data/sdam/rs/topology_version_greater.yml +194 -0
- data/spec/spec_tests/data/sdam/rs/topology_version_less.yml +64 -0
- data/spec/spec_tests/data/sdam/rs/unexpected_mongos.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/use_setversion_without_electionid.yml +6 -3
- data/spec/spec_tests/data/sdam/rs/wrong_set_name.yml +2 -1
- data/spec/spec_tests/data/sdam/sharded/compatible.yml +4 -2
- data/spec/spec_tests/data/sdam/sharded/discover_single_mongos.yml +24 -0
- data/spec/spec_tests/data/sdam/sharded/ls_timeout_mongos.yml +9 -5
- data/spec/spec_tests/data/sdam/sharded/mongos_disconnect.yml +6 -3
- data/spec/spec_tests/data/sdam/sharded/multiple_mongoses.yml +4 -2
- data/spec/spec_tests/data/sdam/sharded/non_mongos_removed.yml +4 -2
- data/spec/spec_tests/data/sdam/sharded/ruby_primary_different_address.yml +21 -0
- data/spec/spec_tests/data/sdam/sharded/ruby_primary_mismatched_me.yml +22 -0
- data/spec/spec_tests/data/sdam/sharded/too_new.yml +4 -2
- data/spec/spec_tests/data/sdam/sharded/too_old.yml +4 -2
- data/spec/spec_tests/data/sdam/single/compatible.yml +2 -1
- data/spec/spec_tests/data/sdam/single/direct_connection_external_ip.yml +3 -2
- data/spec/spec_tests/data/sdam/single/direct_connection_mongos.yml +4 -3
- data/spec/spec_tests/data/sdam/single/direct_connection_replicaset.yml +23 -0
- data/spec/spec_tests/data/sdam/single/direct_connection_rsarbiter.yml +4 -3
- data/spec/spec_tests/data/sdam/single/direct_connection_rsprimary.yml +4 -3
- data/spec/spec_tests/data/sdam/single/direct_connection_rssecondary.yml +4 -3
- data/spec/spec_tests/data/sdam/single/direct_connection_standalone.yml +4 -3
- data/spec/spec_tests/data/sdam/single/{unavailable_seed.yml → direct_connection_unavailable_seed.yml} +2 -2
- data/spec/spec_tests/data/sdam/single/direct_connection_wrong_set_name.yml +40 -0
- data/spec/spec_tests/data/sdam/single/discover_standalone.yml +35 -0
- data/spec/spec_tests/data/sdam/single/discover_unavailable_seed.yml +28 -0
- data/spec/spec_tests/data/sdam/single/ls_timeout_standalone.yml +2 -1
- data/spec/spec_tests/data/sdam/single/not_ok_response.yml +5 -3
- data/spec/spec_tests/data/sdam/single/ruby_primary_different_address.yml +24 -0
- data/spec/spec_tests/data/sdam/single/ruby_primary_mismatched_me.yml +25 -0
- data/spec/spec_tests/data/sdam/single/standalone_removed.yml +2 -1
- data/spec/spec_tests/data/sdam/single/{direct_connection_slave.yml → standalone_using_legacy_hello.yml} +2 -2
- data/spec/spec_tests/data/sdam/single/too_new.yml +2 -1
- data/spec/spec_tests/data/sdam/single/too_old.yml +2 -1
- data/spec/spec_tests/data/sdam/single/too_old_then_upgraded.yml +48 -0
- data/spec/spec_tests/data/sdam_integration/cancel-server-check.yml +96 -0
- data/spec/spec_tests/data/sdam_integration/connectTimeoutMS.yml +88 -0
- data/spec/spec_tests/data/sdam_integration/find-network-error.yml +83 -0
- data/spec/spec_tests/data/sdam_integration/find-shutdown-error.yml +116 -0
- data/spec/spec_tests/data/sdam_integration/hello-command-error.yml +158 -0
- data/spec/spec_tests/data/sdam_integration/hello-network-error.yml +156 -0
- data/spec/spec_tests/data/sdam_integration/hello-timeout.yml +223 -0
- data/spec/spec_tests/data/sdam_integration/insert-network-error.yml +86 -0
- data/spec/spec_tests/data/sdam_integration/insert-shutdown-error.yml +115 -0
- data/spec/spec_tests/data/sdam_integration/rediscover-quickly-after-step-down.yml +98 -0
- data/spec/spec_tests/data/sdam_monitoring/discovered_standalone.yml +2 -4
- data/spec/spec_tests/data/sdam_monitoring/{replica_set_other_seed.yml → replica_set_primary_address_change.yml} +114 -96
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_me_mismatch.yml +111 -0
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_no_primary.yml +2 -1
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary.yml +2 -1
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary_removal.yml +22 -18
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_removal.yml +21 -16
- data/spec/spec_tests/data/sdam_monitoring/required_replica_set.yml +2 -1
- data/spec/spec_tests/data/sdam_monitoring/standalone.yml +3 -3
- 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 +73 -0
- data/spec/spec_tests/data/sdam_monitoring/standalone_to_rs_with_me_mismatch.yml +90 -0
- data/spec/spec_tests/data/transactions/abort.yml +3 -3
- data/spec/spec_tests/data/transactions/create-collection.yml +131 -0
- data/spec/spec_tests/data/transactions/create-index.yml +152 -0
- data/spec/spec_tests/data/transactions/error-labels.yml +93 -24
- data/spec/spec_tests/data/transactions/mongos-pin-auto.yml +3 -0
- data/spec/spec_tests/data/transactions/mongos-recovery-token.yml +3 -0
- data/spec/spec_tests/data/transactions/pin-mongos.yml +8 -6
- data/spec/spec_tests/data/transactions/read-concern.yml +6 -6
- data/spec/spec_tests/data/transactions/retryable-abort-errorLabels.yml +124 -0
- data/spec/spec_tests/data/transactions/retryable-abort.yml +17 -2
- data/spec/spec_tests/data/transactions/retryable-commit-errorLabels.yml +132 -0
- data/spec/spec_tests/data/transactions/retryable-commit.yml +24 -9
- data/spec/spec_tests/data/transactions/transaction-options-repl.yml +117 -0
- data/spec/spec_tests/data/transactions/transaction-options.yml +14 -121
- data/spec/spec_tests/data/transactions/write-concern.yml +3 -0
- data/spec/spec_tests/data/transactions_api/callback-retry.yml +3 -3
- data/spec/spec_tests/data/transactions_api/transaction-options.yml +11 -12
- data/spec/spec_tests/data/transactions_unified/mongos-unpin.yml +172 -0
- data/spec/spec_tests/data/unified/valid-fail/operation-failure.yml +31 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-change-streams.yml +220 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-command-monitoring.yml +102 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-crud.yml +184 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-gridfs.yml +155 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-retryable-reads.yml +193 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-retryable-writes.yml +210 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-sessions.yml +215 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-convenient-api.yml +235 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-mongos-pin-auto.yml +169 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions.yml +170 -0
- data/spec/spec_tests/data/uri_options/auth-options.yml +36 -1
- data/spec/spec_tests/data/uri_options/compression-options.yml +7 -4
- data/spec/spec_tests/data/uri_options/connection-options.yml +43 -0
- data/spec/spec_tests/data/uri_options/read-preference-options.yml +24 -0
- data/spec/spec_tests/data/uri_options/ruby-auth-options.yml +12 -0
- data/spec/spec_tests/data/uri_options/ruby-connection-options.yml +58 -0
- data/spec/spec_tests/data/uri_options/tls-options.yml +233 -6
- data/spec/spec_tests/data/versioned_api/crud-api-version-1-strict.yml +417 -0
- data/spec/spec_tests/data/versioned_api/crud-api-version-1.yml +411 -0
- data/spec/spec_tests/data/versioned_api/runcommand-helper-no-api-version-declared.yml +75 -0
- data/spec/spec_tests/data/versioned_api/test-commands-deprecation-errors.yml +47 -0
- data/spec/spec_tests/data/versioned_api/test-commands-strict-mode.yml +46 -0
- data/spec/spec_tests/data/versioned_api/transaction-handling.yml +128 -0
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +32 -9
- data/spec/spec_tests/gridfs_spec.rb +5 -0
- data/spec/spec_tests/max_staleness_spec.rb +7 -135
- data/spec/spec_tests/read_write_concern_connection_string_spec.rb +13 -0
- data/spec/spec_tests/read_write_concern_document_spec.rb +77 -0
- data/spec/spec_tests/read_write_concern_operaton_spec.rb +13 -0
- data/spec/spec_tests/retryable_reads_spec.rb +7 -2
- data/spec/spec_tests/retryable_writes_spec.rb +11 -1
- data/spec/spec_tests/sdam_integration_spec.rb +16 -0
- data/spec/spec_tests/sdam_monitoring_spec.rb +15 -6
- data/spec/spec_tests/sdam_spec.rb +78 -9
- data/spec/spec_tests/server_selection_rtt_spec.rb +5 -0
- data/spec/spec_tests/server_selection_spec.rb +7 -110
- data/spec/spec_tests/transactions_api_spec.rb +8 -0
- data/spec/spec_tests/transactions_spec.rb +7 -1
- data/spec/spec_tests/transactions_unified_spec.rb +13 -0
- data/spec/spec_tests/unified_spec.rb +18 -0
- data/spec/spec_tests/uri_options_spec.rb +63 -42
- data/spec/spec_tests/versioned_api_spec.rb +13 -0
- data/spec/stress/cleanup_spec.rb +61 -0
- data/spec/stress/connection_pool_stress_spec.rb +204 -0
- data/spec/stress/connection_pool_timing_spec.rb +184 -0
- data/spec/stress/fork_reconnect_stress_spec.rb +112 -0
- data/spec/stress/push_monitor_close_spec.rb +44 -0
- data/spec/support/authorization.rb +4 -11
- data/spec/support/aws_utils/base.rb +137 -0
- data/spec/support/aws_utils/inspector.rb +227 -0
- data/spec/support/aws_utils/orchestrator.rb +373 -0
- data/spec/support/aws_utils/provisioner.rb +363 -0
- data/spec/support/aws_utils.rb +65 -0
- data/spec/support/background_thread_registry.rb +70 -0
- data/spec/support/certificates/README.md +7 -2
- data/spec/support/certificates/atlas-ocsp-ca.crt +118 -0
- data/spec/support/certificates/atlas-ocsp.crt +152 -0
- data/spec/support/certificates/client-x509.crt +78 -0
- data/spec/support/certificates/client-x509.key +27 -0
- data/spec/support/certificates/client-x509.pem +105 -0
- data/spec/support/certificates/server-second-level-bundle.pem +77 -77
- data/spec/support/certificates/server-second-level.crt +52 -52
- data/spec/support/certificates/server-second-level.key +25 -25
- data/spec/support/certificates/server-second-level.pem +77 -77
- data/spec/support/client_registry.rb +65 -37
- data/spec/support/client_registry_macros.rb +17 -5
- data/spec/support/cluster_tools.rb +15 -5
- data/spec/support/common_shortcuts.rb +239 -6
- data/spec/support/constraints.rb +9 -184
- data/spec/support/crypt/corpus/corpus-key-aws.json +33 -0
- data/spec/support/crypt/corpus/corpus-key-local.json +31 -0
- data/spec/support/crypt/corpus/corpus-schema.json +2057 -0
- data/spec/support/crypt/corpus/corpus.json +3657 -0
- data/spec/support/crypt/corpus/corpus_encrypted.json +4152 -0
- data/spec/support/crypt/data_keys/key_document_aws.json +34 -0
- data/spec/support/crypt/data_keys/key_document_local.json +31 -0
- data/spec/support/crypt/external/external-key.json +31 -0
- data/spec/support/crypt/external/external-schema.json +19 -0
- data/spec/support/crypt/limits/limits-doc.json +102 -0
- data/spec/support/crypt/limits/limits-key.json +31 -0
- data/spec/support/crypt/limits/limits-schema.json +1405 -0
- data/spec/support/crypt/schema_maps/schema_map_aws.json +17 -0
- data/spec/support/crypt/schema_maps/schema_map_aws_key_alt_names.json +12 -0
- data/spec/support/crypt/schema_maps/schema_map_local.json +18 -0
- data/spec/support/crypt/schema_maps/schema_map_local_key_alt_names.json +12 -0
- data/spec/support/crypt.rb +157 -0
- data/spec/support/dns.rb +16 -0
- data/spec/support/event_subscriber.rb +193 -84
- data/spec/support/json_ext_formatter.rb +8 -1
- data/spec/support/keyword_struct.rb +29 -0
- data/spec/support/local_resource_registry.rb +37 -0
- data/spec/support/matchers.rb +39 -1
- data/spec/support/monitoring_ext.rb +3 -0
- data/spec/support/ocsp +1 -0
- data/spec/support/primary_socket.rb +3 -0
- data/spec/support/sdam_formatter_integration.rb +3 -0
- data/spec/support/session_registry.rb +55 -0
- data/spec/support/shared/app_metadata.rb +167 -0
- data/spec/support/shared/protocol.rb +5 -0
- data/spec/support/shared/scram_conversation.rb +103 -0
- data/spec/support/shared/server_selector.rb +99 -4
- data/spec/support/shared/session.rb +34 -23
- data/spec/support/spec_config.rb +292 -56
- data/spec/support/spec_setup.rb +58 -36
- data/spec/support/utils.rb +446 -45
- data.tar.gz.sig +0 -0
- metadata +1626 -683
- metadata.gz.sig +0 -0
- data/lib/mongo/event/description_changed.rb +0 -52
- data/lib/mongo/operation/shared/op_msg_or_list_indexes_command.rb +0 -45
- data/lib/mongo/server/connectable.rb +0 -107
- data/spec/enterprise_auth/kerberos_spec.rb +0 -57
- data/spec/mongo/operation/read_preference_spec.rb +0 -245
- data/spec/spec_tests/data/sdam/sharded/single_mongos.yml +0 -33
- data/spec/support/change_streams/operation.rb +0 -89
- data/spec/support/change_streams.rb +0 -265
- data/spec/support/cluster_config.rb +0 -139
- data/spec/support/connection_string.rb +0 -326
- data/spec/support/crud/requirement.rb +0 -69
- data/spec/support/crud/test_base.rb +0 -22
- data/spec/support/lite_constraints.rb +0 -52
- data/spec/support/sdam_monitoring.rb +0 -89
- data/spec/support/server_selection.rb +0 -153
- data/spec/support/transactions/operation.rb +0 -184
- data/spec/support/transactions/test.rb +0 -252
@@ -0,0 +1,233 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'lite_spec_helper'
|
5
|
+
|
6
|
+
describe Mongo::Srv::Monitor do
|
7
|
+
describe '#scan!' do
|
8
|
+
let(:hostname) do
|
9
|
+
'test1.test.build.10gen.cc'
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:hosts) do
|
13
|
+
[
|
14
|
+
'localhost.test.build.10gen.cc:27017',
|
15
|
+
'localhost.test.build.10gen.cc:27018',
|
16
|
+
]
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:result) do
|
20
|
+
double('result').tap do |result|
|
21
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
22
|
+
allow(result).to receive(:address_strs).and_return(hosts)
|
23
|
+
allow(result).to receive(:empty?).and_return(false)
|
24
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
let(:uri_resolver) do
|
29
|
+
double('uri resolver').tap do |resolver|
|
30
|
+
expect(resolver).to receive(:get_records).and_return(result)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
let(:srv_uri) do
|
35
|
+
Mongo::URI.get("mongodb+srv://this.is.not.used")
|
36
|
+
end
|
37
|
+
|
38
|
+
let(:cluster) do
|
39
|
+
Mongo::Cluster.new(hosts, Mongo::Monitoring.new, monitoring_io: false)
|
40
|
+
end
|
41
|
+
|
42
|
+
let(:monitor) do
|
43
|
+
described_class.new(cluster, srv_uri: srv_uri)
|
44
|
+
end
|
45
|
+
|
46
|
+
before do
|
47
|
+
# monitor instantiation triggers cluster instantiation which
|
48
|
+
# performs real SRV lookups for the hostname.
|
49
|
+
# The next lookup (the one performed when cluster is already set up)
|
50
|
+
# is using our doubles.
|
51
|
+
RSpec::Mocks.with_temporary_scope do
|
52
|
+
allow(uri_resolver).to receive(:get_txt_options_string)
|
53
|
+
expect(Mongo::Srv::Resolver).to receive(:new).ordered.and_return(uri_resolver)
|
54
|
+
allow(resolver).to receive(:get_txt_options_string)
|
55
|
+
expect(Mongo::Srv::Resolver).to receive(:new).ordered.and_return(resolver)
|
56
|
+
monitor.send(:scan!)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'when a new DNS record is added' do
|
61
|
+
let(:new_hosts) do
|
62
|
+
hosts + ['localhost.test.build.10gen.cc:27019']
|
63
|
+
end
|
64
|
+
|
65
|
+
let(:new_result) do
|
66
|
+
double('result').tap do |result|
|
67
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
68
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
69
|
+
allow(result).to receive(:empty?).and_return(false)
|
70
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
let(:resolver) do
|
75
|
+
double('monitor resolver').tap do |resolver|
|
76
|
+
expect(resolver).to receive(:get_records).and_return(new_result)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'adds the new host to the cluster' do
|
81
|
+
expect(cluster.servers_list.map(&:address).map(&:to_s).sort).to eq(new_hosts.sort)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'when a DNS record is removed' do
|
86
|
+
let(:new_hosts) do
|
87
|
+
hosts - ['test1.test.build.10gen.cc:27018']
|
88
|
+
end
|
89
|
+
|
90
|
+
let(:new_result) do
|
91
|
+
double('result').tap do |result|
|
92
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
93
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
94
|
+
allow(result).to receive(:empty?).and_return(false)
|
95
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
let(:resolver) do
|
100
|
+
double('resolver').tap do |resolver|
|
101
|
+
allow(resolver).to receive(:get_records).and_return(new_result)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'adds the new host to the cluster' do
|
106
|
+
expect(cluster.addresses.map(&:to_s).sort).to eq(new_hosts.sort)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'when a single DNS record is replaced' do
|
111
|
+
let(:new_hosts) do
|
112
|
+
hosts - ['test1.test.build.10gen.cc:27018'] + ['test1.test.build.10gen.cc:27019']
|
113
|
+
end
|
114
|
+
|
115
|
+
let(:new_result) do
|
116
|
+
double('result').tap do |result|
|
117
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
118
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
119
|
+
allow(result).to receive(:empty?).and_return(false)
|
120
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
let(:resolver) do
|
125
|
+
double('resolver').tap do |resolver|
|
126
|
+
allow(resolver).to receive(:get_records).and_return(new_result)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'adds the new host to the cluster' do
|
131
|
+
expect(cluster.addresses.map(&:to_s).sort).to eq(new_hosts.sort)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
context 'when all DNS result are replaced with a single record' do
|
136
|
+
let(:new_hosts) do
|
137
|
+
['test1.test.build.10gen.cc:27019']
|
138
|
+
end
|
139
|
+
|
140
|
+
let(:new_result) do
|
141
|
+
double('result').tap do |result|
|
142
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
143
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
144
|
+
allow(result).to receive(:empty?).and_return(false)
|
145
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
let(:resolver) do
|
150
|
+
double('resolver').tap do |resolver|
|
151
|
+
expect(resolver).to receive(:get_records).and_return(new_result)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'adds the new host to the cluster' do
|
156
|
+
expect(cluster.addresses.map(&:to_s).sort).to eq(new_hosts.sort)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context 'when all DNS result are replaced with multiple result' do
|
161
|
+
let(:new_hosts) do
|
162
|
+
[
|
163
|
+
'test1.test.build.10gen.cc:27019',
|
164
|
+
'test1.test.build.10gen.cc:27020',
|
165
|
+
]
|
166
|
+
end
|
167
|
+
|
168
|
+
let(:new_result) do
|
169
|
+
double('result').tap do |result|
|
170
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
171
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
172
|
+
allow(result).to receive(:empty?).and_return(false)
|
173
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
let(:resolver) do
|
178
|
+
double('resolver').tap do |resolver|
|
179
|
+
allow(resolver).to receive(:get_records).and_return(new_result)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'adds the new host to the cluster' do
|
184
|
+
expect(cluster.addresses.map(&:to_s).sort).to eq(new_hosts.sort)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
context 'when the DNS lookup times out' do
|
189
|
+
let(:resolver) do
|
190
|
+
double('resolver').tap do |resolver|
|
191
|
+
expect(resolver).to receive(:get_records).and_raise(Resolv::ResolvTimeout)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'does not add or remove any hosts from the cluster' do
|
196
|
+
expect(cluster.addresses.map(&:to_s).sort).to eq(hosts.sort)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
context 'when the DNS lookup is unable to resolve the hostname' do
|
201
|
+
let(:resolver) do
|
202
|
+
double('resolver').tap do |resolver|
|
203
|
+
allow(resolver).to receive(:get_records).and_raise(Resolv::ResolvError)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'does not add or remove any hosts from the cluster' do
|
208
|
+
expect(cluster.addresses.map(&:to_s).sort).to eq(hosts.sort)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
context 'when no DNS result are returned' do
|
213
|
+
let(:new_result) do
|
214
|
+
double('result').tap do |result|
|
215
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
216
|
+
allow(result).to receive(:address_strs).and_return([])
|
217
|
+
allow(result).to receive(:empty?).and_return(true)
|
218
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
let(:resolver) do
|
223
|
+
double('resolver').tap do |resolver|
|
224
|
+
allow(resolver).to receive(:get_records).and_return(new_result)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'does not add or remove any hosts from the cluster' do
|
229
|
+
expect(cluster.addresses.map(&:to_s).sort).to eq(hosts.sort)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'lite_spec_helper'
|
5
|
+
|
6
|
+
describe Mongo::Srv::Result do
|
7
|
+
let(:result) do
|
8
|
+
described_class.new('bar.com')
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#add_record' do
|
12
|
+
context 'when incoming hostname is in mixed case' do
|
13
|
+
let(:record) do
|
14
|
+
double('record').tap do |record|
|
15
|
+
allow(record).to receive(:target).and_return('FOO.bar.COM')
|
16
|
+
allow(record).to receive(:port).and_return(42)
|
17
|
+
allow(record).to receive(:ttl).and_return(1)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'stores hostname in lower case' do
|
22
|
+
result.add_record(record)
|
23
|
+
expect(result.address_strs).to eq(['foo.bar.com:42'])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#normalize_hostname' do
|
29
|
+
let(:actual) do
|
30
|
+
result.send(:normalize_hostname, hostname)
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when hostname is in mixed case' do
|
34
|
+
let(:hostname) { 'FOO.bar.COM' }
|
35
|
+
|
36
|
+
it 'converts to lower case' do
|
37
|
+
expect(actual).to eq('foo.bar.com')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'when hostname has one trailing dot' do
|
42
|
+
let(:hostname) { 'foo.' }
|
43
|
+
|
44
|
+
it 'removes the trailing dot' do
|
45
|
+
expect(actual).to eq('foo')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'when hostname has multiple trailing dots' do
|
50
|
+
let(:hostname) { 'foo..' }
|
51
|
+
|
52
|
+
it 'returns hostname unchanged' do
|
53
|
+
expect(actual).to eq('foo..')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'lite_spec_helper'
|
5
|
+
|
6
|
+
describe Mongo::Timeout do
|
7
|
+
describe '#timeout' do
|
8
|
+
let(:default_error_message) { 'execution expired' }
|
9
|
+
let(:custom_error_class) { Mongo::Error::SocketTimeoutError }
|
10
|
+
let(:custom_error_message) { 'socket timed out' }
|
11
|
+
|
12
|
+
context 'with time argument' do
|
13
|
+
it 'raises StandardError' do
|
14
|
+
expect do
|
15
|
+
Mongo::Timeout.timeout(0.1) do
|
16
|
+
sleep 1
|
17
|
+
end
|
18
|
+
end.to raise_error(::Timeout::Error, default_error_message)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'with time and class arguments' do
|
23
|
+
it 'raises the specified error class' do
|
24
|
+
expect do
|
25
|
+
Mongo::Timeout.timeout(0.1, custom_error_class) do
|
26
|
+
sleep 1
|
27
|
+
end
|
28
|
+
end.to raise_error(custom_error_class, default_error_message)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'with time, class, and message arguments' do
|
33
|
+
it 'raises the specified error class with message' do
|
34
|
+
expect do
|
35
|
+
Mongo::Timeout.timeout(0.1, custom_error_class, custom_error_message) do
|
36
|
+
sleep 1
|
37
|
+
end
|
38
|
+
end.to raise_error(custom_error_class, custom_error_message)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
describe Mongo do
|
7
|
+
before do
|
8
|
+
Mongo.tls_context_hooks.clear
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#tls_context_hooks' do
|
12
|
+
it 'returns an array' do
|
13
|
+
expect(Mongo.tls_context_hooks).to eq([])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#tls_context_hooks=' do
|
18
|
+
context 'when argument is not an array' do
|
19
|
+
it 'raises an ArgumentError' do
|
20
|
+
expect do
|
21
|
+
Mongo.tls_context_hooks = "Hello"
|
22
|
+
end.to raise_error(ArgumentError, /TLS context hooks must be an array of Procs/)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when argument is an array not containing procs' do
|
27
|
+
it 'raises an ArgumentError' do
|
28
|
+
expect do
|
29
|
+
Mongo.tls_context_hooks = [1, 2, 3]
|
30
|
+
end.to raise_error(ArgumentError, /TLS context hooks must be an array of Procs/)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'saves the provided hooks' do
|
35
|
+
Mongo.tls_context_hooks = [ Proc.new { |x| x ** 2 } ]
|
36
|
+
expect(Mongo.tls_context_hooks.length).to eq(1)
|
37
|
+
expect(Mongo.tls_context_hooks.first).to be_a(Proc)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -1,7 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
1
4
|
require 'lite_spec_helper'
|
2
5
|
|
3
6
|
describe Mongo::URI::SRVProtocol do
|
4
|
-
|
7
|
+
require_external_connectivity
|
8
|
+
clean_slate_for_all_if_possible
|
5
9
|
|
6
10
|
let(:scheme) { 'mongodb+srv://' }
|
7
11
|
let(:uri) { described_class.new(string) }
|
@@ -567,8 +571,8 @@ describe Mongo::URI::SRVProtocol do
|
|
567
571
|
'readPreference=secondary&maxStalenessSeconds=89'
|
568
572
|
end
|
569
573
|
|
570
|
-
it 'does not raise an exception
|
571
|
-
expect(client.read_preference).to eq(BSON::Document.new(mode: :secondary
|
574
|
+
it 'does not raise an exception and is omitted' do
|
575
|
+
expect(client.read_preference).to eq(BSON::Document.new(mode: :secondary))
|
572
576
|
end
|
573
577
|
end
|
574
578
|
end
|
@@ -588,7 +592,11 @@ describe Mongo::URI::SRVProtocol do
|
|
588
592
|
end
|
589
593
|
|
590
594
|
context 'auth mechanism provided' do
|
591
|
-
let(:options)
|
595
|
+
let(:options) { "authMechanism=#{mechanism}" }
|
596
|
+
let(:string) { "#{scheme}#{credentials}@#{servers}/?#{options}" }
|
597
|
+
let(:user) { 'tyler' }
|
598
|
+
let(:password) { 's3kr4t' }
|
599
|
+
let(:credentials) { "#{user}:#{password}" }
|
592
600
|
|
593
601
|
context 'plain' do
|
594
602
|
let(:mechanism) { 'PLAIN' }
|
@@ -603,7 +611,8 @@ describe Mongo::URI::SRVProtocol do
|
|
603
611
|
end
|
604
612
|
|
605
613
|
it 'is case-insensitive' do
|
606
|
-
|
614
|
+
client = new_local_client_nmio(string.downcase)
|
615
|
+
expect(client.options[:auth_mech]).to eq(expected)
|
607
616
|
end
|
608
617
|
end
|
609
618
|
|
@@ -620,13 +629,17 @@ describe Mongo::URI::SRVProtocol do
|
|
620
629
|
end
|
621
630
|
|
622
631
|
it 'is case-insensitive' do
|
623
|
-
|
632
|
+
client = new_local_client_nmio(string.downcase)
|
633
|
+
expect(client.options[:auth_mech]).to eq(expected)
|
624
634
|
end
|
625
635
|
end
|
626
636
|
|
627
637
|
context 'gssapi' do
|
638
|
+
require_mongo_kerberos
|
639
|
+
|
628
640
|
let(:mechanism) { 'GSSAPI' }
|
629
|
-
let(:expected)
|
641
|
+
let(:expected) { :gssapi }
|
642
|
+
let(:options) { "authMechanism=#{mechanism}&authSource=$external" }
|
630
643
|
|
631
644
|
it 'sets the auth mechanism to :gssapi' do
|
632
645
|
expect(uri.uri_options[:auth_mech]).to eq(expected)
|
@@ -637,7 +650,8 @@ describe Mongo::URI::SRVProtocol do
|
|
637
650
|
end
|
638
651
|
|
639
652
|
it 'is case-insensitive' do
|
640
|
-
|
653
|
+
client = new_local_client_nmio(string.downcase)
|
654
|
+
expect(client.options[:auth_mech]).to eq(expected)
|
641
655
|
end
|
642
656
|
end
|
643
657
|
|
@@ -654,13 +668,16 @@ describe Mongo::URI::SRVProtocol do
|
|
654
668
|
end
|
655
669
|
|
656
670
|
it 'is case-insensitive' do
|
657
|
-
|
671
|
+
client = new_local_client_nmio(string.downcase)
|
672
|
+
expect(client.options[:auth_mech]).to eq(expected)
|
658
673
|
end
|
659
674
|
end
|
660
675
|
|
661
676
|
context 'mongodb-x509' do
|
662
|
-
let(:
|
663
|
-
let(:
|
677
|
+
let(:options) { "authMechanism=#{mechanism}&authSource=$external" }
|
678
|
+
let(:mechanism) { 'MONGODB-X509' }
|
679
|
+
let(:expected) { :mongodb_x509 }
|
680
|
+
let(:credentials) { user }
|
664
681
|
|
665
682
|
it 'sets the auth mechanism to :mongodb_x509' do
|
666
683
|
expect(uri.uri_options[:auth_mech]).to eq(expected)
|
@@ -671,14 +688,16 @@ describe Mongo::URI::SRVProtocol do
|
|
671
688
|
end
|
672
689
|
|
673
690
|
it 'is case-insensitive' do
|
674
|
-
|
691
|
+
client = new_local_client_nmio(string.downcase)
|
692
|
+
expect(client.options[:auth_mech]).to eq(expected)
|
675
693
|
end
|
676
694
|
|
677
695
|
context 'when a username is not provided' do
|
678
|
-
|
696
|
+
let(:string) { "#{scheme}#{servers}/?#{options}" }
|
679
697
|
it 'recognizes the mechanism with no username' do
|
680
|
-
|
681
|
-
expect(
|
698
|
+
client = new_local_client_nmio(string.downcase)
|
699
|
+
expect(client.options[:auth_mech]).to eq(expected)
|
700
|
+
expect(client.options[:user]).to be_nil
|
682
701
|
end
|
683
702
|
end
|
684
703
|
end
|
@@ -698,98 +717,116 @@ describe Mongo::URI::SRVProtocol do
|
|
698
717
|
expect(client.options[:auth_source]).to eq(source)
|
699
718
|
end
|
700
719
|
end
|
720
|
+
end
|
701
721
|
|
702
|
-
|
703
|
-
|
704
|
-
let(:expected) { :external }
|
722
|
+
# This context exactly duplicates the same one in uri_spec.rb
|
723
|
+
context 'auth mechanism properties provided' do
|
705
724
|
|
706
|
-
|
707
|
-
|
725
|
+
shared_examples 'sets options in the expected manner' do
|
726
|
+
it 'preserves case in auth mechanism properties returned from URI' do
|
727
|
+
expect(uri.uri_options[:auth_mech_properties]).to eq(expected_uri_options)
|
708
728
|
end
|
709
729
|
|
710
|
-
it '
|
711
|
-
|
730
|
+
it 'downcases auth mechanism properties keys in client options' do
|
731
|
+
client = new_local_client_nmio(string)
|
732
|
+
expect(client.options[:auth_mech_properties]).to eq(expected_client_options)
|
712
733
|
end
|
713
734
|
end
|
714
|
-
end
|
715
|
-
|
716
|
-
context 'auth mechanism properties provided' do
|
717
735
|
|
718
736
|
context 'service_name' do
|
719
737
|
let(:options) do
|
720
|
-
"authMechanismProperties=
|
738
|
+
"authMechanismProperties=SERVICE_name:#{service_name}"
|
721
739
|
end
|
722
740
|
|
723
741
|
let(:service_name) { 'foo' }
|
724
|
-
let(:expected) { Mongo::Options::Redacted.new({ service_name: service_name }) }
|
725
742
|
|
726
|
-
|
727
|
-
|
743
|
+
let(:expected_uri_options) do
|
744
|
+
Mongo::Options::Redacted.new(
|
745
|
+
SERVICE_name: service_name,
|
746
|
+
)
|
728
747
|
end
|
729
748
|
|
730
|
-
|
731
|
-
|
749
|
+
let(:expected_client_options) do
|
750
|
+
Mongo::Options::Redacted.new(
|
751
|
+
service_name: service_name,
|
752
|
+
)
|
732
753
|
end
|
754
|
+
|
755
|
+
include_examples 'sets options in the expected manner'
|
733
756
|
end
|
734
757
|
|
735
758
|
context 'canonicalize_host_name' do
|
736
759
|
let(:options) do
|
737
|
-
"authMechanismProperties=
|
760
|
+
"authMechanismProperties=CANONICALIZE_HOST_name:#{canonicalize_host_name}"
|
738
761
|
end
|
762
|
+
|
739
763
|
let(:canonicalize_host_name) { 'true' }
|
740
|
-
let(:expected) { Mongo::Options::Redacted.new({ canonicalize_host_name: true }) }
|
741
764
|
|
742
|
-
|
743
|
-
|
765
|
+
let(:expected_uri_options) do
|
766
|
+
Mongo::Options::Redacted.new(
|
767
|
+
CANONICALIZE_HOST_name: true,
|
768
|
+
)
|
744
769
|
end
|
745
770
|
|
746
|
-
|
747
|
-
|
771
|
+
let(:expected_client_options) do
|
772
|
+
Mongo::Options::Redacted.new(
|
773
|
+
canonicalize_host_name: true,
|
774
|
+
)
|
748
775
|
end
|
776
|
+
|
777
|
+
include_examples 'sets options in the expected manner'
|
749
778
|
end
|
750
779
|
|
751
780
|
context 'service_realm' do
|
752
781
|
let(:options) do
|
753
|
-
"authMechanismProperties=
|
782
|
+
"authMechanismProperties=SERVICE_realm:#{service_realm}"
|
754
783
|
end
|
755
784
|
|
756
785
|
let(:service_realm) { 'dumdum' }
|
757
|
-
let(:expected) { Mongo::Options::Redacted.new({ service_realm: service_realm }) }
|
758
|
-
|
759
786
|
|
760
|
-
|
761
|
-
|
787
|
+
let(:expected_uri_options) do
|
788
|
+
Mongo::Options::Redacted.new(
|
789
|
+
SERVICE_realm: service_realm,
|
790
|
+
)
|
762
791
|
end
|
763
792
|
|
764
|
-
|
765
|
-
|
793
|
+
let(:expected_client_options) do
|
794
|
+
Mongo::Options::Redacted.new(
|
795
|
+
service_realm: service_realm,
|
796
|
+
)
|
766
797
|
end
|
798
|
+
|
799
|
+
include_examples 'sets options in the expected manner'
|
767
800
|
end
|
768
801
|
|
769
802
|
context 'multiple properties' do
|
770
803
|
let(:options) do
|
771
|
-
"authMechanismProperties=
|
772
|
-
|
773
|
-
|
804
|
+
"authMechanismProperties=SERVICE_realm:#{service_realm}," +
|
805
|
+
"CANONICALIZE_HOST_name:#{canonicalize_host_name}," +
|
806
|
+
"SERVICE_name:#{service_name}"
|
774
807
|
end
|
775
808
|
|
776
809
|
let(:service_name) { 'foo' }
|
777
810
|
let(:canonicalize_host_name) { 'true' }
|
778
811
|
let(:service_realm) { 'dumdum' }
|
779
812
|
|
780
|
-
let(:
|
781
|
-
Mongo::Options::Redacted.new(
|
782
|
-
|
783
|
-
|
813
|
+
let(:expected_uri_options) do
|
814
|
+
Mongo::Options::Redacted.new(
|
815
|
+
SERVICE_name: service_name,
|
816
|
+
CANONICALIZE_HOST_name: true,
|
817
|
+
SERVICE_realm: service_realm,
|
818
|
+
)
|
784
819
|
end
|
785
820
|
|
786
|
-
|
787
|
-
|
821
|
+
let(:expected_client_options) do
|
822
|
+
Mongo::Options::Redacted.new(
|
823
|
+
service_name: service_name,
|
824
|
+
canonicalize_host_name: true,
|
825
|
+
service_realm: service_realm,
|
826
|
+
)
|
788
827
|
end
|
789
828
|
|
790
|
-
|
791
|
-
expect(client.options[:auth_mech_properties]).to eq(expected)
|
792
|
-
end
|
829
|
+
include_examples 'sets options in the expected manner'
|
793
830
|
end
|
794
831
|
end
|
795
832
|
|
@@ -947,7 +984,7 @@ describe Mongo::URI::SRVProtocol do
|
|
947
984
|
end
|
948
985
|
end
|
949
986
|
|
950
|
-
describe '#
|
987
|
+
describe '#validate_srv_hostname' do
|
951
988
|
let(:valid_hostname) do
|
952
989
|
end
|
953
990
|
|
@@ -956,7 +993,7 @@ describe Mongo::URI::SRVProtocol do
|
|
956
993
|
end
|
957
994
|
|
958
995
|
let(:validate) do
|
959
|
-
dummy_uri.send(:
|
996
|
+
dummy_uri.send(:validate_srv_hostname, hostname)
|
960
997
|
end
|
961
998
|
|
962
999
|
context 'when the hostname is valid' do
|