mongo 2.6.4 → 2.7.0.rc0
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.tar.gz.sig +0 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/Rakefile +10 -11
- data/lib/mongo.rb +3 -1
- data/lib/mongo/active_support.rb +17 -0
- data/lib/mongo/address.rb +47 -39
- data/lib/mongo/address/ipv4.rb +1 -1
- data/lib/mongo/address/ipv6.rb +1 -1
- data/lib/mongo/address/unix.rb +1 -1
- data/lib/mongo/auth.rb +3 -8
- data/lib/mongo/auth/cr.rb +2 -2
- data/lib/mongo/auth/cr/conversation.rb +4 -4
- data/lib/mongo/auth/ldap.rb +2 -2
- data/lib/mongo/auth/ldap/conversation.rb +3 -3
- data/lib/mongo/auth/roles.rb +1 -1
- data/lib/mongo/auth/scram.rb +2 -2
- data/lib/mongo/auth/scram/conversation.rb +5 -5
- data/lib/mongo/auth/stringprep.rb +1 -1
- data/lib/mongo/auth/stringprep/profiles/sasl.rb +1 -1
- data/lib/mongo/auth/stringprep/tables.rb +1 -1
- data/lib/mongo/auth/user.rb +1 -1
- data/lib/mongo/auth/user/view.rb +2 -2
- data/lib/mongo/auth/x509.rb +2 -2
- data/lib/mongo/auth/x509/conversation.rb +3 -3
- data/lib/mongo/bson.rb +1 -1
- data/lib/mongo/bulk_write.rb +1 -1
- data/lib/mongo/bulk_write/combineable.rb +2 -2
- data/lib/mongo/bulk_write/ordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/result.rb +1 -1
- data/lib/mongo/bulk_write/result_combiner.rb +1 -1
- data/lib/mongo/bulk_write/transformable.rb +2 -2
- data/lib/mongo/bulk_write/unordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/validatable.rb +2 -2
- data/lib/mongo/client.rb +194 -82
- data/lib/mongo/cluster.rb +418 -298
- data/lib/mongo/cluster/periodic_executor.rb +10 -3
- data/lib/mongo/cluster/reapers/socket_reaper.rb +1 -1
- data/lib/mongo/cluster/sdam_flow.rb +481 -0
- data/lib/mongo/cluster/topology.rb +37 -16
- data/lib/mongo/cluster/topology/base.rb +218 -0
- data/lib/mongo/cluster/topology/no_replica_set_options.rb +34 -0
- data/lib/mongo/cluster/topology/replica_set_no_primary.rb +168 -0
- data/lib/mongo/cluster/topology/replica_set_with_primary.rb +27 -0
- data/lib/mongo/cluster/topology/sharded.rb +12 -115
- data/lib/mongo/cluster/topology/single.rb +18 -112
- data/lib/mongo/cluster/topology/unknown.rb +11 -152
- data/lib/mongo/collection.rb +2 -2
- data/lib/mongo/collection/view.rb +1 -1
- data/lib/mongo/collection/view/aggregation.rb +2 -2
- data/lib/mongo/collection/view/builder.rb +1 -1
- data/lib/mongo/collection/view/builder/aggregation.rb +1 -1
- data/lib/mongo/collection/view/builder/find_command.rb +1 -1
- data/lib/mongo/collection/view/builder/flags.rb +2 -2
- data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
- data/lib/mongo/collection/view/builder/modifiers.rb +2 -2
- data/lib/mongo/collection/view/builder/op_query.rb +1 -1
- data/lib/mongo/collection/view/change_stream.rb +4 -3
- data/lib/mongo/collection/view/change_stream/retryable.rb +1 -1
- data/lib/mongo/collection/view/explainable.rb +2 -2
- data/lib/mongo/collection/view/immutable.rb +2 -2
- data/lib/mongo/collection/view/iterable.rb +2 -2
- data/lib/mongo/collection/view/map_reduce.rb +2 -2
- data/lib/mongo/collection/view/readable.rb +3 -3
- data/lib/mongo/collection/view/writable.rb +2 -2
- data/lib/mongo/cursor.rb +8 -6
- data/lib/mongo/cursor/builder.rb +1 -1
- data/lib/mongo/cursor/builder/get_more_command.rb +1 -1
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +1 -1
- data/lib/mongo/cursor/builder/op_get_more.rb +2 -2
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +2 -2
- data/lib/mongo/database.rb +9 -4
- data/lib/mongo/database/view.rb +1 -1
- data/lib/mongo/dbref.rb +1 -1
- data/lib/mongo/error.rb +15 -2
- data/lib/mongo/error/bulk_write_error.rb +17 -1
- data/lib/mongo/error/change_stream_resumable.rb +1 -1
- data/lib/mongo/error/closed_stream.rb +1 -1
- data/lib/mongo/error/extra_file_chunk.rb +1 -1
- data/lib/mongo/error/file_not_found.rb +1 -1
- data/lib/mongo/error/handshake_error.rb +24 -0
- data/lib/mongo/error/insufficient_iteration_count.rb +1 -1
- data/lib/mongo/error/invalid_application_name.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation_type.rb +1 -1
- data/lib/mongo/error/invalid_collection_name.rb +1 -1
- data/lib/mongo/error/invalid_database_name.rb +1 -1
- data/lib/mongo/error/invalid_document.rb +1 -1
- data/lib/mongo/error/invalid_file.rb +1 -1
- data/lib/mongo/error/invalid_file_revision.rb +1 -1
- data/lib/mongo/error/invalid_min_pool_size.rb +1 -1
- data/lib/mongo/error/invalid_nonce.rb +1 -1
- data/lib/mongo/error/invalid_read_option.rb +1 -1
- data/lib/mongo/error/invalid_replacement_document.rb +1 -1
- data/lib/mongo/error/invalid_server_preference.rb +1 -1
- data/lib/mongo/error/invalid_session.rb +1 -1
- data/lib/mongo/error/invalid_signature.rb +1 -1
- data/lib/mongo/error/invalid_transaction_operation.rb +2 -2
- data/lib/mongo/error/invalid_txt_record.rb +1 -1
- data/lib/mongo/error/invalid_update_document.rb +1 -1
- data/lib/mongo/error/invalid_uri.rb +1 -1
- data/lib/mongo/error/invalid_write_concern.rb +1 -1
- data/lib/mongo/error/lint_error.rb +1 -1
- data/lib/mongo/error/max_bson_size.rb +1 -1
- data/lib/mongo/error/max_message_size.rb +1 -1
- data/lib/mongo/error/mismatched_domain.rb +1 -1
- data/lib/mongo/error/missing_file_chunk.rb +1 -1
- data/lib/mongo/error/missing_resume_token.rb +1 -1
- data/lib/mongo/error/multi_index_drop.rb +1 -1
- data/lib/mongo/error/need_primary_server.rb +1 -1
- data/lib/mongo/error/no_server_available.rb +9 -5
- data/lib/mongo/error/no_srv_records.rb +1 -1
- data/lib/mongo/error/operation_failure.rb +2 -1
- data/lib/mongo/error/parser.rb +10 -1
- data/lib/mongo/error/session_ended.rb +27 -0
- data/lib/mongo/error/socket_error.rb +1 -1
- data/lib/mongo/error/socket_timeout_error.rb +1 -1
- data/lib/mongo/error/unchangeable_collection_option.rb +1 -1
- data/lib/mongo/error/unexpected_chunk_length.rb +1 -1
- data/lib/mongo/error/unexpected_response.rb +1 -1
- data/lib/mongo/error/unknown_payload_type.rb +1 -1
- data/lib/mongo/error/unsupported_array_filters.rb +1 -1
- data/lib/mongo/error/unsupported_collation.rb +1 -1
- data/lib/mongo/error/unsupported_features.rb +1 -1
- data/lib/mongo/error/unsupported_message_type.rb +1 -1
- data/lib/mongo/error/write_retryable.rb +1 -1
- data/lib/mongo/event.rb +3 -4
- data/lib/mongo/event/base.rb +6 -3
- data/lib/mongo/event/description_changed.rb +7 -27
- data/lib/mongo/event/listeners.rb +1 -1
- data/lib/mongo/event/publisher.rb +1 -1
- data/lib/mongo/event/subscriber.rb +1 -1
- data/lib/mongo/grid.rb +1 -1
- data/lib/mongo/grid/file.rb +1 -1
- data/lib/mongo/grid/file/chunk.rb +2 -2
- data/lib/mongo/grid/file/info.rb +8 -2
- data/lib/mongo/grid/fs_bucket.rb +1 -1
- data/lib/mongo/grid/stream.rb +1 -1
- data/lib/mongo/grid/stream/read.rb +1 -1
- data/lib/mongo/grid/stream/write.rb +1 -1
- data/lib/mongo/id.rb +64 -0
- data/lib/mongo/index.rb +1 -1
- data/lib/mongo/index/view.rb +1 -1
- data/lib/mongo/lint.rb +44 -5
- data/lib/mongo/loggable.rb +1 -1
- data/lib/mongo/logger.rb +1 -1
- data/lib/mongo/monitoring.rb +34 -10
- data/lib/mongo/monitoring/command_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/event.rb +4 -1
- data/lib/mongo/monitoring/event/command_failed.rb +1 -1
- data/lib/mongo/monitoring/event/command_started.rb +2 -2
- data/lib/mongo/monitoring/event/command_succeeded.rb +1 -1
- data/lib/mongo/monitoring/event/secure.rb +2 -2
- data/lib/mongo/monitoring/event/server_closed.rb +14 -1
- data/lib/mongo/monitoring/event/server_description_changed.rb +16 -1
- data/lib/mongo/monitoring/event/server_heartbeat_failed.rb +71 -0
- data/lib/mongo/monitoring/event/server_heartbeat_started.rb +55 -0
- data/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb +63 -0
- data/lib/mongo/monitoring/event/server_opening.rb +8 -4
- data/lib/mongo/monitoring/event/topology_changed.rb +9 -6
- data/lib/mongo/monitoring/event/topology_closed.rb +14 -1
- data/lib/mongo/monitoring/event/topology_opening.rb +8 -4
- data/lib/mongo/monitoring/publishable.rb +3 -35
- data/lib/mongo/monitoring/sdam_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/server_closed_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/server_description_changed_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/server_opening_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/topology_changed_log_subscriber.rb +4 -4
- data/lib/mongo/monitoring/topology_closed_log_subscriber.rb +30 -0
- data/lib/mongo/monitoring/topology_opening_log_subscriber.rb +2 -2
- data/lib/mongo/operation.rb +8 -0
- data/lib/mongo/operation/aggregate.rb +3 -20
- data/lib/mongo/operation/aggregate/command.rb +1 -1
- data/lib/mongo/operation/aggregate/op_msg.rb +4 -30
- data/lib/mongo/operation/aggregate/result.rb +2 -2
- data/lib/mongo/operation/collections_info.rb +1 -1
- data/lib/mongo/operation/collections_info/result.rb +2 -2
- data/lib/mongo/operation/command.rb +2 -19
- data/lib/mongo/operation/command/command.rb +1 -1
- data/lib/mongo/operation/command/op_msg.rb +2 -27
- data/lib/mongo/operation/count.rb +2 -19
- data/lib/mongo/operation/count/command.rb +1 -1
- data/lib/mongo/operation/count/op_msg.rb +2 -11
- data/lib/mongo/operation/create.rb +2 -19
- data/lib/mongo/operation/create/command.rb +1 -1
- data/lib/mongo/operation/create/op_msg.rb +3 -20
- data/lib/mongo/operation/create_index.rb +2 -19
- data/lib/mongo/operation/create_index/command.rb +1 -1
- data/lib/mongo/operation/create_index/op_msg.rb +3 -18
- data/lib/mongo/operation/create_user.rb +2 -19
- data/lib/mongo/operation/create_user/command.rb +1 -1
- data/lib/mongo/operation/create_user/op_msg.rb +3 -18
- data/lib/mongo/operation/delete.rb +1 -1
- data/lib/mongo/operation/delete/bulk_result.rb +2 -2
- data/lib/mongo/operation/delete/command.rb +1 -1
- data/lib/mongo/operation/delete/legacy.rb +1 -1
- data/lib/mongo/operation/delete/op_msg.rb +5 -23
- data/lib/mongo/operation/delete/result.rb +2 -2
- data/lib/mongo/operation/distinct.rb +2 -19
- data/lib/mongo/operation/distinct/command.rb +1 -1
- data/lib/mongo/operation/distinct/op_msg.rb +3 -20
- data/lib/mongo/operation/drop.rb +2 -19
- data/lib/mongo/operation/drop/command.rb +1 -1
- data/lib/mongo/operation/drop/op_msg.rb +3 -20
- data/lib/mongo/operation/drop_database.rb +2 -19
- data/lib/mongo/operation/drop_database/command.rb +1 -1
- data/lib/mongo/operation/drop_database/op_msg.rb +3 -20
- data/lib/mongo/operation/drop_index.rb +2 -19
- data/lib/mongo/operation/drop_index/command.rb +1 -1
- data/lib/mongo/operation/drop_index/op_msg.rb +3 -18
- data/lib/mongo/operation/explain.rb +2 -21
- data/lib/mongo/operation/explain/command.rb +1 -1
- data/lib/mongo/operation/explain/legacy.rb +1 -1
- data/lib/mongo/operation/explain/op_msg.rb +4 -30
- data/lib/mongo/operation/explain/result.rb +2 -2
- data/lib/mongo/operation/find.rb +2 -21
- data/lib/mongo/operation/find/command.rb +1 -1
- data/lib/mongo/operation/find/legacy.rb +1 -1
- data/lib/mongo/operation/find/legacy/result.rb +2 -2
- data/lib/mongo/operation/find/op_msg.rb +6 -30
- data/lib/mongo/operation/find/result.rb +2 -2
- data/lib/mongo/operation/get_more.rb +2 -11
- data/lib/mongo/operation/get_more/command.rb +1 -1
- data/lib/mongo/operation/get_more/legacy.rb +1 -1
- data/lib/mongo/operation/get_more/op_msg.rb +6 -30
- data/lib/mongo/operation/get_more/result.rb +2 -2
- data/lib/mongo/operation/indexes.rb +2 -21
- data/lib/mongo/operation/indexes/command.rb +1 -1
- data/lib/mongo/operation/indexes/legacy.rb +1 -1
- data/lib/mongo/operation/indexes/op_msg.rb +4 -30
- data/lib/mongo/operation/indexes/result.rb +2 -2
- data/lib/mongo/operation/insert.rb +1 -1
- data/lib/mongo/operation/insert/bulk_result.rb +2 -2
- data/lib/mongo/operation/insert/command.rb +1 -1
- data/lib/mongo/operation/insert/legacy.rb +1 -1
- data/lib/mongo/operation/insert/op_msg.rb +10 -23
- data/lib/mongo/operation/insert/result.rb +2 -2
- data/lib/mongo/operation/kill_cursors.rb +2 -21
- data/lib/mongo/operation/kill_cursors/command.rb +1 -1
- data/lib/mongo/operation/kill_cursors/legacy.rb +1 -1
- data/lib/mongo/operation/kill_cursors/op_msg.rb +3 -20
- data/lib/mongo/operation/list_collections.rb +2 -19
- data/lib/mongo/operation/list_collections/command.rb +1 -1
- data/lib/mongo/operation/list_collections/op_msg.rb +4 -28
- data/lib/mongo/operation/list_collections/result.rb +2 -2
- data/lib/mongo/operation/map_reduce.rb +2 -19
- data/lib/mongo/operation/map_reduce/command.rb +1 -1
- data/lib/mongo/operation/map_reduce/op_msg.rb +4 -30
- data/lib/mongo/operation/map_reduce/result.rb +2 -2
- data/lib/mongo/operation/op_msg_base.rb +30 -0
- data/lib/mongo/operation/parallel_scan.rb +2 -19
- data/lib/mongo/operation/parallel_scan/command.rb +1 -1
- data/lib/mongo/operation/parallel_scan/op_msg.rb +4 -28
- data/lib/mongo/operation/parallel_scan/result.rb +2 -2
- data/lib/mongo/operation/remove_user.rb +2 -19
- data/lib/mongo/operation/remove_user/command.rb +1 -1
- data/lib/mongo/operation/remove_user/op_msg.rb +3 -18
- data/lib/mongo/operation/result.rb +14 -2
- data/lib/mongo/operation/shared/bypass_document_validation.rb +1 -1
- data/lib/mongo/operation/shared/causal_consistency_supported.rb +14 -6
- data/lib/mongo/operation/shared/executable.rb +10 -3
- data/lib/mongo/operation/shared/executable_no_validate.rb +30 -0
- data/lib/mongo/operation/shared/executable_transaction_label.rb +34 -0
- data/lib/mongo/operation/shared/idable.rb +1 -1
- data/lib/mongo/operation/shared/limited.rb +1 -1
- data/lib/mongo/operation/shared/object_id_generator.rb +1 -1
- data/lib/mongo/operation/shared/op_msg_or_command.rb +42 -0
- data/lib/mongo/operation/shared/op_msg_or_find_command.rb +45 -0
- data/lib/mongo/operation/shared/op_msg_or_list_indexes_command.rb +45 -0
- data/lib/mongo/operation/shared/polymorphic_lookup.rb +33 -0
- data/lib/mongo/operation/shared/polymorphic_result.rb +32 -0
- data/lib/mongo/operation/shared/read_preference_supported.rb +1 -1
- data/lib/mongo/operation/shared/result/aggregatable.rb +2 -2
- data/lib/mongo/operation/shared/sessions_supported.rb +24 -4
- data/lib/mongo/operation/shared/specifiable.rb +5 -3
- data/lib/mongo/operation/shared/write.rb +1 -1
- data/lib/mongo/operation/shared/write_concern_supported.rb +1 -1
- data/lib/mongo/operation/update.rb +1 -1
- data/lib/mongo/operation/update/bulk_result.rb +2 -2
- data/lib/mongo/operation/update/command.rb +1 -1
- data/lib/mongo/operation/update/legacy.rb +1 -1
- data/lib/mongo/operation/update/legacy/result.rb +2 -2
- data/lib/mongo/operation/update/op_msg.rb +5 -23
- data/lib/mongo/operation/update/result.rb +2 -2
- data/lib/mongo/operation/update_user.rb +2 -19
- data/lib/mongo/operation/update_user/command.rb +1 -1
- data/lib/mongo/operation/update_user/op_msg.rb +3 -18
- data/lib/mongo/operation/users_info.rb +2 -19
- data/lib/mongo/operation/users_info/command.rb +1 -1
- data/lib/mongo/operation/users_info/op_msg.rb +4 -28
- data/lib/mongo/operation/users_info/result.rb +2 -2
- data/lib/mongo/options.rb +1 -1
- data/lib/mongo/options/mapper.rb +10 -3
- data/lib/mongo/options/redacted.rb +1 -1
- data/lib/mongo/protocol/bit_vector.rb +1 -1
- data/lib/mongo/protocol/compressed.rb +2 -2
- data/lib/mongo/protocol/delete.rb +1 -1
- data/lib/mongo/protocol/get_more.rb +1 -1
- data/lib/mongo/protocol/insert.rb +1 -1
- data/lib/mongo/protocol/kill_cursors.rb +1 -1
- data/lib/mongo/protocol/message.rb +4 -9
- data/lib/mongo/protocol/msg.rb +2 -2
- data/lib/mongo/protocol/query.rb +1 -1
- data/lib/mongo/protocol/registry.rb +1 -1
- data/lib/mongo/protocol/reply.rb +1 -1
- data/lib/mongo/protocol/serializers.rb +1 -1
- data/lib/mongo/protocol/update.rb +1 -1
- data/lib/mongo/retryable.rb +40 -14
- data/lib/mongo/semaphore.rb +46 -0
- data/lib/mongo/server.rb +159 -44
- data/lib/mongo/{cluster → server}/app_metadata.rb +26 -13
- data/lib/mongo/server/connectable.rb +9 -13
- data/lib/mongo/server/connection.rb +143 -71
- data/lib/mongo/server/connection_pool.rb +25 -20
- data/lib/mongo/server/connection_pool/queue.rb +163 -46
- data/lib/mongo/server/context.rb +13 -13
- data/lib/mongo/server/description.rb +93 -48
- data/lib/mongo/server/description/features.rb +22 -3
- data/lib/mongo/server/monitor.rb +143 -74
- data/lib/mongo/server/monitor/app_metadata.rb +34 -0
- data/lib/mongo/server/monitor/connection.rb +42 -26
- data/lib/mongo/server/round_trip_time_averager.rb +64 -0
- data/lib/mongo/server_selector.rb +1 -1
- data/lib/mongo/server_selector/nearest.rb +1 -1
- data/lib/mongo/server_selector/primary.rb +1 -1
- data/lib/mongo/server_selector/primary_preferred.rb +1 -1
- data/lib/mongo/server_selector/secondary.rb +1 -1
- data/lib/mongo/server_selector/secondary_preferred.rb +1 -1
- data/lib/mongo/server_selector/selectable.rb +38 -13
- data/lib/mongo/session.rb +189 -40
- data/lib/mongo/session/server_session.rb +18 -7
- data/lib/mongo/session/session_pool.rb +1 -1
- data/lib/mongo/socket.rb +1 -1
- data/lib/mongo/socket/ssl.rb +46 -7
- data/lib/mongo/socket/tcp.rb +1 -1
- data/lib/mongo/socket/unix.rb +1 -1
- data/lib/mongo/uri.rb +304 -18
- data/lib/mongo/uri/srv_protocol.rb +1 -1
- data/lib/mongo/version.rb +2 -2
- data/lib/mongo/write_concern.rb +6 -6
- data/lib/mongo/write_concern/acknowledged.rb +2 -4
- data/lib/mongo/write_concern/{normalizable.rb → base.rb} +5 -6
- data/lib/mongo/write_concern/unacknowledged.rb +2 -4
- data/mongo.gemspec +1 -1
- data/spec/enterprise_auth/kerberos_spec.rb +57 -0
- data/spec/integration/bulk_insert_spec.rb +4 -2
- data/spec/integration/change_stream_examples_spec.rb +5 -6
- data/spec/integration/change_stream_spec.rb +17 -14
- data/spec/integration/client_connectivity_spec.rb +38 -0
- data/spec/integration/client_construction_spec.rb +94 -0
- data/spec/integration/command_monitoring_spec.rb +18 -30
- data/spec/integration/connect_single_rs_name_spec.rb +67 -0
- data/spec/integration/connection_spec.rb +209 -0
- data/spec/integration/cursor_reaping_spec.rb +95 -0
- data/spec/integration/docs_examples_spec.rb +6 -5
- data/spec/integration/heartbeat_events_spec.rb +116 -0
- data/spec/integration/retryable_writes_spec.rb +18 -8
- data/spec/integration/sdam_events_spec.rb +47 -0
- data/spec/integration/server_description_spec.rb +48 -0
- data/spec/integration/time_zone_querying_spec.rb +52 -0
- data/spec/lite_spec_helper.rb +74 -19
- data/spec/mongo/address_spec.rb +17 -7
- data/spec/mongo/auth/cr_spec.rb +8 -5
- data/spec/mongo/auth/ldap_spec.rb +9 -6
- data/spec/mongo/auth/scram/conversation_spec.rb +4 -1
- data/spec/mongo/auth/scram/negotiation_spec.rb +68 -110
- data/spec/mongo/auth/scram_spec.rb +8 -5
- data/spec/mongo/auth/user/view_spec.rb +5 -5
- data/spec/mongo/auth/x509_spec.rb +9 -6
- data/spec/mongo/bulk_write_spec.rb +32 -22
- data/spec/mongo/client_construction_spec.rb +1164 -0
- data/spec/mongo/client_spec.rb +62 -1000
- data/spec/mongo/cluster/cursor_reaper_spec.rb +2 -2
- data/spec/mongo/cluster/topology/replica_set_spec.rb +186 -251
- data/spec/mongo/cluster/topology/sharded_spec.rb +48 -50
- data/spec/mongo/cluster/topology/single_spec.rb +62 -22
- data/spec/mongo/cluster/topology/unknown_spec.rb +30 -115
- data/spec/mongo/cluster/topology_spec.rb +111 -13
- data/spec/mongo/cluster_spec.rb +195 -246
- data/spec/mongo/collection/view/aggregation_spec.rb +7 -8
- data/spec/mongo/collection/view/change_stream_spec.rb +18 -7
- data/spec/mongo/collection/view/explainable_spec.rb +1 -1
- data/spec/mongo/collection/view/immutable_spec.rb +1 -1
- data/spec/mongo/collection/view/map_reduce_spec.rb +7 -8
- data/spec/mongo/collection/view/readable_spec.rb +7 -8
- data/spec/mongo/collection/view/writable_spec.rb +1 -1
- data/spec/mongo/collection/view_spec.rb +2 -5
- data/spec/mongo/collection_spec.rb +41 -48
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +1 -1
- data/spec/mongo/cursor/builder/op_get_more_spec.rb +1 -1
- data/spec/mongo/cursor_spec.rb +51 -25
- data/spec/mongo/database_spec.rb +25 -37
- data/spec/mongo/error/no_server_available_spec.rb +22 -0
- data/spec/mongo/error/operation_failure_spec.rb +70 -0
- data/spec/mongo/error/parser_spec.rb +44 -10
- data/spec/mongo/grid/file/info_spec.rb +3 -3
- data/spec/mongo/grid/fs_bucket_spec.rb +18 -53
- data/spec/mongo/grid/stream/read_spec.rb +9 -15
- data/spec/mongo/grid/stream/write_spec.rb +11 -23
- data/spec/mongo/id_spec.rb +35 -0
- data/spec/mongo/index/view_spec.rb +11 -72
- data/spec/mongo/lint_spec.rb +76 -0
- data/spec/mongo/monitoring/event/command_failed_spec.rb +1 -1
- data/spec/mongo/monitoring/event/command_started_spec.rb +1 -1
- data/spec/mongo/monitoring/event/command_succeeded_spec.rb +1 -1
- data/spec/mongo/monitoring/event/secure_spec.rb +1 -1
- data/spec/mongo/monitoring/event/server_closed_spec.rb +35 -0
- data/spec/mongo/monitoring/event/server_description_changed_spec.rb +38 -0
- data/spec/mongo/monitoring/event/server_heartbeat_failed_spec.rb +31 -0
- data/spec/mongo/monitoring/event/server_heartbeat_started_spec.rb +31 -0
- data/spec/mongo/monitoring/event/server_heartbeat_succeeded_spec.rb +31 -0
- data/spec/mongo/monitoring/event/server_opening_spec.rb +35 -0
- data/spec/mongo/monitoring/event/topology_changed_spec.rb +41 -0
- data/spec/mongo/monitoring/event/topology_closed_spec.rb +35 -0
- data/spec/mongo/monitoring/event/topology_opening_spec.rb +35 -0
- data/spec/mongo/monitoring_spec.rb +2 -2
- data/spec/mongo/operation/aggregate_spec.rb +2 -2
- data/spec/mongo/operation/collections_info_spec.rb +2 -2
- data/spec/mongo/operation/command_spec.rb +1 -1
- data/spec/mongo/operation/create_index_spec.rb +8 -11
- data/spec/mongo/operation/create_user_spec.rb +6 -3
- data/spec/mongo/operation/delete/bulk_spec.rb +21 -12
- data/spec/mongo/operation/delete/command_spec.rb +3 -2
- data/spec/mongo/operation/delete/op_msg_spec.rb +32 -17
- data/spec/mongo/operation/delete_spec.rb +21 -10
- data/spec/mongo/operation/drop_index_spec.rb +5 -2
- data/spec/mongo/operation/find/legacy_spec.rb +3 -2
- data/spec/mongo/operation/get_more_spec.rb +2 -2
- data/spec/mongo/operation/indexes_spec.rb +3 -2
- data/spec/mongo/operation/insert/bulk_spec.rb +13 -3
- data/spec/mongo/operation/insert/command_spec.rb +3 -2
- data/spec/mongo/operation/insert/op_msg_spec.rb +34 -18
- data/spec/mongo/operation/insert_spec.rb +7 -6
- data/spec/mongo/operation/kill_cursors_spec.rb +2 -2
- data/spec/mongo/operation/map_reduce_spec.rb +2 -2
- data/spec/mongo/operation/remove_user_spec.rb +6 -2
- data/spec/mongo/operation/result_spec.rb +6 -3
- data/spec/mongo/operation/update/bulk_spec.rb +3 -3
- data/spec/mongo/operation/update/command_spec.rb +8 -7
- data/spec/mongo/operation/update/op_msg_spec.rb +36 -21
- data/spec/mongo/operation/update_spec.rb +8 -6
- data/spec/mongo/operation/update_user_spec.rb +6 -6
- data/spec/mongo/protocol/compressed_spec.rb +3 -2
- data/spec/mongo/protocol/delete_spec.rb +1 -1
- data/spec/mongo/protocol/get_more_spec.rb +1 -1
- data/spec/mongo/protocol/insert_spec.rb +1 -1
- data/spec/mongo/protocol/kill_cursors_spec.rb +1 -1
- data/spec/mongo/protocol/msg_spec.rb +14 -13
- data/spec/mongo/protocol/query_spec.rb +1 -1
- data/spec/mongo/protocol/update_spec.rb +1 -1
- data/spec/mongo/retryable_spec.rb +84 -0
- data/spec/mongo/{cluster → server}/app_metadata_spec.rb +15 -3
- data/spec/mongo/server/connection_auth_spec.rb +114 -0
- data/spec/mongo/server/connection_pool/queue_spec.rb +146 -30
- data/spec/mongo/server/connection_pool_spec.rb +11 -12
- data/spec/mongo/server/connection_spec.rb +339 -152
- data/spec/mongo/server/description_query_methods_spec.rb +288 -0
- data/spec/mongo/server/description_spec.rb +63 -240
- data/spec/mongo/server/monitor/app_metadata_spec.rb +16 -0
- data/spec/mongo/server/monitor/connection_spec.rb +31 -28
- data/spec/mongo/server/monitor_spec.rb +61 -32
- data/spec/mongo/server/round_trip_time_averager_spec.rb +43 -0
- data/spec/mongo/server_selector_spec.rb +106 -1
- data/spec/mongo/server_spec.rb +31 -12
- data/spec/mongo/session/session_pool_spec.rb +3 -1
- data/spec/mongo/session_spec.rb +64 -2
- data/spec/mongo/session_transaction_spec.rb +64 -0
- data/spec/mongo/socket/ssl_spec.rb +86 -10
- data/spec/mongo/uri/srv_protocol_spec.rb +40 -40
- data/spec/mongo/uri_spec.rb +74 -38
- data/spec/spec_helper.rb +39 -64
- data/spec/spec_tests/connection_string_spec.rb +4 -32
- data/spec/spec_tests/crud_spec.rb +12 -2
- data/spec/{support/change_streams_tests → spec_tests/data/change_streams}/change-streams-errors.yml +0 -0
- data/spec/{support/change_streams_tests → spec_tests/data/change_streams}/change-streams.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/bulkWrite.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/command.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/deleteMany.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/deleteOne.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/find.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/insertMany.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/insertOne.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/unacknowledgedBulkWrite.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/updateMany.yml +0 -0
- data/spec/{support → spec_tests/data}/command_monitoring/updateOne.yml +0 -0
- data/spec/{support/connection_string_tests → spec_tests/data/connection_string}/invalid-uris.yml +0 -0
- data/spec/{support/connection_string_tests → spec_tests/data/connection_string}/valid-auth.yml +0 -0
- data/spec/{support/connection_string_tests → spec_tests/data/connection_string}/valid-db-with-dotted-name.yml +0 -0
- data/spec/{support/connection_string_tests → spec_tests/data/connection_string}/valid-host_identifiers.yml +0 -0
- data/spec/{support/connection_string_tests → spec_tests/data/connection_string}/valid-options.yml +0 -0
- data/spec/{support/connection_string_tests → spec_tests/data/connection_string}/valid-unix_socket-absolute.yml +0 -0
- data/spec/{support/connection_string_tests → spec_tests/data/connection_string}/valid-unix_socket-relative.yml +0 -0
- data/spec/{support/connection_string_tests → spec_tests/data/connection_string}/valid-warnings.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/read/aggregate-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/read/aggregate-out.yml +6 -6
- data/spec/{support/crud_tests → spec_tests/data/crud}/read/aggregate.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/read/count-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/read/count.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/read/distinct-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/read/distinct.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/read/find-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/read/find.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/bulkWrite-arrayFilters.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/deleteMany-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/deleteMany.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/deleteOne-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/deleteOne.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/findOneAndDelete-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/findOneAndDelete.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/findOneAndReplace-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/findOneAndReplace-upsert.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/findOneAndReplace-upsert_pre_2.6.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/findOneAndReplace.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/findOneAndUpdate-arrayFilters.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/findOneAndUpdate-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/findOneAndUpdate.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/insertMany.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/insertOne.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/replaceOne-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/replaceOne-pre_2.6.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/replaceOne-upsert.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/replaceOne.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/updateMany-arrayFilters.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/updateMany-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/updateMany-pre_2.6.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/updateMany.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/updateOne-arrayFilters.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/updateOne-collation.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/updateOne-pre_2.6.yml +0 -0
- data/spec/{support/crud_tests → spec_tests/data/crud}/write/updateOne.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/longer-parent-in-return.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/misformatted-option.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/no-results.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/not-enough-parts.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/one-result-default-port.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/one-txt-record-multiple-strings.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/one-txt-record.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/parent-part-mismatch1.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/parent-part-mismatch2.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/parent-part-mismatch3.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/parent-part-mismatch4.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/parent-part-mismatch5.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/returned-parent-too-short.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/returned-parent-wrong.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/two-results-default-port.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/two-results-nonstandard-port.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/two-txt-records.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/txt-record-not-allowed-option.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/txt-record-with-overridden-ssl-option.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/txt-record-with-overridden-uri-option.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/txt-record-with-unallowed-option.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/uri-with-port.yml +0 -0
- data/spec/{support/dns_seedlist_discovery_tests → spec_tests/data/dns_seedlist_discovery}/uri-with-two-hosts.yml +0 -0
- data/spec/{support/gridfs_tests → spec_tests/data/gridfs}/delete.yml +0 -0
- data/spec/{support/gridfs_tests → spec_tests/data/gridfs}/download.yml +0 -0
- data/spec/{support/gridfs_tests → spec_tests/data/gridfs}/download_by_name.yml +0 -0
- data/spec/{support/gridfs_tests → spec_tests/data/gridfs}/upload.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/DefaultNoMaxStaleness.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/Incompatible.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/LastUpdateTime.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/Nearest.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/Nearest2.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/NoKnownServers.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred_tags.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/Secondary.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred_tags.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetNoPrimary/ZeroMaxStaleness.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/DefaultNoMaxStaleness.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/Incompatible.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/LastUpdateTime.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/LongHeartbeat.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/LongHeartbeat2.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/MaxStalenessTooSmall.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/MaxStalenessWithModePrimary.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/Nearest.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/Nearest2.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/Nearest_tags.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/PrimaryPreferred.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/PrimaryPreferred_incompatible.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags2.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/Secondary_tags.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/Secondary_tags2.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/ReplicaSetWithPrimary/ZeroMaxStaleness.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/Sharded/Incompatible.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/Sharded/SmallMaxStaleness.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/Single/Incompatible.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/Single/SmallMaxStaleness.yml +0 -0
- data/spec/{support → spec_tests/data}/max_staleness/Unknown/SmallMaxStaleness.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/bulkWrite-serverErrors.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/bulkWrite.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/deleteOne-serverErrors.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/deleteOne.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/findOneAndDelete-serverErrors.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/findOneAndDelete.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/findOneAndReplace-serverErrors.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/findOneAndReplace.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/findOneAndUpdate-serverErrors.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/findOneAndUpdate.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/insertMany-serverErrors.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/insertMany.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/insertOne-serverErrors.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/insertOne.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/replaceOne-serverErrors.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/replaceOne.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/updateOne-serverErrors.yml +0 -0
- data/spec/{support/retryable_writes_tests → spec_tests/data/retryable_writes}/updateOne.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/compatible.yml +0 -0
- data/spec/spec_tests/data/sdam/rs/compatible_unknown.yml +31 -0
- data/spec/{support → spec_tests/data}/sdam/rs/discover_arbiters.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/discover_passives.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/discover_primary.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/discover_secondary.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/discovery.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/equal_electionids.yml +2 -0
- data/spec/{support → spec_tests/data}/sdam/rs/ghost_discovered.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/hosts_differ_from_seeds.yml +0 -0
- data/spec/spec_tests/data/sdam/rs/incompatible_arbiter.yml +32 -0
- data/spec/spec_tests/data/sdam/rs/incompatible_ghost.yml +32 -0
- data/spec/spec_tests/data/sdam/rs/incompatible_other.yml +32 -0
- data/spec/{support → spec_tests/data}/sdam/rs/ls_timeout.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/member_reconfig.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/member_standalone.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/new_primary.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/new_primary_new_electionid.yml +6 -0
- data/spec/{support → spec_tests/data}/sdam/rs/new_primary_new_setversion.yml +6 -0
- data/spec/{support → spec_tests/data}/sdam/rs/new_primary_wrong_set_name.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/non_rs_member.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/normalize_case.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/normalize_case_me.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/null_election_id.yml +7 -0
- data/spec/spec_tests/data/sdam/rs/primary_becomes_ghost.yml +63 -0
- data/spec/spec_tests/data/sdam/rs/primary_becomes_mongos.yml +56 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_becomes_standalone.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_changes_set_name.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_disconnect.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_disconnect_electionid.yml +10 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_disconnect_setversion.yml +10 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_hint_from_secondary_with_mismatched_me.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_mismatched_me.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_reports_new_member.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_to_no_primary_mismatched_me.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/primary_wrong_set_name.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/response_from_removed.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/rsother_discovered.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/sec_not_auth.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/secondary_ignore_ok_0.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/secondary_mismatched_me.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/secondary_wrong_set_name.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/secondary_wrong_set_name_with_primary.yml +0 -0
- data/spec/spec_tests/data/sdam/rs/secondary_wrong_set_name_with_primary_second.yml +73 -0
- data/spec/{support → spec_tests/data}/sdam/rs/setversion_without_electionid.yml +2 -0
- data/spec/{support → spec_tests/data}/sdam/rs/stepdown_change_set_name.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/too_new.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/too_old.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/unexpected_mongos.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/rs/use_setversion_without_electionid.yml +6 -0
- data/spec/{support → spec_tests/data}/sdam/rs/wrong_set_name.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/sharded/compatible.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/sharded/ls_timeout_mongos.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/sharded/mongos_disconnect.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/sharded/multiple_mongoses.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/sharded/non_mongos_removed.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/sharded/normalize_uri_case.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/sharded/single_mongos.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/sharded/too_new.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/sharded/too_old.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/compatible.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/direct_connection_external_ip.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/direct_connection_mongos.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/direct_connection_rsarbiter.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/direct_connection_rsprimary.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/direct_connection_rssecondary.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/direct_connection_slave.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/direct_connection_standalone.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/ls_timeout_standalone.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/not_ok_response.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/standalone_removed.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/too_new.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/too_old.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam/single/unavailable_seed.yml +0 -0
- data/spec/spec_tests/data/sdam_monitoring/discovered_standalone.yml +72 -0
- data/spec/spec_tests/data/sdam_monitoring/replica_set_other_chain.yml +222 -0
- data/spec/spec_tests/data/sdam_monitoring/replica_set_other_change.yml +225 -0
- data/spec/spec_tests/data/sdam_monitoring/replica_set_other_seed.yml +233 -0
- data/spec/{support → spec_tests/data}/sdam_monitoring/replica_set_with_no_primary.yml +0 -0
- data/spec/{support → spec_tests/data}/sdam_monitoring/replica_set_with_primary.yml +0 -0
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary_and_secondary.yml +198 -0
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary_removal.yml +171 -0
- data/spec/{support → spec_tests/data}/sdam_monitoring/replica_set_with_removal.yml +0 -0
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_second_seed_removal.yml +106 -0
- data/spec/{support → spec_tests/data}/sdam_monitoring/required_replica_set.yml +23 -0
- data/spec/{support → spec_tests/data}/sdam_monitoring/standalone.yml +2 -2
- data/spec/spec_tests/data/sdam_monitoring/standalone_repeated.yml +86 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/Nearest.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/Nearest_multiple.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/Nearest_non_matching.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/PossiblePrimary.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/PossiblePrimaryNearest.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/Primary.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/PrimaryPreferred.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/PrimaryPreferred_non_matching.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/Secondary.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/SecondaryPreferred.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/SecondaryPreferred_non_matching.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/Secondary_multi_tags.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/Secondary_multi_tags2.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetNoPrimary/read/Secondary_non_matching.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/Nearest.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/Nearest_multiple.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/Nearest_non_matching.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/Primary.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/PrimaryPreferred.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/PrimaryPreferred_non_matching.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/Secondary.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/SecondaryPreferred.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/SecondaryPreferred_non_matching.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/SecondaryPreferred_tags.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/ReplicaSetWithPrimary/read/Secondary_non_matching.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/Sharded/read/Nearest.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/Sharded/read/Primary.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/Sharded/read/PrimaryPreferred.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/Sharded/read/Secondary.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/Sharded/read/SecondaryPreferred.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/Single/read/SecondaryPreferred.yml +0 -0
- data/spec/{support/server_selection/selection → spec_tests/data/server_selection}/Unknown/read/SecondaryPreferred.yml +0 -0
- data/spec/{support/server_selection/rtt → spec_tests/data/server_selection_rtt}/first_value.yml +0 -0
- data/spec/{support/server_selection/rtt → spec_tests/data/server_selection_rtt}/first_value_zero.yml +0 -0
- data/spec/{support/server_selection/rtt → spec_tests/data/server_selection_rtt}/value_test_1.yml +0 -0
- data/spec/{support/server_selection/rtt → spec_tests/data/server_selection_rtt}/value_test_2.yml +0 -0
- data/spec/{support/server_selection/rtt → spec_tests/data/server_selection_rtt}/value_test_3.yml +0 -0
- data/spec/{support/server_selection/rtt → spec_tests/data/server_selection_rtt}/value_test_4.yml +0 -0
- data/spec/{support/server_selection/rtt → spec_tests/data/server_selection_rtt}/value_test_5.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/abort.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/bulk.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/causal-consistency.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/commit.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/delete.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/error-labels.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/errors.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/findOneAndDelete.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/findOneAndReplace.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/findOneAndUpdate.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/insert.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/isolation.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/read-pref.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/reads.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/retryable-abort.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/retryable-commit.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/retryable-writes.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/run-command.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/transaction-options.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/update.yml +0 -0
- data/spec/{support/transactions_tests → spec_tests/data/transactions}/write-concern.yml +0 -0
- data/spec/spec_tests/data/transactions_api/callback-aborts.yml +156 -0
- data/spec/spec_tests/data/transactions_api/callback-commits.yml +192 -0
- data/spec/spec_tests/data/transactions_api/callback-retry.yml +203 -0
- data/spec/spec_tests/data/transactions_api/commit-retry.yml +261 -0
- data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror-4.2.yml +132 -0
- data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror.yml +178 -0
- data/spec/spec_tests/data/transactions_api/commit-writeconcernerror.yml +269 -0
- data/spec/spec_tests/data/transactions_api/commit.yml +181 -0
- data/spec/spec_tests/data/transactions_api/transaction-options.yml +258 -0
- data/spec/spec_tests/data/uri_options/auth-options.yml +14 -0
- data/spec/spec_tests/data/uri_options/compression-options.yml +48 -0
- data/spec/spec_tests/data/uri_options/concern-options.yml +55 -0
- data/spec/spec_tests/data/uri_options/connection-options.yml +106 -0
- data/spec/spec_tests/data/uri_options/connection-pool-options.yml +26 -0
- data/spec/spec_tests/data/uri_options/read-preference-options.yml +42 -0
- data/spec/spec_tests/data/uri_options/tls-options.yml +89 -0
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +0 -40
- data/spec/spec_tests/gridfs_spec.rb +1 -1
- data/spec/spec_tests/max_staleness_spec.rb +21 -8
- data/spec/spec_tests/retryable_writes_spec.rb +6 -6
- data/spec/spec_tests/sdam_monitoring_spec.rb +38 -20
- data/spec/spec_tests/sdam_spec.rb +80 -15
- data/spec/spec_tests/server_selection_rtt_spec.rb +6 -63
- data/spec/spec_tests/server_selection_spec.rb +18 -3
- data/spec/spec_tests/transactions_api_spec.rb +60 -0
- data/spec/spec_tests/transactions_spec.rb +20 -13
- data/spec/spec_tests/uri_options_spec.rb +94 -0
- data/spec/support/authorization.rb +28 -167
- data/spec/support/change_streams.rb +7 -7
- data/spec/support/change_streams/operation.rb +1 -1
- data/spec/support/client_registry.rb +170 -0
- data/spec/support/client_registry_macros.rb +14 -0
- data/spec/support/cluster_config.rb +49 -0
- data/spec/support/command_monitoring.rb +3 -3
- data/spec/support/common_shortcuts.rb +12 -0
- data/spec/support/connection_string.rb +99 -7
- data/spec/support/constraints.rb +24 -13
- data/spec/support/crud.rb +9 -97
- data/spec/support/crud/read.rb +2 -2
- data/spec/support/crud/verifier.rb +98 -0
- data/spec/support/crud/write.rb +2 -2
- data/spec/support/event_subscriber.rb +25 -13
- data/spec/support/gridfs.rb +8 -5
- data/spec/support/json_ext_formatter.rb +9 -0
- data/spec/support/lite_constraints.rb +27 -1
- data/spec/support/monitoring_ext.rb +16 -0
- data/spec/support/sdam_formatter_integration.rb +110 -0
- data/spec/support/sdam_monitoring.rb +77 -17
- data/spec/support/server_discovery_and_monitoring.rb +43 -20
- data/spec/support/server_selection.rb +3 -13
- data/spec/support/server_selection_rtt.rb +10 -10
- data/spec/support/shared/server_selector.rb +13 -41
- data/spec/support/shared/session.rb +44 -22
- data/spec/support/spec_config.rb +186 -11
- data/spec/support/spec_setup.rb +61 -0
- data/spec/support/transactions.rb +79 -145
- data/spec/support/transactions/operation.rb +53 -14
- data/spec/support/transactions/verifier.rb +94 -0
- metadata +712 -565
- metadata.gz.sig +0 -0
- data/lib/mongo/cluster/topology/replica_set.rb +0 -339
- data/lib/mongo/event/member_discovered.rb +0 -67
- data/lib/mongo/event/primary_elected.rb +0 -55
- data/lib/mongo/event/standalone_discovered.rb +0 -53
- data/lib/mongo/server/description/inspector.rb +0 -81
- data/lib/mongo/server/description/inspector/description_changed.rb +0 -57
- data/lib/mongo/server/description/inspector/member_discovered.rb +0 -59
- data/lib/mongo/server/description/inspector/primary_elected.rb +0 -60
- data/lib/mongo/server/description/inspector/standalone_discovered.rb +0 -56
- data/spec/mongo/server/description/inspector/description_changed_spec.rb +0 -78
- data/spec/mongo/server/description/inspector/primary_elected_spec.rb +0 -94
- data/spec/support/sdam/rs/set_version_without_electionid.yml +0 -69
- data/spec/support/travis.rb +0 -14
data/spec/mongo/server_spec.rb
CHANGED
@@ -2,14 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Mongo::Server do
|
4
4
|
|
5
|
-
|
6
|
-
double('topology')
|
7
|
-
end
|
5
|
+
declare_topology_double
|
8
6
|
|
9
7
|
let(:cluster) do
|
10
8
|
double('cluster').tap do |cl|
|
11
9
|
allow(cl).to receive(:topology).and_return(topology)
|
12
10
|
allow(cl).to receive(:app_metadata).and_return(app_metadata)
|
11
|
+
allow(cl).to receive(:options).and_return({})
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
@@ -32,7 +31,7 @@ describe Mongo::Server do
|
|
32
31
|
describe '#==' do
|
33
32
|
|
34
33
|
let(:server) do
|
35
|
-
described_class.new(address, cluster, monitoring, listeners,
|
34
|
+
described_class.new(address, cluster, monitoring, listeners, SpecConfig.instance.test_options)
|
36
35
|
end
|
37
36
|
|
38
37
|
after do
|
@@ -56,7 +55,7 @@ describe Mongo::Server do
|
|
56
55
|
context 'when the addresses match' do
|
57
56
|
|
58
57
|
let(:other) do
|
59
|
-
described_class.new(address, cluster, monitoring, listeners,
|
58
|
+
described_class.new(address, cluster, monitoring, listeners, SpecConfig.instance.test_options)
|
60
59
|
end
|
61
60
|
|
62
61
|
it 'returns true' do
|
@@ -71,7 +70,7 @@ describe Mongo::Server do
|
|
71
70
|
end
|
72
71
|
|
73
72
|
let(:other) do
|
74
|
-
described_class.new(other_address, cluster, monitoring, listeners,
|
73
|
+
described_class.new(other_address, cluster, monitoring, listeners, SpecConfig.instance.test_options)
|
75
74
|
end
|
76
75
|
|
77
76
|
it 'returns false' do
|
@@ -84,7 +83,7 @@ describe Mongo::Server do
|
|
84
83
|
describe '#disconnect!' do
|
85
84
|
|
86
85
|
let(:server) do
|
87
|
-
described_class.new(address, cluster, monitoring, listeners,
|
86
|
+
described_class.new(address, cluster, monitoring, listeners, SpecConfig.instance.test_options)
|
88
87
|
end
|
89
88
|
|
90
89
|
it 'stops the monitor instance' do
|
@@ -102,7 +101,7 @@ describe Mongo::Server do
|
|
102
101
|
cluster,
|
103
102
|
monitoring,
|
104
103
|
listeners,
|
105
|
-
|
104
|
+
SpecConfig.instance.test_options.merge(:heartbeat_frequency => 5)
|
106
105
|
)
|
107
106
|
end
|
108
107
|
|
@@ -120,14 +119,34 @@ describe Mongo::Server do
|
|
120
119
|
end
|
121
120
|
|
122
121
|
it 'sets the options' do
|
123
|
-
expect(server.options).to eq(
|
122
|
+
expect(server.options).to eq(SpecConfig.instance.test_options.merge(:heartbeat_frequency => 5))
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'creates monitor with monitoring app metadata' do
|
126
|
+
expect(server.monitor.options[:app_metadata]).to be_a(Mongo::Server::Monitor::AppMetadata)
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'monitoring_io: false' do
|
130
|
+
let(:server) do
|
131
|
+
described_class.new(
|
132
|
+
address,
|
133
|
+
cluster,
|
134
|
+
monitoring,
|
135
|
+
listeners,
|
136
|
+
SpecConfig.instance.test_options.merge(monitoring_io: false)
|
137
|
+
)
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'does not create monitoring thread' do
|
141
|
+
expect(server.monitor.instance_variable_get('@thread')).to be nil
|
142
|
+
end
|
124
143
|
end
|
125
144
|
end
|
126
145
|
|
127
146
|
describe '#scan!' do
|
128
147
|
|
129
148
|
let(:server) do
|
130
|
-
described_class.new(address, cluster, monitoring, listeners,
|
149
|
+
described_class.new(address, cluster, monitoring, listeners, SpecConfig.instance.test_options)
|
131
150
|
end
|
132
151
|
|
133
152
|
after do
|
@@ -143,7 +162,7 @@ describe Mongo::Server do
|
|
143
162
|
describe '#reconnect!' do
|
144
163
|
|
145
164
|
let(:server) do
|
146
|
-
described_class.new(address, cluster, monitoring, listeners,
|
165
|
+
described_class.new(address, cluster, monitoring, listeners, SpecConfig.instance.test_options)
|
147
166
|
end
|
148
167
|
|
149
168
|
before do
|
@@ -163,7 +182,7 @@ describe Mongo::Server do
|
|
163
182
|
describe 'retry_writes?' do
|
164
183
|
|
165
184
|
let(:server) do
|
166
|
-
described_class.new(address, cluster, monitoring, listeners,
|
185
|
+
described_class.new(address, cluster, monitoring, listeners, SpecConfig.instance.test_options)
|
167
186
|
end
|
168
187
|
|
169
188
|
before do
|
data/spec/mongo/session_spec.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Mongo::Session
|
3
|
+
describe Mongo::Session do
|
4
|
+
min_server_version '3.6'
|
5
|
+
require_topology :replica_set, :sharded
|
4
6
|
|
5
7
|
let(:session) do
|
6
8
|
authorized_client.start_session(options)
|
@@ -210,7 +212,7 @@ describe Mongo::Session, if: test_sessions? do
|
|
210
212
|
end
|
211
213
|
end
|
212
214
|
|
213
|
-
describe '#retry_writes?'
|
215
|
+
describe '#retry_writes?' do
|
214
216
|
|
215
217
|
context 'when the option is set to true' do
|
216
218
|
|
@@ -239,6 +241,7 @@ describe Mongo::Session, if: test_sessions? do
|
|
239
241
|
end
|
240
242
|
|
241
243
|
context 'when the option is not defined' do
|
244
|
+
require_no_retry_writes
|
242
245
|
|
243
246
|
let(:client) do
|
244
247
|
authorized_client
|
@@ -249,4 +252,63 @@ describe Mongo::Session, if: test_sessions? do
|
|
249
252
|
end
|
250
253
|
end
|
251
254
|
end
|
255
|
+
|
256
|
+
describe '#session_id' do
|
257
|
+
it 'returns a BSON::Document' do
|
258
|
+
expect(session.session_id).to be_a(BSON::Document)
|
259
|
+
end
|
260
|
+
|
261
|
+
context 'ended session' do
|
262
|
+
before do
|
263
|
+
session.end_session
|
264
|
+
end
|
265
|
+
|
266
|
+
it 'raises SessionEnded' do
|
267
|
+
expect do
|
268
|
+
session.session_id
|
269
|
+
end.to raise_error(Mongo::Error::SessionEnded)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
describe '#txn_num' do
|
275
|
+
it 'returns an integer' do
|
276
|
+
expect(session.txn_num).to be_a(Integer)
|
277
|
+
end
|
278
|
+
|
279
|
+
context 'ended session' do
|
280
|
+
before do
|
281
|
+
session.end_session
|
282
|
+
end
|
283
|
+
|
284
|
+
it 'raises SessionEnded' do
|
285
|
+
expect do
|
286
|
+
session.txn_num
|
287
|
+
end.to raise_error(Mongo::Error::SessionEnded)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
describe '#next_txn_num' do
|
293
|
+
it 'returns an integer' do
|
294
|
+
expect(session.next_txn_num).to be_a(Integer)
|
295
|
+
end
|
296
|
+
|
297
|
+
it 'increments transaction number on each call' do
|
298
|
+
expect(session.next_txn_num).to eq(1)
|
299
|
+
expect(session.next_txn_num).to eq(2)
|
300
|
+
end
|
301
|
+
|
302
|
+
context 'ended session' do
|
303
|
+
before do
|
304
|
+
session.end_session
|
305
|
+
end
|
306
|
+
|
307
|
+
it 'raises SessionEnded' do
|
308
|
+
expect do
|
309
|
+
session.next_txn_num
|
310
|
+
end.to raise_error(Mongo::Error::SessionEnded)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
252
314
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class SessionTransactionSpecError < StandardError; end
|
4
|
+
|
5
|
+
describe Mongo::Session do
|
6
|
+
min_server_version '4.0'
|
7
|
+
require_topology :replica_set, :sharded
|
8
|
+
|
9
|
+
let(:session) do
|
10
|
+
authorized_client.start_session(session_options)
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:session_options) do
|
14
|
+
{}
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:collection) do
|
18
|
+
authorized_client['session-transaction-test']
|
19
|
+
end
|
20
|
+
|
21
|
+
before do
|
22
|
+
collection.delete_many
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#with_transaction' do
|
26
|
+
context 'callback successful' do
|
27
|
+
it 'commits' do
|
28
|
+
session.with_transaction do
|
29
|
+
collection.insert_one(a: 1)
|
30
|
+
end
|
31
|
+
|
32
|
+
result = collection.find(a: 1).first
|
33
|
+
expect(result[:a]).to eq(1)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'propagates callback\'s return value' do
|
37
|
+
rv = session.with_transaction do
|
38
|
+
42
|
39
|
+
end
|
40
|
+
expect(rv).to eq(42)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'callback raises' do
|
45
|
+
it 'propagates the exception' do
|
46
|
+
expect do
|
47
|
+
session.with_transaction do
|
48
|
+
raise SessionTransactionSpecError, 'test error'
|
49
|
+
end
|
50
|
+
end.to raise_error(SessionTransactionSpecError, 'test error')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'callback aborts transaction' do
|
55
|
+
it 'does not raise exceptions and propagates callback\'s return value' do
|
56
|
+
rv = session.with_transaction do
|
57
|
+
session.abort_transaction
|
58
|
+
42
|
59
|
+
end
|
60
|
+
expect(rv).to eq(42)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Mongo::Socket::SSL
|
3
|
+
describe Mongo::Socket::SSL do
|
4
|
+
require_ssl
|
4
5
|
|
5
6
|
let(:address) do
|
6
7
|
default_address
|
7
8
|
end
|
8
9
|
|
9
10
|
let(:resolver) do
|
10
|
-
address.
|
11
|
+
address.send(:create_resolver, {})
|
11
12
|
end
|
12
13
|
|
13
14
|
let(:socket_timeout) do
|
@@ -19,15 +20,15 @@ describe Mongo::Socket::SSL, if: SpecConfig.instance.ssl? do
|
|
19
20
|
end
|
20
21
|
|
21
22
|
let(:options) do
|
22
|
-
|
23
|
+
SpecConfig.instance.ssl_options
|
23
24
|
end
|
24
25
|
|
25
26
|
let (:key_string) do
|
26
|
-
File.read(
|
27
|
+
File.read(SpecConfig.instance.client_key_pem)
|
27
28
|
end
|
28
29
|
|
29
30
|
let (:cert_string) do
|
30
|
-
File.read(
|
31
|
+
File.read(SpecConfig.instance.client_cert_pem)
|
31
32
|
end
|
32
33
|
|
33
34
|
let (:ca_cert_string) do
|
@@ -278,7 +279,49 @@ describe Mongo::Socket::SSL, if: SpecConfig.instance.ssl? do
|
|
278
279
|
end
|
279
280
|
end
|
280
281
|
|
281
|
-
context 'when
|
282
|
+
context 'when the hostname is incorrect' do
|
283
|
+
let(:host_name) do
|
284
|
+
'incorrect_hostname'
|
285
|
+
end
|
286
|
+
|
287
|
+
context 'when the hostname is verified' do
|
288
|
+
it 'raises an error' do
|
289
|
+
error = nil
|
290
|
+
begin
|
291
|
+
described_class.new(
|
292
|
+
address.host,
|
293
|
+
address.port,
|
294
|
+
host_name,
|
295
|
+
30,
|
296
|
+
::Socket::PF_INET,
|
297
|
+
options.merge(ssl_verify_hostname: true)
|
298
|
+
).connect!
|
299
|
+
rescue => e
|
300
|
+
error = e
|
301
|
+
end
|
302
|
+
|
303
|
+
expect(error).to be_a(Mongo::Error::SocketError)
|
304
|
+
expect(error.message).to eq('SSL handshake failed due to a hostname mismatch.')
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
context 'when the hostname is not verified' do
|
309
|
+
it 'raises an error' do
|
310
|
+
expect {
|
311
|
+
described_class.new(
|
312
|
+
address.host,
|
313
|
+
address.port,
|
314
|
+
host_name,
|
315
|
+
30,
|
316
|
+
::Socket::PF_INET,
|
317
|
+
options.merge(ssl_verify_hostname: false)
|
318
|
+
).connect!
|
319
|
+
}.not_to raise_error
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
context 'when ruby version is < 2.4.1', if: (RUBY_VERSION < '2.4.1') do
|
282
325
|
|
283
326
|
context 'when a key is passed, but it is not of the right type' do
|
284
327
|
|
@@ -302,7 +345,9 @@ describe Mongo::Socket::SSL, if: SpecConfig.instance.ssl? do
|
|
302
345
|
|
303
346
|
# Note that as of MRI 2.4, Creating a socket with the wrong key type raises
|
304
347
|
# a NoMethodError because #private? is attempted to be called on the key.
|
305
|
-
|
348
|
+
# In jruby 9.2 a TypeError is raised.
|
349
|
+
# In jruby 9.1 a OpenSSL::PKey::PKeyError is raised.
|
350
|
+
context 'when ruby version is >= 2.4.1', if: (RUBY_VERSION >= '2.4.1') do
|
306
351
|
|
307
352
|
context 'when a key is passed, but it is not of the right type' do
|
308
353
|
|
@@ -316,10 +361,24 @@ describe Mongo::Socket::SSL, if: SpecConfig.instance.ssl? do
|
|
316
361
|
}
|
317
362
|
end
|
318
363
|
|
364
|
+
let(:expected_exception) do
|
365
|
+
if SpecConfig.instance.jruby?
|
366
|
+
if RUBY_VERSION >= '2.5.0'
|
367
|
+
# jruby 9.2
|
368
|
+
TypeError
|
369
|
+
else
|
370
|
+
# jruby 9.1
|
371
|
+
OpenSSL::OpenSSLError
|
372
|
+
end
|
373
|
+
else
|
374
|
+
NoMethodError
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
319
378
|
it 'raises a NoMethodError' do
|
320
379
|
expect{
|
321
380
|
socket.connect!
|
322
|
-
}.to raise_exception(
|
381
|
+
}.to raise_exception(expected_exception)
|
323
382
|
end
|
324
383
|
end
|
325
384
|
end
|
@@ -332,10 +391,27 @@ describe Mongo::Socket::SSL, if: SpecConfig.instance.ssl? do
|
|
332
391
|
)
|
333
392
|
end
|
334
393
|
|
394
|
+
let(:expected_exception) do
|
395
|
+
if SpecConfig.instance.jruby?
|
396
|
+
# java.lang.ClassCastException: org.bouncycastle.asn1.DERApplicationSpecific cannot be cast to org.bouncycastle.asn1.ASN1Sequence
|
397
|
+
# https://github.com/jruby/jruby-openssl/issues/171
|
398
|
+
Exception
|
399
|
+
else
|
400
|
+
# mri
|
401
|
+
if RUBY_VERSION >= '2.4.0'
|
402
|
+
# OpenSSL::PKey::PKeyError: Could not parse PKey: no start line
|
403
|
+
OpenSSL::OpenSSLError
|
404
|
+
else
|
405
|
+
# ArgumentError: Could not parse PKey: no start line
|
406
|
+
ArgumentError
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
335
411
|
it 'raises an exception' do
|
336
412
|
expect {
|
337
413
|
socket.connect!
|
338
|
-
}.to raise_exception
|
414
|
+
}.to raise_exception(expected_exception)
|
339
415
|
end
|
340
416
|
end
|
341
417
|
|
@@ -464,7 +540,7 @@ describe Mongo::Socket::SSL, if: SpecConfig.instance.ssl? do
|
|
464
540
|
end
|
465
541
|
|
466
542
|
before do
|
467
|
-
ENV['SSL_CERT_FILE']= CA_PEM
|
543
|
+
ENV['SSL_CERT_FILE'] = CA_PEM
|
468
544
|
socket.connect!
|
469
545
|
end
|
470
546
|
|
@@ -256,7 +256,7 @@ describe Mongo::URI::SRVProtocol do
|
|
256
256
|
|
257
257
|
describe '#client_options' do
|
258
258
|
|
259
|
-
let(:db) {
|
259
|
+
let(:db) { SpecConfig.instance.test_db }
|
260
260
|
let(:servers) { 'test5.test.build.10gen.cc' }
|
261
261
|
let(:string) { "#{scheme}#{credentials}@#{servers}/#{db}" }
|
262
262
|
let(:user) { 'tyler' }
|
@@ -268,7 +268,7 @@ describe Mongo::URI::SRVProtocol do
|
|
268
268
|
end
|
269
269
|
|
270
270
|
it 'includes the database in the options' do
|
271
|
-
expect(options[:database]).to eq(
|
271
|
+
expect(options[:database]).to eq(SpecConfig.instance.test_db)
|
272
272
|
end
|
273
273
|
|
274
274
|
it 'includes the user in the options' do
|
@@ -346,7 +346,7 @@ describe Mongo::URI::SRVProtocol do
|
|
346
346
|
end
|
347
347
|
|
348
348
|
it 'sets the options on a client created with the uri' do
|
349
|
-
expect(
|
349
|
+
expect(new_local_client(string).options[:write]).to eq(concern)
|
350
350
|
end
|
351
351
|
end
|
352
352
|
|
@@ -359,7 +359,7 @@ describe Mongo::URI::SRVProtocol do
|
|
359
359
|
end
|
360
360
|
|
361
361
|
it 'sets the options on a client created with the uri' do
|
362
|
-
expect(
|
362
|
+
expect(new_local_client(string).options[:write]).to eq(concern)
|
363
363
|
end
|
364
364
|
end
|
365
365
|
|
@@ -372,7 +372,7 @@ describe Mongo::URI::SRVProtocol do
|
|
372
372
|
end
|
373
373
|
|
374
374
|
it 'sets the options on a client created with the uri' do
|
375
|
-
expect(
|
375
|
+
expect(new_local_client(string).options[:write]).to eq(concern)
|
376
376
|
end
|
377
377
|
end
|
378
378
|
|
@@ -385,7 +385,7 @@ describe Mongo::URI::SRVProtocol do
|
|
385
385
|
end
|
386
386
|
|
387
387
|
it 'sets the options on a client created with the uri' do
|
388
|
-
expect(
|
388
|
+
expect(new_local_client(string).options[:write]).to eq(concern)
|
389
389
|
end
|
390
390
|
end
|
391
391
|
|
@@ -399,7 +399,7 @@ describe Mongo::URI::SRVProtocol do
|
|
399
399
|
end
|
400
400
|
|
401
401
|
it 'sets the options on a client created with the uri' do
|
402
|
-
expect(
|
402
|
+
expect(new_local_client(string).options[:write]).to eq(concern)
|
403
403
|
end
|
404
404
|
end
|
405
405
|
end
|
@@ -416,7 +416,7 @@ describe Mongo::URI::SRVProtocol do
|
|
416
416
|
end
|
417
417
|
|
418
418
|
it 'sets the options on a client created with the uri' do
|
419
|
-
expect(
|
419
|
+
expect(new_local_client(string).options[:read]).to eq(read)
|
420
420
|
end
|
421
421
|
end
|
422
422
|
|
@@ -429,7 +429,7 @@ describe Mongo::URI::SRVProtocol do
|
|
429
429
|
end
|
430
430
|
|
431
431
|
it 'sets the options on a client created with the uri' do
|
432
|
-
expect(
|
432
|
+
expect(new_local_client(string).options[:read]).to eq(read)
|
433
433
|
end
|
434
434
|
end
|
435
435
|
|
@@ -442,7 +442,7 @@ describe Mongo::URI::SRVProtocol do
|
|
442
442
|
end
|
443
443
|
|
444
444
|
it 'sets the options on a client created with the uri' do
|
445
|
-
expect(
|
445
|
+
expect(new_local_client(string).options[:read]).to eq(read)
|
446
446
|
end
|
447
447
|
end
|
448
448
|
|
@@ -455,7 +455,7 @@ describe Mongo::URI::SRVProtocol do
|
|
455
455
|
end
|
456
456
|
|
457
457
|
it 'sets the options on a client created with the uri' do
|
458
|
-
expect(
|
458
|
+
expect(new_local_client(string).options[:read]).to eq(read)
|
459
459
|
end
|
460
460
|
end
|
461
461
|
|
@@ -468,7 +468,7 @@ describe Mongo::URI::SRVProtocol do
|
|
468
468
|
end
|
469
469
|
|
470
470
|
it 'sets the options on a client created with the uri' do
|
471
|
-
expect(
|
471
|
+
expect(new_local_client(string).options[:read]).to eq(read)
|
472
472
|
end
|
473
473
|
end
|
474
474
|
end
|
@@ -489,7 +489,7 @@ describe Mongo::URI::SRVProtocol do
|
|
489
489
|
end
|
490
490
|
|
491
491
|
it 'sets the options on a client created with the uri' do
|
492
|
-
expect(
|
492
|
+
expect(new_local_client(string).options[:read]).to eq(read)
|
493
493
|
end
|
494
494
|
end
|
495
495
|
|
@@ -507,7 +507,7 @@ describe Mongo::URI::SRVProtocol do
|
|
507
507
|
end
|
508
508
|
|
509
509
|
it 'sets the options on a client created with the uri' do
|
510
|
-
expect(
|
510
|
+
expect(new_local_client(string).options[:read]).to eq(read)
|
511
511
|
end
|
512
512
|
end
|
513
513
|
end
|
@@ -527,7 +527,7 @@ describe Mongo::URI::SRVProtocol do
|
|
527
527
|
end
|
528
528
|
|
529
529
|
it 'sets the options on a client created with the uri' do
|
530
|
-
expect(
|
530
|
+
expect(new_local_client(string).options[:read]).to eq(read)
|
531
531
|
end
|
532
532
|
|
533
533
|
context 'when the read preference and max staleness combination is invalid' do
|
@@ -540,7 +540,7 @@ describe Mongo::URI::SRVProtocol do
|
|
540
540
|
|
541
541
|
it 'raises an exception when read preference is accessed on the client' do
|
542
542
|
expect {
|
543
|
-
|
543
|
+
new_local_client(string).server_selector
|
544
544
|
}.to raise_exception(Mongo::Error::InvalidServerPreference)
|
545
545
|
end
|
546
546
|
end
|
@@ -552,7 +552,7 @@ describe Mongo::URI::SRVProtocol do
|
|
552
552
|
end
|
553
553
|
|
554
554
|
it 'does not raise an exception until the read preference is used' do
|
555
|
-
expect(
|
555
|
+
expect(new_local_client(string).read_preference).to eq(BSON::Document.new(mode: :secondary, max_staleness: 89))
|
556
556
|
end
|
557
557
|
end
|
558
558
|
end
|
@@ -567,7 +567,7 @@ describe Mongo::URI::SRVProtocol do
|
|
567
567
|
end
|
568
568
|
|
569
569
|
it 'sets the options on a client created with the uri' do
|
570
|
-
expect(
|
570
|
+
expect(new_local_client(string).options[:replica_set]).to eq(rs_name)
|
571
571
|
end
|
572
572
|
end
|
573
573
|
|
@@ -583,11 +583,11 @@ describe Mongo::URI::SRVProtocol do
|
|
583
583
|
end
|
584
584
|
|
585
585
|
it 'sets the options on a client created with the uri' do
|
586
|
-
expect(
|
586
|
+
expect(new_local_client(string).options[:auth_mech]).to eq(expected)
|
587
587
|
end
|
588
588
|
|
589
589
|
it 'is case-insensitive' do
|
590
|
-
expect(
|
590
|
+
expect(new_local_client(string.downcase).options[:auth_mech]).to eq(expected)
|
591
591
|
end
|
592
592
|
end
|
593
593
|
|
@@ -600,11 +600,11 @@ describe Mongo::URI::SRVProtocol do
|
|
600
600
|
end
|
601
601
|
|
602
602
|
it 'sets the options on a client created with the uri' do
|
603
|
-
expect(
|
603
|
+
expect(new_local_client(string).options[:auth_mech]).to eq(expected)
|
604
604
|
end
|
605
605
|
|
606
606
|
it 'is case-insensitive' do
|
607
|
-
expect(
|
607
|
+
expect(new_local_client(string.downcase).options[:auth_mech]).to eq(expected)
|
608
608
|
end
|
609
609
|
end
|
610
610
|
|
@@ -617,11 +617,11 @@ describe Mongo::URI::SRVProtocol do
|
|
617
617
|
end
|
618
618
|
|
619
619
|
it 'sets the options on a client created with the uri' do
|
620
|
-
expect(
|
620
|
+
expect(new_local_client(string).options[:auth_mech]).to eq(expected)
|
621
621
|
end
|
622
622
|
|
623
623
|
it 'is case-insensitive' do
|
624
|
-
expect(
|
624
|
+
expect(new_local_client(string.downcase).options[:auth_mech]).to eq(expected)
|
625
625
|
end
|
626
626
|
end
|
627
627
|
|
@@ -634,11 +634,11 @@ describe Mongo::URI::SRVProtocol do
|
|
634
634
|
end
|
635
635
|
|
636
636
|
it 'sets the options on a client created with the uri' do
|
637
|
-
expect(
|
637
|
+
expect(new_local_client(string).options[:auth_mech]).to eq(expected)
|
638
638
|
end
|
639
639
|
|
640
640
|
it 'is case-insensitive' do
|
641
|
-
expect(
|
641
|
+
expect(new_local_client(string.downcase).options[:auth_mech]).to eq(expected)
|
642
642
|
end
|
643
643
|
end
|
644
644
|
|
@@ -651,18 +651,18 @@ describe Mongo::URI::SRVProtocol do
|
|
651
651
|
end
|
652
652
|
|
653
653
|
it 'sets the options on a client created with the uri' do
|
654
|
-
expect(
|
654
|
+
expect(new_local_client(string).options[:auth_mech]).to eq(expected)
|
655
655
|
end
|
656
656
|
|
657
657
|
it 'is case-insensitive' do
|
658
|
-
expect(
|
658
|
+
expect(new_local_client(string.downcase).options[:auth_mech]).to eq(expected)
|
659
659
|
end
|
660
660
|
|
661
661
|
context 'when a username is not provided' do
|
662
662
|
|
663
663
|
it 'recognizes the mechanism with no username' do
|
664
|
-
expect(
|
665
|
-
expect(
|
664
|
+
expect(new_local_client(string.downcase).options[:auth_mech]).to eq(expected)
|
665
|
+
expect(new_local_client(string.downcase).options[:user]).to be_nil
|
666
666
|
end
|
667
667
|
end
|
668
668
|
end
|
@@ -679,7 +679,7 @@ describe Mongo::URI::SRVProtocol do
|
|
679
679
|
end
|
680
680
|
|
681
681
|
it 'sets the options on a client created with the uri' do
|
682
|
-
expect(
|
682
|
+
expect(new_local_client(string).options[:auth_source]).to eq(source)
|
683
683
|
end
|
684
684
|
end
|
685
685
|
|
@@ -692,7 +692,7 @@ describe Mongo::URI::SRVProtocol do
|
|
692
692
|
end
|
693
693
|
|
694
694
|
it 'sets the options on a client created with the uri' do
|
695
|
-
expect(
|
695
|
+
expect(new_local_client(string).options[:auth_source]).to eq(expected)
|
696
696
|
end
|
697
697
|
end
|
698
698
|
end
|
@@ -712,7 +712,7 @@ describe Mongo::URI::SRVProtocol do
|
|
712
712
|
end
|
713
713
|
|
714
714
|
it 'sets the options on a client created with the uri' do
|
715
|
-
expect(
|
715
|
+
expect(new_local_client(string).options[:auth_mech_properties]).to eq(expected)
|
716
716
|
end
|
717
717
|
end
|
718
718
|
|
@@ -728,7 +728,7 @@ describe Mongo::URI::SRVProtocol do
|
|
728
728
|
end
|
729
729
|
|
730
730
|
it 'sets the options on a client created with the uri' do
|
731
|
-
expect(
|
731
|
+
expect(new_local_client(string).options[:auth_mech_properties]).to eq(expected)
|
732
732
|
end
|
733
733
|
end
|
734
734
|
|
@@ -746,7 +746,7 @@ describe Mongo::URI::SRVProtocol do
|
|
746
746
|
end
|
747
747
|
|
748
748
|
it 'sets the options on a client created with the uri' do
|
749
|
-
expect(
|
749
|
+
expect(new_local_client(string).options[:auth_mech_properties]).to eq(expected)
|
750
750
|
end
|
751
751
|
end
|
752
752
|
|
@@ -772,7 +772,7 @@ describe Mongo::URI::SRVProtocol do
|
|
772
772
|
end
|
773
773
|
|
774
774
|
it 'sets the options on a client created with the uri' do
|
775
|
-
expect(
|
775
|
+
expect(new_local_client(string).options[:auth_mech_properties]).to eq(expected)
|
776
776
|
end
|
777
777
|
end
|
778
778
|
end
|
@@ -900,7 +900,7 @@ describe Mongo::URI::SRVProtocol do
|
|
900
900
|
let(:options) { "appname=srv_test" }
|
901
901
|
|
902
902
|
it 'sets the app name on the client' do
|
903
|
-
expect(
|
903
|
+
expect(new_local_client(string).options[:app_name]).to eq(:srv_test)
|
904
904
|
end
|
905
905
|
end
|
906
906
|
|
@@ -908,7 +908,7 @@ describe Mongo::URI::SRVProtocol do
|
|
908
908
|
let(:options) { "compressors=zlib" }
|
909
909
|
|
910
910
|
it 'sets the compressors as an array on the client' do
|
911
|
-
expect(
|
911
|
+
expect(new_local_client(string).options[:compressors]).to eq(['zlib'])
|
912
912
|
end
|
913
913
|
end
|
914
914
|
|
@@ -916,7 +916,7 @@ describe Mongo::URI::SRVProtocol do
|
|
916
916
|
let(:options) { "compressors=snoopy" }
|
917
917
|
|
918
918
|
let(:client) do
|
919
|
-
|
919
|
+
new_local_client(string)
|
920
920
|
end
|
921
921
|
|
922
922
|
it 'sets no compressors on the client and warns' do
|
@@ -929,7 +929,7 @@ describe Mongo::URI::SRVProtocol do
|
|
929
929
|
let(:options) { "zlibCompressionLevel=6" }
|
930
930
|
|
931
931
|
it 'sets the zlib compression level on the client' do
|
932
|
-
expect(
|
932
|
+
expect(new_local_client(string).options[:zlib_compression_level]).to eq(6)
|
933
933
|
end
|
934
934
|
end
|
935
935
|
end
|