mongo 2.15.0.alpha → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -1
- data.tar.gz.sig +0 -0
- data/README.md +1 -1
- data/lib/mongo.rb +3 -0
- data/lib/mongo/active_support.rb +3 -0
- data/lib/mongo/address.rb +3 -0
- data/lib/mongo/address/ipv4.rb +3 -0
- data/lib/mongo/address/ipv6.rb +3 -0
- data/lib/mongo/address/unix.rb +3 -0
- data/lib/mongo/address/validator.rb +3 -0
- data/lib/mongo/auth.rb +4 -1
- data/lib/mongo/auth/aws.rb +3 -0
- data/lib/mongo/auth/aws/conversation.rb +3 -0
- data/lib/mongo/auth/aws/credentials_retriever.rb +3 -0
- data/lib/mongo/auth/aws/request.rb +3 -0
- data/lib/mongo/auth/base.rb +4 -1
- data/lib/mongo/auth/conversation_base.rb +3 -0
- data/lib/mongo/auth/cr.rb +3 -0
- data/lib/mongo/auth/cr/conversation.rb +3 -0
- data/lib/mongo/auth/credential_cache.rb +3 -0
- data/lib/mongo/auth/gssapi.rb +3 -0
- data/lib/mongo/auth/gssapi/conversation.rb +3 -0
- data/lib/mongo/auth/ldap.rb +3 -0
- data/lib/mongo/auth/ldap/conversation.rb +3 -0
- data/lib/mongo/auth/roles.rb +3 -0
- data/lib/mongo/auth/sasl_conversation_base.rb +3 -0
- data/lib/mongo/auth/scram.rb +5 -2
- data/lib/mongo/auth/scram/conversation.rb +3 -0
- data/lib/mongo/auth/scram256.rb +3 -0
- data/lib/mongo/auth/scram256/conversation.rb +3 -0
- data/lib/mongo/auth/scram_conversation_base.rb +3 -0
- data/lib/mongo/auth/stringprep.rb +4 -1
- data/lib/mongo/auth/stringprep/profiles/sasl.rb +3 -0
- data/lib/mongo/auth/stringprep/tables.rb +3 -0
- data/lib/mongo/auth/stringprep/unicode_normalize/normalize.rb +2 -2
- data/lib/mongo/auth/stringprep/unicode_normalize/tables.rb +1 -1
- data/lib/mongo/auth/user.rb +3 -0
- data/lib/mongo/auth/user/view.rb +3 -0
- data/lib/mongo/auth/x509.rb +3 -0
- data/lib/mongo/auth/x509/conversation.rb +3 -0
- data/lib/mongo/background_thread.rb +5 -2
- data/lib/mongo/bson.rb +3 -0
- data/lib/mongo/bulk_write.rb +3 -0
- data/lib/mongo/bulk_write/combineable.rb +3 -0
- data/lib/mongo/bulk_write/ordered_combiner.rb +3 -0
- data/lib/mongo/bulk_write/result.rb +3 -0
- data/lib/mongo/bulk_write/result_combiner.rb +3 -0
- data/lib/mongo/bulk_write/transformable.rb +3 -0
- data/lib/mongo/bulk_write/unordered_combiner.rb +3 -0
- data/lib/mongo/bulk_write/validatable.rb +3 -0
- data/lib/mongo/caching_cursor.rb +3 -0
- data/lib/mongo/client.rb +4 -1
- data/lib/mongo/client_encryption.rb +3 -0
- data/lib/mongo/cluster.rb +10 -7
- data/lib/mongo/cluster/periodic_executor.rb +3 -0
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +3 -0
- data/lib/mongo/cluster/reapers/socket_reaper.rb +3 -0
- data/lib/mongo/cluster/sdam_flow.rb +3 -0
- data/lib/mongo/cluster/topology.rb +3 -0
- data/lib/mongo/cluster/topology/base.rb +3 -0
- data/lib/mongo/cluster/topology/no_replica_set_options.rb +3 -0
- data/lib/mongo/cluster/topology/replica_set_no_primary.rb +3 -0
- data/lib/mongo/cluster/topology/replica_set_with_primary.rb +3 -0
- data/lib/mongo/cluster/topology/sharded.rb +3 -0
- data/lib/mongo/cluster/topology/single.rb +3 -0
- data/lib/mongo/cluster/topology/unknown.rb +3 -0
- data/lib/mongo/cluster_time.rb +3 -0
- data/lib/mongo/collection.rb +35 -11
- data/lib/mongo/collection/view.rb +3 -0
- data/lib/mongo/collection/view/aggregation.rb +3 -0
- data/lib/mongo/collection/view/builder.rb +3 -0
- data/lib/mongo/collection/view/builder/aggregation.rb +3 -0
- data/lib/mongo/collection/view/builder/find_command.rb +3 -0
- data/lib/mongo/collection/view/builder/flags.rb +3 -0
- data/lib/mongo/collection/view/builder/map_reduce.rb +3 -0
- data/lib/mongo/collection/view/builder/modifiers.rb +3 -0
- data/lib/mongo/collection/view/builder/op_query.rb +3 -0
- data/lib/mongo/collection/view/change_stream.rb +4 -1
- data/lib/mongo/collection/view/change_stream/retryable.rb +3 -0
- data/lib/mongo/collection/view/explainable.rb +3 -0
- data/lib/mongo/collection/view/immutable.rb +3 -0
- data/lib/mongo/collection/view/iterable.rb +3 -0
- data/lib/mongo/collection/view/map_reduce.rb +3 -0
- data/lib/mongo/collection/view/readable.rb +11 -2
- data/lib/mongo/collection/view/writable.rb +3 -0
- data/lib/mongo/crypt.rb +3 -0
- data/lib/mongo/crypt/auto_decryption_context.rb +3 -0
- data/lib/mongo/crypt/auto_encrypter.rb +4 -1
- data/lib/mongo/crypt/auto_encryption_context.rb +3 -0
- data/lib/mongo/crypt/binary.rb +3 -0
- data/lib/mongo/crypt/binding.rb +4 -1
- data/lib/mongo/crypt/context.rb +3 -0
- data/lib/mongo/crypt/data_key_context.rb +3 -0
- data/lib/mongo/crypt/encryption_io.rb +3 -0
- data/lib/mongo/crypt/explicit_decryption_context.rb +3 -0
- data/lib/mongo/crypt/explicit_encrypter.rb +3 -0
- data/lib/mongo/crypt/explicit_encryption_context.rb +3 -0
- data/lib/mongo/crypt/handle.rb +3 -0
- data/lib/mongo/crypt/hooks.rb +3 -0
- data/lib/mongo/crypt/kms_context.rb +3 -0
- data/lib/mongo/crypt/status.rb +3 -0
- data/lib/mongo/cursor.rb +4 -0
- data/lib/mongo/cursor/builder.rb +3 -0
- data/lib/mongo/cursor/builder/get_more_command.rb +3 -0
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +3 -0
- data/lib/mongo/cursor/builder/op_get_more.rb +3 -0
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +3 -0
- data/lib/mongo/database.rb +4 -1
- data/lib/mongo/database/view.rb +3 -0
- data/lib/mongo/dbref.rb +3 -0
- data/lib/mongo/distinguishing_semaphore.rb +3 -0
- data/lib/mongo/error.rb +3 -0
- data/lib/mongo/error/auth_error.rb +3 -0
- data/lib/mongo/error/bulk_write_error.rb +3 -0
- data/lib/mongo/error/change_stream_resumable.rb +3 -0
- data/lib/mongo/error/closed_stream.rb +3 -0
- data/lib/mongo/error/connection_check_out_timeout.rb +3 -0
- data/lib/mongo/error/connection_perished.rb +3 -0
- data/lib/mongo/error/credential_check_error.rb +3 -0
- data/lib/mongo/error/crypt_error.rb +3 -0
- data/lib/mongo/error/extra_file_chunk.rb +3 -0
- data/lib/mongo/error/failed_string_prep_validation.rb +3 -0
- data/lib/mongo/error/file_not_found.rb +3 -0
- data/lib/mongo/error/handshake_error.rb +3 -0
- data/lib/mongo/error/insufficient_iteration_count.rb +3 -0
- data/lib/mongo/error/internal_driver_error.rb +3 -0
- data/lib/mongo/error/invalid_address.rb +3 -0
- data/lib/mongo/error/invalid_application_name.rb +3 -0
- data/lib/mongo/error/invalid_bulk_operation.rb +3 -0
- data/lib/mongo/error/invalid_bulk_operation_type.rb +3 -0
- data/lib/mongo/error/invalid_collection_name.rb +3 -0
- data/lib/mongo/error/invalid_cursor_operation.rb +3 -0
- data/lib/mongo/error/invalid_database_name.rb +3 -0
- data/lib/mongo/error/invalid_document.rb +3 -0
- data/lib/mongo/error/invalid_file.rb +3 -0
- data/lib/mongo/error/invalid_file_revision.rb +3 -0
- data/lib/mongo/error/invalid_min_pool_size.rb +3 -0
- data/lib/mongo/error/invalid_nonce.rb +3 -0
- data/lib/mongo/error/invalid_read_concern.rb +3 -0
- data/lib/mongo/error/invalid_read_option.rb +3 -0
- data/lib/mongo/error/invalid_replacement_document.rb +3 -0
- data/lib/mongo/error/invalid_server_auth_host.rb +3 -0
- data/lib/mongo/error/invalid_server_auth_response.rb +3 -0
- data/lib/mongo/error/invalid_server_preference.rb +3 -0
- data/lib/mongo/error/invalid_session.rb +3 -0
- data/lib/mongo/error/invalid_signature.rb +3 -0
- data/lib/mongo/error/invalid_transaction_operation.rb +3 -0
- data/lib/mongo/error/invalid_txt_record.rb +3 -0
- data/lib/mongo/error/invalid_update_document.rb +3 -0
- data/lib/mongo/error/invalid_uri.rb +3 -0
- data/lib/mongo/error/invalid_write_concern.rb +3 -0
- data/lib/mongo/error/kms_error.rb +3 -0
- data/lib/mongo/error/lint_error.rb +3 -0
- data/lib/mongo/error/max_bson_size.rb +3 -0
- data/lib/mongo/error/max_message_size.rb +3 -0
- data/lib/mongo/error/mismatched_domain.rb +3 -0
- data/lib/mongo/error/missing_file_chunk.rb +3 -0
- data/lib/mongo/error/missing_password.rb +3 -0
- data/lib/mongo/error/missing_resume_token.rb +3 -0
- data/lib/mongo/error/missing_scram_server_signature.rb +3 -0
- data/lib/mongo/error/mongocryptd_spawn_error.rb +3 -0
- data/lib/mongo/error/multi_index_drop.rb +3 -0
- data/lib/mongo/error/need_primary_server.rb +3 -0
- data/lib/mongo/error/no_server_available.rb +3 -0
- data/lib/mongo/error/no_srv_records.rb +3 -0
- data/lib/mongo/error/notable.rb +3 -0
- data/lib/mongo/error/operation_failure.rb +5 -2
- data/lib/mongo/error/parser.rb +4 -1
- data/lib/mongo/error/pool_closed_error.rb +3 -0
- data/lib/mongo/error/raise_original_error.rb +3 -0
- data/lib/mongo/error/sdam_error_detection.rb +16 -5
- data/lib/mongo/error/server_api_conflict.rb +3 -0
- data/lib/mongo/error/server_api_not_supported.rb +3 -0
- data/lib/mongo/error/server_certificate_revoked.rb +3 -0
- data/lib/mongo/error/session_ended.rb +3 -0
- data/lib/mongo/error/sessions_not_supported.rb +3 -0
- data/lib/mongo/error/socket_error.rb +3 -0
- data/lib/mongo/error/socket_timeout_error.rb +3 -0
- data/lib/mongo/error/unchangeable_collection_option.rb +3 -0
- data/lib/mongo/error/unexpected_chunk_length.rb +3 -0
- data/lib/mongo/error/unexpected_response.rb +3 -0
- data/lib/mongo/error/unknown_payload_type.rb +3 -0
- data/lib/mongo/error/unmet_dependency.rb +3 -0
- data/lib/mongo/error/unsupported_array_filters.rb +3 -0
- data/lib/mongo/error/unsupported_collation.rb +3 -0
- data/lib/mongo/error/unsupported_features.rb +3 -0
- data/lib/mongo/error/unsupported_message_type.rb +3 -0
- data/lib/mongo/error/unsupported_option.rb +3 -0
- data/lib/mongo/error/write_retryable.rb +3 -0
- data/lib/mongo/event.rb +3 -0
- data/lib/mongo/event/base.rb +3 -0
- data/lib/mongo/event/listeners.rb +3 -0
- data/lib/mongo/event/publisher.rb +3 -0
- data/lib/mongo/event/subscriber.rb +3 -0
- data/lib/mongo/grid.rb +3 -0
- data/lib/mongo/grid/file.rb +3 -0
- data/lib/mongo/grid/file/chunk.rb +4 -1
- data/lib/mongo/grid/file/info.rb +3 -0
- data/lib/mongo/grid/fs_bucket.rb +29 -8
- data/lib/mongo/grid/stream.rb +3 -0
- data/lib/mongo/grid/stream/read.rb +22 -7
- data/lib/mongo/grid/stream/write.rb +3 -0
- data/lib/mongo/id.rb +3 -0
- data/lib/mongo/index.rb +3 -0
- data/lib/mongo/index/view.rb +3 -0
- data/lib/mongo/lint.rb +3 -0
- data/lib/mongo/loggable.rb +3 -0
- data/lib/mongo/logger.rb +3 -0
- data/lib/mongo/monitoring.rb +9 -6
- data/lib/mongo/monitoring/cmap_log_subscriber.rb +3 -0
- data/lib/mongo/monitoring/command_log_subscriber.rb +3 -0
- data/lib/mongo/monitoring/event.rb +3 -0
- data/lib/mongo/monitoring/event/cmap.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/base.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/connection_checked_in.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/connection_checked_out.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/connection_closed.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/connection_created.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/connection_ready.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/pool_cleared.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/pool_closed.rb +3 -0
- data/lib/mongo/monitoring/event/cmap/pool_created.rb +3 -0
- data/lib/mongo/monitoring/event/command_failed.rb +32 -5
- data/lib/mongo/monitoring/event/command_started.rb +20 -2
- data/lib/mongo/monitoring/event/command_succeeded.rb +29 -3
- data/lib/mongo/monitoring/event/secure.rb +39 -5
- data/lib/mongo/monitoring/event/server_closed.rb +3 -0
- data/lib/mongo/monitoring/event/server_description_changed.rb +4 -1
- data/lib/mongo/monitoring/event/server_heartbeat_failed.rb +6 -3
- data/lib/mongo/monitoring/event/server_heartbeat_started.rb +3 -0
- data/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb +5 -2
- data/lib/mongo/monitoring/event/server_opening.rb +3 -0
- data/lib/mongo/monitoring/event/topology_changed.rb +3 -0
- data/lib/mongo/monitoring/event/topology_closed.rb +3 -0
- data/lib/mongo/monitoring/event/topology_opening.rb +3 -0
- data/lib/mongo/monitoring/publishable.rb +32 -10
- data/lib/mongo/monitoring/sdam_log_subscriber.rb +3 -0
- data/lib/mongo/monitoring/server_closed_log_subscriber.rb +3 -0
- data/lib/mongo/monitoring/server_description_changed_log_subscriber.rb +3 -0
- data/lib/mongo/monitoring/server_opening_log_subscriber.rb +3 -0
- data/lib/mongo/monitoring/topology_changed_log_subscriber.rb +3 -0
- data/lib/mongo/monitoring/topology_closed_log_subscriber.rb +3 -0
- data/lib/mongo/monitoring/topology_opening_log_subscriber.rb +3 -0
- data/lib/mongo/monitoring/unified_sdam_log_subscriber.rb +3 -0
- data/lib/mongo/operation.rb +3 -0
- data/lib/mongo/operation/aggregate.rb +3 -0
- data/lib/mongo/operation/aggregate/command.rb +3 -0
- data/lib/mongo/operation/aggregate/op_msg.rb +3 -0
- data/lib/mongo/operation/aggregate/result.rb +3 -0
- data/lib/mongo/operation/collections_info.rb +3 -0
- data/lib/mongo/operation/collections_info/command.rb +3 -0
- data/lib/mongo/operation/collections_info/result.rb +3 -0
- data/lib/mongo/operation/command.rb +3 -0
- data/lib/mongo/operation/command/command.rb +3 -0
- data/lib/mongo/operation/command/op_msg.rb +3 -0
- data/lib/mongo/operation/context.rb +3 -0
- data/lib/mongo/operation/count.rb +3 -0
- data/lib/mongo/operation/count/command.rb +3 -0
- data/lib/mongo/operation/count/op_msg.rb +3 -0
- data/lib/mongo/operation/create.rb +3 -0
- data/lib/mongo/operation/create/command.rb +3 -0
- data/lib/mongo/operation/create/op_msg.rb +3 -0
- data/lib/mongo/operation/create_index.rb +3 -0
- data/lib/mongo/operation/create_index/command.rb +3 -0
- data/lib/mongo/operation/create_index/op_msg.rb +3 -0
- data/lib/mongo/operation/create_user.rb +3 -0
- data/lib/mongo/operation/create_user/command.rb +3 -0
- data/lib/mongo/operation/create_user/op_msg.rb +3 -0
- data/lib/mongo/operation/delete.rb +3 -0
- data/lib/mongo/operation/delete/bulk_result.rb +3 -0
- data/lib/mongo/operation/delete/command.rb +3 -0
- data/lib/mongo/operation/delete/legacy.rb +3 -0
- data/lib/mongo/operation/delete/op_msg.rb +3 -0
- data/lib/mongo/operation/delete/result.rb +3 -0
- data/lib/mongo/operation/distinct.rb +3 -0
- data/lib/mongo/operation/distinct/command.rb +3 -0
- data/lib/mongo/operation/distinct/op_msg.rb +3 -0
- data/lib/mongo/operation/drop.rb +3 -0
- data/lib/mongo/operation/drop/command.rb +3 -0
- data/lib/mongo/operation/drop/op_msg.rb +3 -0
- data/lib/mongo/operation/drop_database.rb +3 -0
- data/lib/mongo/operation/drop_database/command.rb +3 -0
- data/lib/mongo/operation/drop_database/op_msg.rb +3 -0
- data/lib/mongo/operation/drop_index.rb +3 -0
- data/lib/mongo/operation/drop_index/command.rb +3 -0
- data/lib/mongo/operation/drop_index/op_msg.rb +3 -0
- data/lib/mongo/operation/explain.rb +3 -0
- data/lib/mongo/operation/explain/command.rb +3 -0
- data/lib/mongo/operation/explain/legacy.rb +3 -0
- data/lib/mongo/operation/explain/op_msg.rb +3 -0
- data/lib/mongo/operation/explain/result.rb +3 -0
- data/lib/mongo/operation/find.rb +3 -0
- data/lib/mongo/operation/find/command.rb +3 -0
- data/lib/mongo/operation/find/legacy.rb +3 -0
- data/lib/mongo/operation/find/legacy/result.rb +3 -0
- data/lib/mongo/operation/find/op_msg.rb +3 -0
- data/lib/mongo/operation/find/result.rb +3 -0
- data/lib/mongo/operation/get_more.rb +3 -0
- data/lib/mongo/operation/get_more/command.rb +3 -0
- data/lib/mongo/operation/get_more/legacy.rb +3 -0
- data/lib/mongo/operation/get_more/op_msg.rb +3 -0
- data/lib/mongo/operation/get_more/result.rb +3 -0
- data/lib/mongo/operation/indexes.rb +3 -0
- data/lib/mongo/operation/indexes/command.rb +3 -0
- data/lib/mongo/operation/indexes/legacy.rb +3 -0
- data/lib/mongo/operation/indexes/op_msg.rb +3 -0
- data/lib/mongo/operation/indexes/result.rb +3 -0
- data/lib/mongo/operation/insert.rb +3 -0
- data/lib/mongo/operation/insert/bulk_result.rb +3 -0
- data/lib/mongo/operation/insert/command.rb +3 -0
- data/lib/mongo/operation/insert/legacy.rb +3 -0
- data/lib/mongo/operation/insert/op_msg.rb +3 -0
- data/lib/mongo/operation/insert/result.rb +3 -0
- data/lib/mongo/operation/kill_cursors.rb +3 -0
- data/lib/mongo/operation/kill_cursors/command.rb +3 -0
- data/lib/mongo/operation/kill_cursors/legacy.rb +3 -0
- data/lib/mongo/operation/kill_cursors/op_msg.rb +3 -0
- data/lib/mongo/operation/list_collections.rb +3 -0
- data/lib/mongo/operation/list_collections/command.rb +3 -0
- data/lib/mongo/operation/list_collections/op_msg.rb +3 -0
- data/lib/mongo/operation/list_collections/result.rb +3 -0
- data/lib/mongo/operation/map_reduce.rb +3 -0
- data/lib/mongo/operation/map_reduce/command.rb +3 -0
- data/lib/mongo/operation/map_reduce/op_msg.rb +3 -0
- data/lib/mongo/operation/map_reduce/result.rb +3 -0
- data/lib/mongo/operation/op_msg_base.rb +3 -0
- data/lib/mongo/operation/parallel_scan.rb +3 -0
- data/lib/mongo/operation/parallel_scan/command.rb +4 -2
- data/lib/mongo/operation/parallel_scan/op_msg.rb +3 -0
- data/lib/mongo/operation/parallel_scan/result.rb +3 -0
- data/lib/mongo/operation/remove_user.rb +3 -0
- data/lib/mongo/operation/remove_user/command.rb +3 -0
- data/lib/mongo/operation/remove_user/op_msg.rb +3 -0
- data/lib/mongo/operation/result.rb +3 -0
- data/lib/mongo/operation/shared/bypass_document_validation.rb +3 -0
- data/lib/mongo/operation/shared/causal_consistency_supported.rb +3 -0
- data/lib/mongo/operation/shared/executable.rb +4 -4
- data/lib/mongo/operation/shared/executable_no_validate.rb +3 -0
- data/lib/mongo/operation/shared/executable_transaction_label.rb +3 -0
- data/lib/mongo/operation/shared/idable.rb +3 -0
- data/lib/mongo/operation/shared/limited.rb +3 -0
- data/lib/mongo/operation/shared/object_id_generator.rb +3 -0
- data/lib/mongo/operation/shared/op_msg_or_command.rb +3 -0
- data/lib/mongo/operation/shared/op_msg_or_find_command.rb +3 -0
- data/lib/mongo/operation/shared/polymorphic_lookup.rb +3 -0
- data/lib/mongo/operation/shared/polymorphic_operation.rb +3 -0
- data/lib/mongo/operation/shared/polymorphic_result.rb +3 -0
- data/lib/mongo/operation/shared/read_preference_supported.rb +41 -36
- data/lib/mongo/operation/shared/response_handling.rb +3 -0
- data/lib/mongo/operation/shared/result/aggregatable.rb +3 -0
- data/lib/mongo/operation/shared/result/use_legacy_error_parser.rb +3 -0
- data/lib/mongo/operation/shared/sessions_supported.rb +6 -2
- data/lib/mongo/operation/shared/specifiable.rb +3 -0
- data/lib/mongo/operation/shared/write.rb +3 -0
- data/lib/mongo/operation/shared/write_concern_supported.rb +3 -0
- data/lib/mongo/operation/update.rb +3 -0
- data/lib/mongo/operation/update/bulk_result.rb +3 -0
- data/lib/mongo/operation/update/command.rb +3 -0
- data/lib/mongo/operation/update/legacy.rb +3 -0
- data/lib/mongo/operation/update/legacy/result.rb +3 -0
- data/lib/mongo/operation/update/op_msg.rb +3 -0
- data/lib/mongo/operation/update/result.rb +3 -0
- data/lib/mongo/operation/update_user.rb +3 -0
- data/lib/mongo/operation/update_user/command.rb +3 -0
- data/lib/mongo/operation/update_user/op_msg.rb +3 -0
- data/lib/mongo/operation/users_info.rb +3 -0
- data/lib/mongo/operation/users_info/command.rb +3 -0
- data/lib/mongo/operation/users_info/op_msg.rb +3 -0
- data/lib/mongo/operation/users_info/result.rb +3 -0
- data/lib/mongo/options.rb +3 -0
- data/lib/mongo/options/mapper.rb +3 -0
- data/lib/mongo/options/redacted.rb +3 -0
- data/lib/mongo/protocol.rb +3 -0
- data/lib/mongo/protocol/bit_vector.rb +3 -0
- data/lib/mongo/protocol/compressed.rb +3 -0
- data/lib/mongo/protocol/delete.rb +3 -0
- data/lib/mongo/protocol/get_more.rb +3 -0
- data/lib/mongo/protocol/insert.rb +3 -0
- data/lib/mongo/protocol/kill_cursors.rb +3 -0
- data/lib/mongo/protocol/message.rb +3 -0
- data/lib/mongo/protocol/msg.rb +8 -10
- data/lib/mongo/protocol/query.rb +18 -14
- data/lib/mongo/protocol/registry.rb +3 -0
- data/lib/mongo/protocol/reply.rb +3 -0
- data/lib/mongo/protocol/serializers.rb +3 -0
- data/lib/mongo/protocol/update.rb +3 -0
- data/lib/mongo/query_cache.rb +3 -0
- data/lib/mongo/retryable.rb +3 -0
- data/lib/mongo/semaphore.rb +3 -0
- data/lib/mongo/server.rb +17 -0
- data/lib/mongo/server/app_metadata.rb +40 -18
- data/lib/mongo/server/connection.rb +4 -1
- data/lib/mongo/server/connection_base.rb +22 -10
- data/lib/mongo/server/connection_common.rb +34 -1
- data/lib/mongo/server/connection_pool.rb +5 -2
- data/lib/mongo/server/connection_pool/populator.rb +3 -0
- data/lib/mongo/server/context.rb +3 -0
- data/lib/mongo/server/description.rb +23 -10
- data/lib/mongo/server/description/features.rb +5 -2
- data/lib/mongo/server/monitor.rb +15 -21
- data/lib/mongo/server/monitor/app_metadata.rb +3 -0
- data/lib/mongo/server/monitor/connection.rb +50 -39
- data/lib/mongo/server/pending_connection.rb +19 -20
- data/lib/mongo/server/push_monitor.rb +26 -21
- data/lib/mongo/server/push_monitor/connection.rb +3 -0
- data/lib/mongo/server/round_trip_time_averager.rb +6 -3
- data/lib/mongo/server_selector.rb +3 -0
- data/lib/mongo/server_selector/base.rb +6 -3
- data/lib/mongo/server_selector/nearest.rb +6 -4
- data/lib/mongo/server_selector/primary.rb +6 -4
- data/lib/mongo/server_selector/primary_preferred.rb +6 -4
- data/lib/mongo/server_selector/secondary.rb +6 -4
- data/lib/mongo/server_selector/secondary_preferred.rb +8 -11
- data/lib/mongo/session.rb +17 -10
- data/lib/mongo/session/server_session.rb +3 -0
- data/lib/mongo/session/session_pool.rb +3 -0
- data/lib/mongo/socket.rb +8 -3
- data/lib/mongo/socket/ocsp_cache.rb +3 -0
- data/lib/mongo/socket/ocsp_verifier.rb +9 -1
- data/lib/mongo/socket/ssl.rb +3 -0
- data/lib/mongo/socket/tcp.rb +3 -0
- data/lib/mongo/socket/unix.rb +3 -0
- data/lib/mongo/srv.rb +3 -0
- data/lib/mongo/srv/monitor.rb +3 -0
- data/lib/mongo/srv/resolver.rb +3 -0
- data/lib/mongo/srv/result.rb +3 -0
- data/lib/mongo/timeout.rb +3 -0
- data/lib/mongo/topology_version.rb +4 -1
- data/lib/mongo/uri.rb +3 -0
- data/lib/mongo/uri/options_mapper.rb +3 -0
- data/lib/mongo/uri/srv_protocol.rb +3 -0
- data/lib/mongo/utils.rb +30 -0
- data/lib/mongo/version.rb +4 -1
- data/lib/mongo/write_concern.rb +3 -0
- data/lib/mongo/write_concern/acknowledged.rb +3 -0
- data/lib/mongo/write_concern/base.rb +3 -0
- data/lib/mongo/write_concern/unacknowledged.rb +3 -0
- data/spec/atlas/atlas_connectivity_spec.rb +3 -0
- data/spec/atlas/operations_spec.rb +3 -0
- data/spec/integration/auth_spec.rb +3 -0
- data/spec/integration/awaited_ismaster_spec.rb +8 -5
- data/spec/integration/aws_auth_request_spec.rb +3 -0
- data/spec/integration/aws_credentials_retriever_spec.rb +3 -0
- data/spec/integration/bson_symbol_spec.rb +4 -1
- data/spec/integration/bulk_insert_spec.rb +3 -0
- data/spec/integration/bulk_write_spec.rb +3 -0
- data/spec/integration/change_stream_examples_spec.rb +3 -0
- data/spec/integration/change_stream_spec.rb +3 -0
- data/spec/integration/check_clean_slate_spec.rb +3 -0
- data/spec/integration/client_authentication_options_spec.rb +21 -8
- data/spec/integration/client_connectivity_spec.rb +4 -1
- data/spec/integration/client_construction_aws_auth_spec.rb +3 -0
- data/spec/integration/client_construction_spec.rb +3 -0
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +3 -0
- data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +3 -0
- data/spec/integration/client_side_encryption/auto_encryption_mongocryptd_spawn_spec.rb +3 -0
- data/spec/integration/client_side_encryption/auto_encryption_old_wire_version_spec.rb +3 -0
- data/spec/integration/client_side_encryption/auto_encryption_reconnect_spec.rb +3 -0
- data/spec/integration/client_side_encryption/auto_encryption_spec.rb +3 -0
- data/spec/integration/client_side_encryption/bson_size_limit_spec.rb +3 -0
- data/spec/integration/client_side_encryption/bypass_mongocryptd_spawn_spec.rb +4 -1
- data/spec/integration/client_side_encryption/client_close_spec.rb +3 -0
- data/spec/integration/client_side_encryption/corpus_spec.rb +3 -0
- data/spec/integration/client_side_encryption/custom_endpoint_spec.rb +3 -0
- data/spec/integration/client_side_encryption/data_key_spec.rb +3 -0
- data/spec/integration/client_side_encryption/explicit_encryption_spec.rb +3 -0
- data/spec/integration/client_side_encryption/external_key_vault_spec.rb +3 -0
- data/spec/integration/client_side_encryption/views_spec.rb +3 -0
- data/spec/integration/client_spec.rb +5 -2
- data/spec/integration/client_update_spec.rb +3 -0
- data/spec/integration/collection_indexes_prose_spec.rb +3 -0
- data/spec/integration/command_monitoring_spec.rb +61 -23
- data/spec/integration/command_spec.rb +3 -0
- data/spec/integration/connect_single_rs_name_spec.rb +6 -3
- data/spec/integration/connection_pool_populator_spec.rb +3 -0
- data/spec/integration/connection_spec.rb +10 -7
- data/spec/integration/crud_spec.rb +31 -0
- data/spec/integration/cursor_reaping_spec.rb +3 -0
- data/spec/integration/docs_examples_spec.rb +3 -0
- data/spec/integration/error_detection_spec.rb +3 -0
- data/spec/integration/fork_reconnect_spec.rb +4 -1
- data/spec/integration/get_more_spec.rb +3 -0
- data/spec/integration/grid_fs_bucket_spec.rb +4 -1
- data/spec/integration/heartbeat_events_spec.rb +7 -4
- data/spec/integration/mmapv1_spec.rb +3 -0
- data/spec/integration/mongos_pinning_spec.rb +3 -0
- data/spec/integration/ocsp_connectivity_spec.rb +3 -0
- data/spec/integration/ocsp_verifier_cache_spec.rb +3 -0
- data/spec/integration/ocsp_verifier_spec.rb +16 -1
- data/spec/integration/operation_failure_code_spec.rb +3 -0
- data/spec/integration/query_cache_spec.rb +3 -0
- data/spec/integration/query_cache_transactions_spec.rb +3 -0
- data/spec/integration/read_concern_spec.rb +3 -0
- data/spec/integration/read_preference_spec.rb +3 -0
- data/spec/integration/reconnect_spec.rb +3 -0
- data/spec/integration/retryable_errors_spec.rb +3 -0
- data/spec/integration/retryable_writes/retryable_writes_36_and_older_spec.rb +3 -0
- data/spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb +3 -0
- data/spec/integration/retryable_writes/shared/adds_diagnostics.rb +3 -0
- data/spec/integration/retryable_writes/shared/does_not_support_retries.rb +3 -0
- data/spec/integration/retryable_writes/shared/only_supports_legacy_retries.rb +3 -0
- data/spec/integration/retryable_writes/shared/performs_legacy_retries.rb +3 -0
- data/spec/integration/retryable_writes/shared/performs_modern_retries.rb +3 -0
- data/spec/integration/retryable_writes/shared/performs_no_retries.rb +3 -0
- data/spec/integration/retryable_writes/shared/supports_legacy_retries.rb +3 -0
- data/spec/integration/retryable_writes/shared/supports_modern_retries.rb +3 -0
- data/spec/integration/retryable_writes/shared/supports_retries.rb +3 -0
- data/spec/integration/retryable_writes_errors_spec.rb +3 -0
- data/spec/integration/sdam_error_handling_spec.rb +5 -2
- data/spec/integration/sdam_events_spec.rb +11 -5
- data/spec/integration/sdam_prose_spec.rb +4 -1
- 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 +4 -1
- data/spec/integration/server_selection_spec.rb +3 -0
- data/spec/integration/server_selector_spec.rb +3 -0
- data/spec/integration/server_spec.rb +3 -0
- data/spec/integration/shell_examples_spec.rb +3 -0
- data/spec/integration/size_limit_spec.rb +3 -0
- data/spec/integration/snappy_compression_spec.rb +3 -0
- data/spec/integration/srv_monitoring_spec.rb +3 -0
- data/spec/integration/srv_spec.rb +3 -0
- data/spec/integration/ssl_uri_options_spec.rb +3 -0
- data/spec/integration/step_down_spec.rb +3 -0
- data/spec/integration/time_zone_querying_spec.rb +3 -0
- data/spec/integration/transactions_api_examples_spec.rb +3 -0
- data/spec/integration/transactions_examples_spec.rb +3 -0
- 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 +4 -1
- data/spec/integration/zlib_compression_spec.rb +3 -0
- data/spec/integration/zstd_compression_spec.rb +3 -0
- data/spec/kerberos/kerberos_spec.rb +3 -0
- data/spec/lite_spec_helper.rb +4 -0
- data/spec/mongo/address/ipv4_spec.rb +3 -0
- 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 +3 -0
- data/spec/mongo/address_spec.rb +3 -0
- data/spec/mongo/auth/aws/request_region_spec.rb +3 -0
- data/spec/mongo/auth/aws/request_spec.rb +3 -0
- data/spec/mongo/auth/cr_spec.rb +3 -0
- data/spec/mongo/auth/gssapi/conversation_spec.rb +3 -0
- data/spec/mongo/auth/invalid_mechanism_spec.rb +3 -0
- data/spec/mongo/auth/ldap/conversation_spec.rb +3 -0
- data/spec/mongo/auth/ldap_spec.rb +3 -0
- data/spec/mongo/auth/scram/conversation_spec.rb +3 -0
- data/spec/mongo/auth/scram256/conversation_spec.rb +3 -0
- data/spec/mongo/auth/scram_negotiation_spec.rb +3 -0
- data/spec/mongo/auth/scram_spec.rb +3 -0
- 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 +3 -0
- data/spec/mongo/auth/user_spec.rb +3 -0
- data/spec/mongo/auth/x509/conversation_spec.rb +3 -0
- data/spec/mongo/auth/x509_spec.rb +3 -0
- data/spec/mongo/auth_spec.rb +3 -0
- 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 +3 -0
- data/spec/mongo/bulk_write/unordered_combiner_spec.rb +3 -0
- data/spec/mongo/bulk_write_spec.rb +3 -0
- data/spec/mongo/caching_cursor_spec.rb +3 -0
- data/spec/mongo/client_construction_spec.rb +10 -5
- data/spec/mongo/client_encryption_spec.rb +3 -0
- data/spec/mongo/client_spec.rb +3 -0
- data/spec/mongo/cluster/cursor_reaper_spec.rb +3 -0
- data/spec/mongo/cluster/periodic_executor_spec.rb +3 -0
- data/spec/mongo/cluster/socket_reaper_spec.rb +3 -0
- data/spec/mongo/cluster/topology/replica_set_spec.rb +12 -9
- data/spec/mongo/cluster/topology/sharded_spec.rb +5 -2
- data/spec/mongo/cluster/topology/single_spec.rb +5 -2
- data/spec/mongo/cluster/topology/unknown_spec.rb +3 -0
- data/spec/mongo/cluster/topology_spec.rb +3 -0
- data/spec/mongo/cluster_spec.rb +4 -0
- data/spec/mongo/cluster_time_spec.rb +3 -0
- data/spec/mongo/collection/view/aggregation_spec.rb +3 -0
- data/spec/mongo/collection/view/builder/find_command_spec.rb +3 -0
- 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 +7 -2
- data/spec/mongo/collection/view/change_stream_spec.rb +16 -0
- data/spec/mongo/collection/view/explainable_spec.rb +3 -0
- data/spec/mongo/collection/view/immutable_spec.rb +3 -0
- data/spec/mongo/collection/view/iterable_spec.rb +3 -0
- data/spec/mongo/collection/view/map_reduce_spec.rb +3 -0
- data/spec/mongo/collection/view/readable_spec.rb +19 -0
- data/spec/mongo/collection/view/writable_spec.rb +3 -0
- data/spec/mongo/collection/view_spec.rb +3 -0
- data/spec/mongo/collection_crud_spec.rb +3 -0
- data/spec/mongo/collection_ddl_spec.rb +3 -0
- data/spec/mongo/collection_spec.rb +3 -0
- data/spec/mongo/crypt/auto_decryption_context_spec.rb +3 -0
- data/spec/mongo/crypt/auto_encrypter_spec.rb +3 -0
- data/spec/mongo/crypt/auto_encryption_context_spec.rb +3 -0
- data/spec/mongo/crypt/binary_spec.rb +3 -0
- data/spec/mongo/crypt/binding/binary_spec.rb +3 -0
- data/spec/mongo/crypt/binding/context_spec.rb +3 -0
- data/spec/mongo/crypt/binding/helpers_spec.rb +3 -0
- data/spec/mongo/crypt/binding/mongocrypt_spec.rb +3 -0
- data/spec/mongo/crypt/binding/status_spec.rb +3 -0
- data/spec/mongo/crypt/binding/version_spec.rb +3 -0
- data/spec/mongo/crypt/binding_unloaded_spec.rb +3 -0
- data/spec/mongo/crypt/data_key_context_spec.rb +3 -0
- data/spec/mongo/crypt/encryption_io_spec.rb +3 -0
- data/spec/mongo/crypt/explicit_decryption_context_spec.rb +3 -0
- data/spec/mongo/crypt/explicit_encryption_context_spec.rb +3 -0
- data/spec/mongo/crypt/handle_spec.rb +3 -0
- data/spec/mongo/crypt/helpers/mongo_crypt_spec_helper.rb +3 -0
- data/spec/mongo/crypt/status_spec.rb +3 -0
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +7 -2
- data/spec/mongo/cursor/builder/op_get_more_spec.rb +7 -2
- data/spec/mongo/cursor/builder/op_kill_cursors_spec.rb +7 -2
- data/spec/mongo/cursor_spec.rb +74 -7
- data/spec/mongo/database_spec.rb +9 -6
- data/spec/mongo/dbref_spec.rb +3 -0
- data/spec/mongo/distinguishing_semaphore_spec.rb +3 -0
- data/spec/mongo/error/bulk_write_error_spec.rb +3 -0
- data/spec/mongo/error/crypt_error_spec.rb +3 -0
- data/spec/mongo/error/max_bson_size_spec.rb +3 -0
- data/spec/mongo/error/no_server_available_spec.rb +3 -0
- data/spec/mongo/error/notable_spec.rb +3 -0
- data/spec/mongo/error/operation_failure_heavy_spec.rb +3 -0
- data/spec/mongo/error/operation_failure_spec.rb +94 -31
- data/spec/mongo/error/parser_spec.rb +3 -0
- data/spec/mongo/error/unsupported_option_spec.rb +3 -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 +22 -5
- data/spec/mongo/grid/stream/read_spec.rb +33 -10
- data/spec/mongo/grid/stream/write_spec.rb +3 -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 +3 -0
- data/spec/mongo/lint_spec.rb +3 -0
- data/spec/mongo/logger_spec.rb +3 -0
- 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 +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_checked_out_spec.rb +3 -0
- 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 +3 -0
- data/spec/mongo/monitoring/event/cmap/pool_created_spec.rb +3 -0
- 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 +3 -0
- data/spec/mongo/monitoring/event/server_description_changed_spec.rb +3 -0
- data/spec/mongo/monitoring/event/server_heartbeat_failed_spec.rb +3 -0
- data/spec/mongo/monitoring/event/server_heartbeat_started_spec.rb +3 -0
- data/spec/mongo/monitoring/event/server_heartbeat_succeeded_spec.rb +3 -0
- data/spec/mongo/monitoring/event/server_opening_spec.rb +3 -0
- data/spec/mongo/monitoring/event/topology_changed_spec.rb +3 -0
- data/spec/mongo/monitoring/event/topology_closed_spec.rb +3 -0
- data/spec/mongo/monitoring/event/topology_opening_spec.rb +3 -0
- data/spec/mongo/monitoring_spec.rb +3 -0
- data/spec/mongo/operation/aggregate/result_spec.rb +7 -2
- data/spec/mongo/operation/aggregate_spec.rb +3 -0
- data/spec/mongo/operation/collections_info_spec.rb +3 -0
- data/spec/mongo/operation/command_spec.rb +5 -2
- data/spec/mongo/operation/create_index_spec.rb +3 -0
- data/spec/mongo/operation/create_user_spec.rb +3 -0
- data/spec/mongo/operation/delete/bulk_spec.rb +3 -0
- data/spec/mongo/operation/delete/command_spec.rb +3 -0
- data/spec/mongo/operation/delete/op_msg_spec.rb +3 -0
- data/spec/mongo/operation/delete_spec.rb +3 -0
- data/spec/mongo/operation/drop_index_spec.rb +3 -0
- data/spec/mongo/operation/find/legacy_spec.rb +4 -1
- data/spec/mongo/operation/get_more_spec.rb +3 -0
- data/spec/mongo/operation/indexes_spec.rb +3 -0
- data/spec/mongo/operation/insert/bulk_spec.rb +3 -0
- data/spec/mongo/operation/insert/command_spec.rb +3 -0
- data/spec/mongo/operation/insert/op_msg_spec.rb +3 -0
- data/spec/mongo/operation/insert_spec.rb +3 -0
- data/spec/mongo/operation/kill_cursors_spec.rb +3 -0
- data/spec/mongo/operation/limited_spec.rb +3 -0
- data/spec/mongo/operation/map_reduce_spec.rb +3 -0
- data/spec/mongo/operation/read_preference_legacy_spec.rb +35 -42
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +6 -3
- data/spec/mongo/operation/remove_user_spec.rb +3 -0
- data/spec/mongo/operation/result_spec.rb +9 -4
- data/spec/mongo/operation/specifiable_spec.rb +3 -0
- data/spec/mongo/operation/update/bulk_spec.rb +3 -0
- data/spec/mongo/operation/update/command_spec.rb +3 -0
- data/spec/mongo/operation/update/op_msg_spec.rb +3 -0
- data/spec/mongo/operation/update_spec.rb +3 -0
- data/spec/mongo/operation/update_user_spec.rb +3 -0
- data/spec/mongo/options/redacted_spec.rb +3 -0
- data/spec/mongo/protocol/compressed_spec.rb +3 -0
- data/spec/mongo/protocol/delete_spec.rb +3 -0
- data/spec/mongo/protocol/get_more_spec.rb +3 -0
- data/spec/mongo/protocol/insert_spec.rb +3 -0
- data/spec/mongo/protocol/kill_cursors_spec.rb +3 -0
- data/spec/mongo/protocol/msg_spec.rb +4 -1
- data/spec/mongo/protocol/query_spec.rb +6 -3
- data/spec/mongo/protocol/registry_spec.rb +3 -0
- data/spec/mongo/protocol/reply_spec.rb +3 -0
- data/spec/mongo/protocol/update_spec.rb +3 -0
- data/spec/mongo/query_cache_spec.rb +3 -0
- data/spec/mongo/retryable_spec.rb +3 -0
- data/spec/mongo/semaphore_spec.rb +3 -0
- data/spec/mongo/server/app_metadata_spec.rb +44 -21
- data/spec/mongo/server/connection_auth_spec.rb +6 -9
- data/spec/mongo/server/connection_common_spec.rb +24 -0
- data/spec/mongo/server/connection_pool/populator_spec.rb +3 -0
- data/spec/mongo/server/connection_pool_spec.rb +3 -0
- data/spec/mongo/server/connection_spec.rb +9 -0
- 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 +624 -611
- data/spec/mongo/server/monitor/app_metadata_spec.rb +3 -1
- data/spec/mongo/server/monitor/connection_spec.rb +40 -0
- data/spec/mongo/server/monitor_spec.rb +13 -10
- data/spec/mongo/server/round_trip_time_averager_spec.rb +3 -0
- data/spec/mongo/server_selector/nearest_spec.rb +8 -2
- data/spec/mongo/server_selector/primary_preferred_spec.rb +8 -2
- data/spec/mongo/server_selector/primary_spec.rb +8 -2
- data/spec/mongo/server_selector/secondary_preferred_spec.rb +14 -8
- data/spec/mongo/server_selector/secondary_spec.rb +8 -2
- data/spec/mongo/server_selector_spec.rb +5 -1
- data/spec/mongo/server_spec.rb +3 -0
- data/spec/mongo/session/server_session_spec.rb +3 -0
- data/spec/mongo/session/session_pool_spec.rb +3 -0
- data/spec/mongo/session_spec.rb +3 -0
- data/spec/mongo/session_transaction_spec.rb +7 -12
- data/spec/mongo/socket/ssl_spec.rb +3 -0
- data/spec/mongo/socket/tcp_spec.rb +3 -0
- data/spec/mongo/socket/unix_spec.rb +3 -0
- data/spec/mongo/socket_spec.rb +3 -0
- data/spec/mongo/srv/monitor_spec.rb +3 -0
- data/spec/mongo/srv/result_spec.rb +3 -0
- data/spec/mongo/timeout_spec.rb +3 -0
- data/spec/mongo/tls_context_hooks_spec.rb +3 -0
- data/spec/mongo/uri/srv_protocol_spec.rb +4 -0
- data/spec/mongo/uri_option_parsing_spec.rb +3 -0
- data/spec/mongo/uri_spec.rb +3 -0
- data/spec/mongo/utils_spec.rb +17 -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 +3 -0
- data/spec/runners/auth.rb +22 -1
- data/spec/runners/change_streams/outcome.rb +3 -0
- data/spec/runners/change_streams/spec.rb +3 -0
- data/spec/runners/change_streams/test.rb +3 -0
- data/spec/runners/cmap.rb +3 -0
- data/spec/runners/cmap/verifier.rb +3 -0
- data/spec/runners/command_monitoring.rb +3 -0
- data/spec/runners/connection_string.rb +3 -0
- data/spec/runners/crud.rb +22 -0
- data/spec/runners/crud/context.rb +3 -0
- data/spec/runners/crud/operation.rb +3 -0
- data/spec/runners/crud/outcome.rb +3 -0
- data/spec/runners/crud/requirement.rb +28 -1
- data/spec/runners/crud/spec.rb +3 -0
- data/spec/runners/crud/test.rb +3 -0
- data/spec/runners/crud/test_base.rb +3 -0
- data/spec/runners/crud/verifier.rb +3 -0
- data/spec/runners/gridfs.rb +3 -0
- data/spec/runners/read_write_concern_document.rb +3 -0
- data/spec/runners/sdam.rb +6 -3
- data/spec/runners/sdam/verifier.rb +3 -0
- data/spec/runners/server_selection.rb +3 -0
- data/spec/runners/server_selection_rtt.rb +4 -1
- data/spec/runners/transactions.rb +3 -0
- data/spec/runners/transactions/operation.rb +3 -0
- data/spec/runners/transactions/spec.rb +3 -0
- data/spec/runners/transactions/test.rb +3 -0
- data/spec/runners/unified.rb +3 -0
- data/spec/runners/unified/assertions.rb +43 -10
- data/spec/runners/unified/change_stream_operations.rb +3 -0
- data/spec/runners/unified/crud_operations.rb +8 -1
- data/spec/runners/unified/ddl_operations.rb +11 -1
- data/spec/runners/unified/entity_map.rb +3 -0
- data/spec/runners/unified/error.rb +3 -0
- data/spec/runners/unified/event_subscriber.rb +24 -11
- data/spec/runners/unified/exceptions.rb +3 -0
- data/spec/runners/unified/grid_fs_operations.rb +3 -0
- data/spec/runners/unified/support_operations.rb +3 -0
- data/spec/runners/unified/test.rb +53 -23
- data/spec/runners/unified/test_group.rb +3 -0
- data/spec/runners/unified/using_hash.rb +3 -0
- data/spec/shared/bin/s3-copy +45 -0
- data/spec/shared/bin/s3-upload +69 -0
- data/spec/shared/lib/mrss/cluster_config.rb +11 -3
- data/spec/shared/lib/mrss/constraints.rb +39 -6
- data/spec/shared/lib/mrss/docker_runner.rb +10 -1
- data/spec/shared/lib/mrss/lite_constraints.rb +16 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +3 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +32 -2
- data/spec/shared/share/Dockerfile.erb +123 -32
- data/spec/shared/share/haproxy-1.conf +16 -0
- data/spec/shared/share/haproxy-2.conf +17 -0
- data/spec/shared/shlib/server.sh +31 -4
- data/spec/shared/shlib/set_env.sh +4 -1
- data/spec/solo/clean_exit_spec.rb +3 -0
- data/spec/spec_helper.rb +4 -2
- data/spec/spec_tests/auth_spec.rb +30 -13
- data/spec/spec_tests/change_streams_spec.rb +3 -0
- data/spec/spec_tests/change_streams_unified_spec.rb +13 -0
- data/spec/spec_tests/client_side_encryption_spec.rb +3 -0
- data/spec/spec_tests/cmap_spec.rb +3 -0
- data/spec/spec_tests/collection_management_spec.rb +13 -0
- data/spec/spec_tests/command_monitoring_spec.rb +31 -26
- data/spec/spec_tests/command_monitoring_unified_spec.rb +13 -0
- data/spec/spec_tests/connection_string_spec.rb +3 -0
- data/spec/spec_tests/crud_spec.rb +3 -0
- data/spec/spec_tests/crud_unified_spec.rb +3 -0
- data/spec/spec_tests/data/change_streams/change-streams-errors.yml +5 -5
- data/spec/spec_tests/data/change_streams/{change-streams-resume-whitelist.yml → change-streams-resume-allowlist.yml} +58 -58
- data/spec/spec_tests/data/change_streams/change-streams-resume-errorLabels.yml +46 -46
- data/spec/spec_tests/data/change_streams_unified/change-streams.yml +72 -0
- data/spec/spec_tests/data/collection_management/timeseries-collection.yml +129 -0
- data/spec/spec_tests/data/command_monitoring_unified/redacted-commands.yml +340 -0
- 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/updateWithPipelines.yml +305 -0
- data/spec/spec_tests/data/crud_v2/aggregate-out-readConcern.yml +1 -0
- data/spec/spec_tests/data/crud_v2/db-aggregate.yml +1 -0
- data/spec/spec_tests/data/retryable_reads/aggregate-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml +6 -5
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml +1 -0
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml +6 -5
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml +1 -0
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml +6 -5
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml +1 -0
- data/spec/spec_tests/data/retryable_reads/count-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/countDocuments-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/distinct-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors-4.9.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors-pre4.9.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/find-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/findOne-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/gridfs-download-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/gridfs-downloadByName-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listCollectionNames-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listCollectionObjects-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listCollections-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listDatabaseNames-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listDatabaseObjects-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listDatabases-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listIndexNames-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listIndexes-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_writes/bulkWrite.yml +30 -24
- data/spec/spec_tests/data/retryable_writes/insertOne-serverErrors.yml +5 -4
- data/spec/spec_tests/data/sdam/errors/error_handling_handshake.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-network-error.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-network-timeout-error.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-InterruptedAtShutdown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-InterruptedDueToReplStateChange.yml +2 -1
- 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-NotMasterNoSlaveOk.yml → non-stale-topologyVersion-greater-NotPrimaryNoSecondaryOk.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/{non-stale-topologyVersion-greater-NotMasterOrSecondary.yml → non-stale-topologyVersion-greater-NotPrimaryOrSecondary.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/{non-stale-topologyVersion-greater-NotMaster.yml → non-stale-topologyVersion-greater-NotWritablePrimary.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-PrimarySteppedDown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-ShutdownInProgress.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-InterruptedAtShutdown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-InterruptedDueToReplStateChange.yml +2 -1
- 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-NotMasterNoSlaveOk.yml → non-stale-topologyVersion-missing-NotPrimaryNoSecondaryOk.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/{non-stale-topologyVersion-missing-NotMasterOrSecondary.yml → non-stale-topologyVersion-missing-NotPrimaryOrSecondary.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/{non-stale-topologyVersion-missing-NotMaster.yml → non-stale-topologyVersion-missing-NotWritablePrimary.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-PrimarySteppedDown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-ShutdownInProgress.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-InterruptedAtShutdown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-InterruptedDueToReplStateChange.yml +2 -1
- 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-NotMasterNoSlaveOk.yml → non-stale-topologyVersion-proccessId-changed-NotPrimaryNoSecondaryOk.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/{non-stale-topologyVersion-proccessId-changed-NotMasterOrSecondary.yml → non-stale-topologyVersion-proccessId-changed-NotPrimaryOrSecondary.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/{non-stale-topologyVersion-proccessId-changed-NotMaster.yml → non-stale-topologyVersion-proccessId-changed-NotWritablePrimary.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-PrimarySteppedDown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-ShutdownInProgress.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/post-42-InterruptedAtShutdown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/post-42-InterruptedDueToReplStateChange.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/post-42-LegacyNotPrimary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/{post-42-NotMasterNoSlaveOk.yml → post-42-NotPrimaryNoSecondaryOk.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/{post-42-NotMasterOrSecondary.yml → post-42-NotPrimaryOrSecondary.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/{post-42-NotMaster.yml → post-42-NotWritablePrimary.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/post-42-PrimarySteppedDown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/post-42-ShutdownInProgress.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/pre-42-InterruptedAtShutdown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/pre-42-InterruptedDueToReplStateChange.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/{pre-42-NotMaster.yml → pre-42-LegacyNotPrimary.yml} +6 -5
- data/spec/spec_tests/data/sdam/errors/pre-42-NotPrimaryNoSecondaryOk.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/{pre-42-NotMasterOrSecondary.yml → pre-42-NotPrimaryOrSecondary.yml} +5 -4
- data/spec/spec_tests/data/sdam/errors/{pre-42-NotMasterNoSlaveOk.yml → pre-42-NotWritablePrimary.yml} +6 -5
- data/spec/spec_tests/data/sdam/errors/pre-42-PrimarySteppedDown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/pre-42-ShutdownInProgress.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/prefer-error-code.yml +54 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-InterruptedAtShutdown.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/stale-generation-InterruptedDueToReplStateChange.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/{stale-generation-NotMasterNoSlaveOk.yml → stale-generation-NotPrimaryNoSecondaryOk.yml} +7 -5
- data/spec/spec_tests/data/sdam/errors/{stale-generation-NotMasterOrSecondary.yml → stale-generation-NotPrimaryOrSecondary.yml} +7 -5
- data/spec/spec_tests/data/sdam/errors/{stale-generation-NotMaster.yml → stale-generation-NotWritablePrimary.yml} +7 -5
- data/spec/spec_tests/data/sdam/errors/stale-generation-PrimarySteppedDown.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/stale-generation-ShutdownInProgress.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-InterruptedAtShutdown.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-InterruptedDueToReplStateChange.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/{stale-generation-afterHandshakeCompletes-NotMaster.yml → stale-generation-afterHandshakeCompletes-LegacyNotPrimary.yml} +8 -6
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotPrimaryNoSecondaryOk.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/{stale-generation-afterHandshakeCompletes-NotMasterOrSecondary.yml → stale-generation-afterHandshakeCompletes-NotPrimaryOrSecondary.yml} +7 -5
- data/spec/spec_tests/data/sdam/errors/{stale-generation-afterHandshakeCompletes-NotMasterNoSlaveOk.yml → stale-generation-afterHandshakeCompletes-NotWritablePrimary.yml} +8 -6
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-PrimarySteppedDown.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-ShutdownInProgress.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-network.yml +6 -4
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-timeout.yml +6 -4
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-InterruptedAtShutdown.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-InterruptedDueToReplStateChange.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/{stale-generation-beforeHandshakeCompletes-NotMaster.yml → stale-generation-beforeHandshakeCompletes-LegacyNotPrimary.yml} +8 -6
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotPrimaryNoSecondaryOk.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/{stale-generation-beforeHandshakeCompletes-NotMasterOrSecondary.yml → stale-generation-beforeHandshakeCompletes-NotPrimaryOrSecondary.yml} +7 -5
- data/spec/spec_tests/data/sdam/errors/{stale-generation-beforeHandshakeCompletes-NotMasterNoSlaveOk.yml → stale-generation-beforeHandshakeCompletes-NotWritablePrimary.yml} +8 -6
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-PrimarySteppedDown.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-ShutdownInProgress.yml +4 -2
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-network.yml +6 -4
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-timeout.yml +6 -4
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-InterruptedAtShutdown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-InterruptedDueToReplStateChange.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-LegacyNotPrimary.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/{stale-topologyVersion-NotMasterNoSlaveOk.yml → stale-topologyVersion-NotPrimaryNoSecondaryOk.yml} +7 -6
- data/spec/spec_tests/data/sdam/errors/{stale-topologyVersion-NotMasterOrSecondary.yml → stale-topologyVersion-NotPrimaryOrSecondary.yml} +7 -6
- data/spec/spec_tests/data/sdam/errors/{stale-topologyVersion-NotMaster.yml → stale-topologyVersion-NotWritablePrimary.yml} +7 -6
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-PrimarySteppedDown.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-ShutdownInProgress.yml +2 -1
- data/spec/spec_tests/data/sdam/errors/write_errors_ignored.yml +42 -0
- data/spec/spec_tests/data/sdam/rs/compatible.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/compatible_unknown.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_arbiters.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_arbiters_replicaset.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_ghost.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_ghost_replicaset.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_hidden.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_hidden_replicaset.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_passives.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/discover_passives_replicaset.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/discover_primary.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_primary_replicaset.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_rsother.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_rsother_replicaset.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/discover_secondary.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/discover_secondary_replicaset.yml +2 -1
- 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 +3 -1
- data/spec/spec_tests/data/sdam/rs/incompatible_ghost.yml +3 -1
- data/spec/spec_tests/data/sdam/rs/incompatible_other.yml +3 -1
- 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 +5 -3
- 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 +9 -5
- data/spec/spec_tests/data/sdam/rs/replicaset_rsnp.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/response_from_removed.yml +4 -2
- 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 +2 -1
- 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 +4 -2
- data/spec/spec_tests/data/sdam/rs/too_old.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/topology_version_equal.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/topology_version_greater.yml +10 -5
- data/spec/spec_tests/data/sdam/rs/topology_version_less.yml +4 -2
- 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 +2 -1
- 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/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 +2 -1
- data/spec/spec_tests/data/sdam/single/direct_connection_mongos.yml +2 -1
- data/spec/spec_tests/data/sdam/single/direct_connection_replicaset.yml +2 -1
- data/spec/spec_tests/data/sdam/single/direct_connection_rsarbiter.yml +2 -1
- data/spec/spec_tests/data/sdam/single/direct_connection_rsprimary.yml +2 -1
- data/spec/spec_tests/data/sdam/single/direct_connection_rssecondary.yml +2 -1
- data/spec/spec_tests/data/sdam/single/direct_connection_standalone.yml +2 -1
- data/spec/spec_tests/data/sdam/single/direct_connection_wrong_set_name.yml +4 -2
- data/spec/spec_tests/data/sdam/single/discover_standalone.yml +2 -1
- 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/standalone_removed.yml +2 -1
- data/spec/spec_tests/data/sdam/single/{direct_connection_slave.yml → standalone_using_legacy_hello.yml} +3 -3
- 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 +4 -2
- data/spec/spec_tests/data/sdam_integration/cancel-server-check.yml +1 -1
- data/spec/spec_tests/data/sdam_integration/connectTimeoutMS.yml +2 -2
- data/spec/spec_tests/data/sdam_integration/{isMaster-command-error.yml → hello-command-error.yml} +19 -29
- data/spec/spec_tests/data/sdam_integration/{isMaster-network-error.yml → hello-network-error.yml} +9 -15
- data/spec/spec_tests/data/sdam_integration/{isMaster-timeout.yml → hello-timeout.yml} +7 -13
- data/spec/spec_tests/data/sdam_integration/rediscover-quickly-after-step-down.yml +14 -3
- data/spec/spec_tests/data/sdam_monitoring/discovered_standalone.yml +1 -1
- 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_removal.yml +3 -2
- data/spec/spec_tests/data/sdam_monitoring/required_replica_set.yml +2 -1
- data/spec/spec_tests/data/sdam_monitoring/standalone.yml +1 -1
- data/spec/spec_tests/data/sdam_monitoring/standalone_suppress_equal_description_changes.yml +2 -2
- data/spec/spec_tests/data/transactions/error-labels.yml +3 -0
- data/spec/spec_tests/data/transactions/mongos-pin-auto.yml +3 -0
- data/spec/spec_tests/data/transactions/mongos-recovery-token.yml +2 -0
- data/spec/spec_tests/data/transactions/pin-mongos.yml +6 -3
- data/spec/spec_tests/data/transactions_unified/mongos-unpin.yml +172 -0
- data/spec/spec_tests/data/versioned_api/crud-api-version-1-strict.yml +7 -6
- data/spec/spec_tests/data/versioned_api/crud-api-version-1.yml +7 -5
- data/spec/spec_tests/data/versioned_api/runcommand-helper-no-api-version-declared.yml +9 -1
- data/spec/spec_tests/data/versioned_api/test-commands-deprecation-errors.yml +1 -1
- data/spec/spec_tests/data/versioned_api/test-commands-strict-mode.yml +3 -1
- data/spec/spec_tests/data/versioned_api/transaction-handling.yml +5 -57
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +3 -0
- data/spec/spec_tests/gridfs_spec.rb +3 -0
- data/spec/spec_tests/max_staleness_spec.rb +3 -0
- data/spec/spec_tests/read_write_concern_connection_string_spec.rb +3 -0
- data/spec/spec_tests/read_write_concern_document_spec.rb +3 -0
- data/spec/spec_tests/read_write_concern_operaton_spec.rb +3 -0
- data/spec/spec_tests/retryable_reads_spec.rb +3 -0
- data/spec/spec_tests/retryable_writes_spec.rb +9 -6
- data/spec/spec_tests/sdam_integration_spec.rb +3 -0
- data/spec/spec_tests/sdam_monitoring_spec.rb +4 -1
- data/spec/spec_tests/sdam_spec.rb +4 -1
- data/spec/spec_tests/server_selection_rtt_spec.rb +3 -0
- data/spec/spec_tests/server_selection_spec.rb +3 -0
- data/spec/spec_tests/transactions_api_spec.rb +3 -0
- data/spec/spec_tests/transactions_spec.rb +3 -0
- data/spec/spec_tests/transactions_unified_spec.rb +13 -0
- data/spec/spec_tests/unified_spec.rb +3 -0
- data/spec/spec_tests/uri_options_spec.rb +3 -0
- data/spec/spec_tests/versioned_api_spec.rb +3 -0
- data/spec/stress/cleanup_spec.rb +3 -0
- data/spec/stress/connection_pool_stress_spec.rb +3 -0
- data/spec/stress/connection_pool_timing_spec.rb +3 -0
- data/spec/stress/fork_reconnect_stress_spec.rb +6 -3
- data/spec/support/authorization.rb +3 -0
- data/spec/support/aws_utils.rb +3 -0
- data/spec/support/aws_utils/base.rb +3 -0
- data/spec/support/aws_utils/inspector.rb +3 -0
- data/spec/support/aws_utils/orchestrator.rb +3 -0
- data/spec/support/aws_utils/provisioner.rb +3 -0
- data/spec/support/background_thread_registry.rb +4 -1
- data/spec/support/certificates/README.md +3 -2
- data/spec/support/certificates/atlas-ocsp-ca.crt +116 -26
- data/spec/support/certificates/atlas-ocsp.crt +150 -39
- data/spec/support/client_registry.rb +12 -5
- data/spec/support/client_registry_macros.rb +7 -4
- data/spec/support/cluster_tools.rb +4 -1
- data/spec/support/common_shortcuts.rb +25 -6
- data/spec/support/constraints.rb +3 -0
- data/spec/support/crypt.rb +3 -0
- data/spec/support/dns.rb +3 -0
- data/spec/support/event_subscriber.rb +9 -0
- data/spec/support/json_ext_formatter.rb +3 -0
- data/spec/support/keyword_struct.rb +3 -0
- data/spec/support/local_resource_registry.rb +3 -0
- data/spec/support/matchers.rb +4 -1
- data/spec/support/monitoring_ext.rb +3 -0
- data/spec/support/primary_socket.rb +3 -0
- data/spec/support/sdam_formatter_integration.rb +3 -0
- data/spec/support/session_registry.rb +3 -0
- data/spec/{mongo/server/app_metadata_shared.rb → support/shared/app_metadata.rb} +38 -7
- data/spec/support/shared/protocol.rb +3 -0
- data/spec/support/shared/scram_conversation.rb +3 -0
- data/spec/support/shared/server_selector.rb +6 -3
- data/spec/support/shared/session.rb +3 -0
- data/spec/support/spec_config.rb +43 -9
- data/spec/support/spec_setup.rb +3 -0
- data/spec/support/utils.rb +4 -1
- metadata +1031 -977
- metadata.gz.sig +0 -0
@@ -1,3 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
1
4
|
require 'spec_helper'
|
2
5
|
|
3
6
|
# fails intermittently in evergreen
|
@@ -846,6 +849,12 @@ describe Mongo::Server::Connection do
|
|
846
849
|
result
|
847
850
|
end
|
848
851
|
|
852
|
+
it 'marks server unknown' do
|
853
|
+
expect(server).not_to be_unknown
|
854
|
+
result
|
855
|
+
expect(server).to be_unknown
|
856
|
+
end
|
857
|
+
|
849
858
|
it 'does not request server scan' do
|
850
859
|
expect(server.scan_semaphore).not_to receive(:signal)
|
851
860
|
result
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
1
4
|
require 'spec_helper'
|
2
5
|
|
3
6
|
# For conciseness these tests are arranged by description types
|
@@ -93,7 +96,7 @@ describe Mongo::Server::Description do
|
|
93
96
|
end
|
94
97
|
|
95
98
|
context 'primary' do
|
96
|
-
let(:desc_options) { {'
|
99
|
+
let(:desc_options) { {'isWritablePrimary' => true,
|
97
100
|
'minWireVersion' => 2, 'maxWireVersion' => 8,
|
98
101
|
'setName' => 'foo', 'ok' => ok} }
|
99
102
|
|
@@ -1,833 +1,846 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
1
4
|
require 'spec_helper'
|
2
5
|
|
3
6
|
describe Mongo::Server::Description do
|
4
7
|
|
5
|
-
|
6
|
-
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
context 'when Time.now is mocked' do
|
55
|
-
it 'does not freeze mocked time' do
|
56
|
-
obj = Time.now
|
57
|
-
expect(Time).to receive(:now).at_least(:once).and_return(obj)
|
58
|
-
expect(obj.frozen?).to be false
|
59
|
-
|
60
|
-
description = described_class.new(address, replica)
|
61
|
-
expect(description.last_update_time).to eq(obj)
|
62
|
-
expect(obj.frozen?).to be false
|
8
|
+
%w[ismaster isWritablePrimary].each do |primary_param|
|
9
|
+
context "#{primary_param} as primary parameter" do
|
10
|
+
|
11
|
+
let(:replica) do
|
12
|
+
{
|
13
|
+
'setName' => 'mongodb_set',
|
14
|
+
primary_param => true,
|
15
|
+
'secondary' => false,
|
16
|
+
'hosts' => [
|
17
|
+
'127.0.0.1:27018',
|
18
|
+
'127.0.0.1:27019'
|
19
|
+
],
|
20
|
+
'arbiters' => [
|
21
|
+
'127.0.0.1:27120'
|
22
|
+
],
|
23
|
+
'primary' => authorized_primary.address.to_s,
|
24
|
+
'tags' => { 'rack' => 'a' },
|
25
|
+
'me' => '127.0.0.1:27019',
|
26
|
+
'maxBsonObjectSize' => 16777216,
|
27
|
+
'maxMessageSizeBytes' => 48000000,
|
28
|
+
'maxWriteBatchSize' => 1000,
|
29
|
+
'maxWireVersion' => 2,
|
30
|
+
'minWireVersion' => 1,
|
31
|
+
'localTime' => Time.now,
|
32
|
+
'lastWrite' => { 'lastWriteDate' => Time.now },
|
33
|
+
'logicalSessionTimeoutMinutes' => 7,
|
34
|
+
'operationTime' => 1,
|
35
|
+
'$clusterTime' => 1,
|
36
|
+
'connectionId' => 11,
|
37
|
+
'ok' => 1
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
let(:address) do
|
42
|
+
Mongo::Address.new(authorized_primary.address.to_s)
|
43
|
+
end
|
44
|
+
|
45
|
+
let(:monitoring) do
|
46
|
+
Mongo::Monitoring.new(monitoring: false)
|
47
|
+
end
|
48
|
+
|
49
|
+
declare_topology_double
|
50
|
+
|
51
|
+
let(:cluster) do
|
52
|
+
double('cluster').tap do |cl|
|
53
|
+
allow(cl).to receive(:topology).and_return(topology)
|
54
|
+
allow(cl).to receive(:app_metadata).and_return(app_metadata)
|
55
|
+
allow(cl).to receive(:options).and_return({})
|
56
|
+
end
|
63
57
|
end
|
64
|
-
end
|
65
|
-
end
|
66
58
|
|
67
|
-
|
59
|
+
describe '#arbiters' do
|
68
60
|
|
69
|
-
|
61
|
+
context 'when the replica set has arbiters' do
|
70
62
|
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
let(:description) do
|
64
|
+
described_class.new(address, replica)
|
65
|
+
end
|
74
66
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
67
|
+
it 'returns the arbiters' do
|
68
|
+
expect(description.arbiters).to eq([ '127.0.0.1:27120' ])
|
69
|
+
end
|
70
|
+
end
|
79
71
|
|
80
|
-
|
72
|
+
context 'when the replica set has no arbiters' do
|
81
73
|
|
82
|
-
|
83
|
-
|
84
|
-
|
74
|
+
let(:description) do
|
75
|
+
described_class.new(address, {})
|
76
|
+
end
|
85
77
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
78
|
+
it 'returns an empty array' do
|
79
|
+
expect(description.arbiters).to be_empty
|
80
|
+
end
|
81
|
+
end
|
90
82
|
|
91
|
-
|
83
|
+
context 'when the addresses are not lowercase' do
|
92
84
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
85
|
+
let(:config) do
|
86
|
+
replica.merge(
|
87
|
+
{
|
88
|
+
'arbiters' => [
|
89
|
+
'SERVER:27017'
|
90
|
+
],
|
91
|
+
}
|
92
|
+
)
|
93
|
+
end
|
102
94
|
|
103
|
-
|
104
|
-
|
105
|
-
|
95
|
+
let(:description) do
|
96
|
+
described_class.new(address, config)
|
97
|
+
end
|
106
98
|
|
107
|
-
|
108
|
-
|
99
|
+
it 'normalizes the addresses to lowercase' do
|
100
|
+
expect(description.arbiters).to eq(['server:27017'])
|
101
|
+
end
|
102
|
+
end
|
109
103
|
end
|
110
|
-
end
|
111
|
-
end
|
112
104
|
|
113
|
-
|
105
|
+
describe '#hosts' do
|
114
106
|
|
115
|
-
|
116
|
-
|
117
|
-
|
107
|
+
let(:description) do
|
108
|
+
described_class.new(address, replica)
|
109
|
+
end
|
118
110
|
|
119
|
-
|
120
|
-
|
121
|
-
|
111
|
+
it 'returns all the hosts in the replica set' do
|
112
|
+
expect(description.hosts).to eq([ '127.0.0.1:27018', '127.0.0.1:27019' ])
|
113
|
+
end
|
122
114
|
|
123
|
-
|
115
|
+
context 'when the addresses are not lowercase' do
|
124
116
|
|
125
|
-
|
126
|
-
|
127
|
-
|
117
|
+
let(:config) do
|
118
|
+
replica.merge(
|
119
|
+
{
|
128
120
|
'hosts' => [
|
129
|
-
|
121
|
+
'SERVER:27017'
|
130
122
|
],
|
131
|
-
|
132
|
-
|
133
|
-
|
123
|
+
}
|
124
|
+
)
|
125
|
+
end
|
134
126
|
|
135
|
-
|
136
|
-
|
137
|
-
|
127
|
+
let(:description) do
|
128
|
+
described_class.new(address, config)
|
129
|
+
end
|
138
130
|
|
139
|
-
|
140
|
-
|
131
|
+
it 'normalizes the addresses to lowercase' do
|
132
|
+
expect(description.hosts).to eq(['server:27017'])
|
133
|
+
end
|
134
|
+
end
|
141
135
|
end
|
142
|
-
end
|
143
|
-
end
|
144
136
|
|
145
|
-
|
137
|
+
describe '#max_bson_object_size' do
|
146
138
|
|
147
|
-
|
148
|
-
|
149
|
-
|
139
|
+
let(:description) do
|
140
|
+
described_class.new(address, replica)
|
141
|
+
end
|
150
142
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
143
|
+
it 'returns the value' do
|
144
|
+
expect(description.max_bson_object_size).to eq(16777216)
|
145
|
+
end
|
146
|
+
end
|
155
147
|
|
156
|
-
|
148
|
+
describe '#max_message_size' do
|
157
149
|
|
158
|
-
|
159
|
-
|
160
|
-
|
150
|
+
let(:description) do
|
151
|
+
described_class.new(address, replica)
|
152
|
+
end
|
161
153
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
154
|
+
it 'returns the value' do
|
155
|
+
expect(description.max_message_size).to eq(48000000)
|
156
|
+
end
|
157
|
+
end
|
166
158
|
|
167
|
-
|
159
|
+
describe '#max_write_batch_size' do
|
168
160
|
|
169
|
-
|
170
|
-
|
171
|
-
|
161
|
+
let(:description) do
|
162
|
+
described_class.new(address, replica)
|
163
|
+
end
|
172
164
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
165
|
+
it 'returns the value' do
|
166
|
+
expect(description.max_write_batch_size).to eq(1000)
|
167
|
+
end
|
168
|
+
end
|
177
169
|
|
178
|
-
|
170
|
+
describe '#max_wire_version' do
|
179
171
|
|
180
|
-
|
172
|
+
context 'when the max wire version is provided' do
|
181
173
|
|
182
|
-
|
183
|
-
|
184
|
-
|
174
|
+
let(:description) do
|
175
|
+
described_class.new(address, replica)
|
176
|
+
end
|
185
177
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
178
|
+
it 'returns the value' do
|
179
|
+
expect(description.max_wire_version).to eq(2)
|
180
|
+
end
|
181
|
+
end
|
190
182
|
|
191
|
-
|
183
|
+
context 'when the max wire version is not provided' do
|
192
184
|
|
193
|
-
|
194
|
-
|
195
|
-
|
185
|
+
let(:description) do
|
186
|
+
described_class.new(address, {})
|
187
|
+
end
|
196
188
|
|
197
|
-
|
198
|
-
|
189
|
+
it 'returns the default' do
|
190
|
+
expect(description.max_wire_version).to eq(0)
|
191
|
+
end
|
192
|
+
end
|
199
193
|
end
|
200
|
-
end
|
201
|
-
end
|
202
194
|
|
203
|
-
|
195
|
+
describe '#min_wire_version' do
|
204
196
|
|
205
|
-
|
197
|
+
context 'when the min wire version is provided' do
|
206
198
|
|
207
|
-
|
208
|
-
|
209
|
-
|
199
|
+
let(:description) do
|
200
|
+
described_class.new(address, replica)
|
201
|
+
end
|
210
202
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
203
|
+
it 'returns the value' do
|
204
|
+
expect(description.min_wire_version).to eq(1)
|
205
|
+
end
|
206
|
+
end
|
215
207
|
|
216
|
-
|
208
|
+
context 'when the min wire version is not provided' do
|
217
209
|
|
218
|
-
|
219
|
-
|
220
|
-
|
210
|
+
let(:description) do
|
211
|
+
described_class.new(address, {})
|
212
|
+
end
|
221
213
|
|
222
|
-
|
223
|
-
|
214
|
+
it 'returns the default' do
|
215
|
+
expect(description.min_wire_version).to eq(0)
|
216
|
+
end
|
217
|
+
end
|
224
218
|
end
|
225
|
-
end
|
226
|
-
end
|
227
219
|
|
228
|
-
|
220
|
+
describe '#tags' do
|
229
221
|
|
230
|
-
|
222
|
+
context 'when the server has tags' do
|
231
223
|
|
232
|
-
|
233
|
-
|
234
|
-
|
224
|
+
let(:description) do
|
225
|
+
described_class.new(address, replica)
|
226
|
+
end
|
235
227
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
228
|
+
it 'returns the tags' do
|
229
|
+
expect(description.tags).to eq(replica['tags'])
|
230
|
+
end
|
231
|
+
end
|
240
232
|
|
241
|
-
|
233
|
+
context 'when the server does not have tags' do
|
242
234
|
|
243
|
-
|
244
|
-
|
245
|
-
|
235
|
+
let(:config) do
|
236
|
+
{ primary_param => true }
|
237
|
+
end
|
246
238
|
|
247
|
-
|
248
|
-
|
249
|
-
|
239
|
+
let(:description) do
|
240
|
+
described_class.new(address, config)
|
241
|
+
end
|
250
242
|
|
251
|
-
|
252
|
-
|
243
|
+
it 'returns an empty hash' do
|
244
|
+
expect(description.tags).to eq({})
|
245
|
+
end
|
246
|
+
end
|
253
247
|
end
|
254
|
-
end
|
255
|
-
end
|
256
248
|
|
257
|
-
|
249
|
+
describe '#passives' do
|
258
250
|
|
259
|
-
|
251
|
+
context 'when passive servers exists' do
|
260
252
|
|
261
|
-
|
262
|
-
|
263
|
-
|
253
|
+
let(:description) do
|
254
|
+
described_class.new(address, { 'passives' => [ '127.0.0.1:27025' ] })
|
255
|
+
end
|
264
256
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
257
|
+
it 'returns a list of the passives' do
|
258
|
+
expect(description.passives).to eq([ '127.0.0.1:27025' ])
|
259
|
+
end
|
260
|
+
end
|
269
261
|
|
270
|
-
|
262
|
+
context 'when no passive servers exist' do
|
271
263
|
|
272
|
-
|
273
|
-
|
274
|
-
|
264
|
+
let(:description) do
|
265
|
+
described_class.new(address, replica)
|
266
|
+
end
|
275
267
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
268
|
+
it 'returns an empty array' do
|
269
|
+
expect(description.passives).to be_empty
|
270
|
+
end
|
271
|
+
end
|
280
272
|
|
281
|
-
|
273
|
+
context 'when the addresses are not lowercase' do
|
282
274
|
|
283
|
-
|
284
|
-
|
285
|
-
|
275
|
+
let(:config) do
|
276
|
+
replica.merge(
|
277
|
+
{
|
286
278
|
'passives' => [
|
287
|
-
|
279
|
+
'SERVER:27017'
|
288
280
|
],
|
289
|
-
|
290
|
-
|
291
|
-
|
281
|
+
}
|
282
|
+
)
|
283
|
+
end
|
292
284
|
|
293
|
-
|
294
|
-
|
295
|
-
|
285
|
+
let(:description) do
|
286
|
+
described_class.new(address, config)
|
287
|
+
end
|
296
288
|
|
297
|
-
|
298
|
-
|
299
|
-
|
289
|
+
it 'normalizes the addresses to lowercase' do
|
290
|
+
expect(description.passives).to eq(['server:27017'])
|
291
|
+
end
|
300
292
|
|
301
|
-
|
293
|
+
it 'normalizes the addresses to lowercase' do
|
302
294
|
|
295
|
+
end
|
296
|
+
end
|
303
297
|
end
|
304
|
-
end
|
305
|
-
end
|
306
298
|
|
307
|
-
|
299
|
+
describe '#primary?' do
|
308
300
|
|
309
|
-
|
301
|
+
context 'when the server is a primary' do
|
310
302
|
|
311
|
-
|
303
|
+
context 'when the hostname contains no capital letters' do
|
312
304
|
|
313
|
-
|
314
|
-
|
315
|
-
|
305
|
+
let(:description) do
|
306
|
+
described_class.new(address, replica)
|
307
|
+
end
|
316
308
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
309
|
+
it 'returns true' do
|
310
|
+
expect(description).to be_primary
|
311
|
+
end
|
312
|
+
end
|
321
313
|
|
322
|
-
|
314
|
+
context 'when the hostname contains capital letters' do
|
323
315
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
316
|
+
let(:description) do
|
317
|
+
described_class.new('localhost:27017',
|
318
|
+
{ primary_param => true, 'ok' => 1,
|
319
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3,
|
320
|
+
'primary' => 'LOCALHOST:27017',
|
321
|
+
'setName' => 'itsASet!'})
|
322
|
+
end
|
331
323
|
|
332
|
-
|
333
|
-
|
324
|
+
it 'returns true' do
|
325
|
+
expect(description).to be_primary
|
326
|
+
end
|
327
|
+
end
|
334
328
|
end
|
335
329
|
end
|
336
|
-
end
|
337
|
-
end
|
338
|
-
|
339
|
-
describe '#average_round_trip_time' do
|
340
|
-
|
341
|
-
let(:description) do
|
342
|
-
described_class.new(address, { 'secondary' => false }, 4.5)
|
343
|
-
end
|
344
|
-
|
345
|
-
it 'defaults to nil' do
|
346
|
-
expect(described_class.new(address).average_round_trip_time).to be nil
|
347
|
-
end
|
348
330
|
|
349
|
-
|
350
|
-
expect(description.average_round_trip_time).to eq(4.5)
|
351
|
-
end
|
352
|
-
end
|
331
|
+
describe '#average_round_trip_time' do
|
353
332
|
|
354
|
-
|
333
|
+
let(:description) do
|
334
|
+
described_class.new(address, { 'secondary' => false }, 4.5)
|
335
|
+
end
|
355
336
|
|
356
|
-
|
337
|
+
it 'defaults to nil' do
|
338
|
+
expect(described_class.new(address).average_round_trip_time).to be nil
|
339
|
+
end
|
357
340
|
|
358
|
-
|
359
|
-
|
341
|
+
it 'can be set via the constructor' do
|
342
|
+
expect(description.average_round_trip_time).to eq(4.5)
|
343
|
+
end
|
360
344
|
end
|
361
345
|
|
362
|
-
|
363
|
-
expect(description.replica_set_name).to eq('mongodb_set')
|
364
|
-
end
|
365
|
-
end
|
346
|
+
describe '#replica_set_name' do
|
366
347
|
|
367
|
-
|
348
|
+
context 'when the server is in a replica set' do
|
368
349
|
|
369
|
-
|
370
|
-
|
371
|
-
|
350
|
+
let(:description) do
|
351
|
+
described_class.new(address, replica)
|
352
|
+
end
|
372
353
|
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
end
|
354
|
+
it 'returns the replica set name' do
|
355
|
+
expect(description.replica_set_name).to eq('mongodb_set')
|
356
|
+
end
|
357
|
+
end
|
378
358
|
|
379
|
-
|
359
|
+
context 'when the server is not in a replica set' do
|
380
360
|
|
381
|
-
|
382
|
-
|
383
|
-
|
361
|
+
let(:description) do
|
362
|
+
described_class.new(address, {})
|
363
|
+
end
|
384
364
|
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
expect(description.servers).to eq(
|
391
|
-
[ '127.0.0.1:27018', '127.0.0.1:27019', '127.0.0.1:27120', '127.0.0.1:27025' ]
|
392
|
-
)
|
393
|
-
end
|
394
|
-
end
|
365
|
+
it 'returns nil' do
|
366
|
+
expect(description.replica_set_name).to be_nil
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
395
370
|
|
396
|
-
|
371
|
+
describe '#servers' do
|
397
372
|
|
398
|
-
|
373
|
+
let(:config) do
|
374
|
+
replica.merge({ 'passives' => [ '127.0.0.1:27025' ]})
|
375
|
+
end
|
399
376
|
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
'setName' => 'test', 'ok' => 1 })
|
404
|
-
end
|
377
|
+
let(:description) do
|
378
|
+
described_class.new(address, config)
|
379
|
+
end
|
405
380
|
|
406
|
-
|
407
|
-
|
381
|
+
it 'returns the hosts + arbiters + passives' do
|
382
|
+
expect(description.servers).to eq(
|
383
|
+
[ '127.0.0.1:27018', '127.0.0.1:27019', '127.0.0.1:27120', '127.0.0.1:27025' ]
|
384
|
+
)
|
385
|
+
end
|
408
386
|
end
|
409
|
-
end
|
410
|
-
|
411
|
-
context 'when the server is a ghost' do
|
412
387
|
|
413
|
-
|
414
|
-
described_class.new(address, { 'isreplicaset' => true,
|
415
|
-
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1 })
|
416
|
-
end
|
388
|
+
describe '#server_type' do
|
417
389
|
|
418
|
-
|
419
|
-
expect(description.server_type).to eq(:ghost)
|
420
|
-
end
|
421
|
-
end
|
390
|
+
context 'when the server is an arbiter' do
|
422
391
|
|
423
|
-
|
392
|
+
let(:description) do
|
393
|
+
described_class.new(address, { 'arbiterOnly' => true,
|
394
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3,
|
395
|
+
'setName' => 'test', 'ok' => 1 })
|
396
|
+
end
|
424
397
|
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
398
|
+
it 'returns :arbiter' do
|
399
|
+
expect(description.server_type).to eq(:arbiter)
|
400
|
+
end
|
401
|
+
end
|
429
402
|
|
430
|
-
|
431
|
-
described_class.new(address, config)
|
432
|
-
end
|
403
|
+
context 'when the server is a ghost' do
|
433
404
|
|
434
|
-
|
435
|
-
|
436
|
-
|
405
|
+
let(:description) do
|
406
|
+
described_class.new(address, { 'isreplicaset' => true,
|
407
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1 })
|
408
|
+
end
|
437
409
|
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1,
|
442
|
-
'me' => '127.0.0.1',
|
443
|
-
}
|
410
|
+
it 'returns :ghost' do
|
411
|
+
expect(description.server_type).to eq(:ghost)
|
412
|
+
end
|
444
413
|
end
|
445
414
|
|
446
|
-
|
447
|
-
|
415
|
+
context 'when the server is a mongos' do
|
416
|
+
|
417
|
+
let(:config) do
|
418
|
+
{ 'msg' => 'isdbgrid', primary_param => true,
|
419
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1 }
|
420
|
+
end
|
421
|
+
|
422
|
+
let(:description) do
|
423
|
+
described_class.new(address, config)
|
424
|
+
end
|
425
|
+
|
426
|
+
it 'returns :sharded' do
|
427
|
+
expect(description.server_type).to eq(:sharded)
|
428
|
+
end
|
429
|
+
|
430
|
+
context 'when client and server addresses are different' do
|
431
|
+
let(:config) do
|
432
|
+
{ 'msg' => 'isdbgrid', primary_param => true,
|
433
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1,
|
434
|
+
'me' => '127.0.0.1',
|
435
|
+
}
|
436
|
+
end
|
437
|
+
|
438
|
+
let(:address) do
|
439
|
+
Mongo::Address.new('localhost')
|
440
|
+
end
|
441
|
+
|
442
|
+
it 'returns :sharded' do
|
443
|
+
expect(description.server_type).to eq(:sharded)
|
444
|
+
end
|
445
|
+
end
|
448
446
|
end
|
449
447
|
|
450
|
-
|
451
|
-
expect(description.server_type).to eq(:sharded)
|
452
|
-
end
|
453
|
-
end
|
454
|
-
end
|
448
|
+
context 'when the server is a primary' do
|
455
449
|
|
456
|
-
|
450
|
+
let(:description) do
|
451
|
+
described_class.new(address, replica)
|
452
|
+
end
|
457
453
|
|
458
|
-
|
459
|
-
|
460
|
-
|
454
|
+
it 'returns :primary' do
|
455
|
+
expect(description.server_type).to eq(:primary)
|
456
|
+
end
|
457
|
+
end
|
461
458
|
|
462
|
-
|
463
|
-
expect(description.server_type).to eq(:primary)
|
464
|
-
end
|
465
|
-
end
|
459
|
+
context 'when the server is a secondary' do
|
466
460
|
|
467
|
-
|
461
|
+
let(:description) do
|
462
|
+
described_class.new(address, { 'secondary' => true,
|
463
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3,
|
464
|
+
'setName' => 'test', 'ok' => 1 })
|
465
|
+
end
|
468
466
|
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
end
|
467
|
+
it 'returns :secondary' do
|
468
|
+
expect(description.server_type).to eq(:secondary)
|
469
|
+
end
|
470
|
+
end
|
474
471
|
|
475
|
-
|
476
|
-
expect(description.server_type).to eq(:secondary)
|
477
|
-
end
|
478
|
-
end
|
472
|
+
context 'when the server is standalone' do
|
479
473
|
|
480
|
-
|
474
|
+
let(:description) do
|
475
|
+
described_class.new(address, { primary_param => true,
|
476
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1 })
|
477
|
+
end
|
481
478
|
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
479
|
+
it 'returns :standalone' do
|
480
|
+
expect(description.server_type).to eq(:standalone)
|
481
|
+
end
|
482
|
+
end
|
486
483
|
|
487
|
-
|
488
|
-
expect(description.server_type).to eq(:standalone)
|
489
|
-
end
|
490
|
-
end
|
484
|
+
context 'when the server is hidden' do
|
491
485
|
|
492
|
-
|
486
|
+
let(:description) do
|
487
|
+
described_class.new(address, { primary_param => false,
|
488
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'setName' => 'test',
|
489
|
+
'hidden' => true, 'ok' => 1 })
|
490
|
+
end
|
493
491
|
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
end
|
492
|
+
it 'returns :other' do
|
493
|
+
expect(description.server_type).to eq(:other)
|
494
|
+
end
|
495
|
+
end
|
499
496
|
|
500
|
-
|
501
|
-
expect(description.server_type).to eq(:other)
|
502
|
-
end
|
503
|
-
end
|
497
|
+
context 'when the server is other' do
|
504
498
|
|
505
|
-
|
499
|
+
let(:description) do
|
500
|
+
described_class.new(address, { primary_param => false,
|
501
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'setName' => 'test',
|
502
|
+
'ok' => 1 })
|
503
|
+
end
|
506
504
|
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
end
|
505
|
+
it 'returns :other' do
|
506
|
+
expect(description.server_type).to eq(:other)
|
507
|
+
end
|
508
|
+
end
|
512
509
|
|
513
|
-
|
514
|
-
expect(description.server_type).to eq(:other)
|
515
|
-
end
|
516
|
-
end
|
510
|
+
context 'when the description has no configuration' do
|
517
511
|
|
518
|
-
|
512
|
+
let(:description) do
|
513
|
+
described_class.new(address)
|
514
|
+
end
|
519
515
|
|
520
|
-
|
521
|
-
|
516
|
+
it 'returns :unknown' do
|
517
|
+
expect(description.server_type).to eq(:unknown)
|
518
|
+
end
|
519
|
+
end
|
522
520
|
end
|
523
521
|
|
524
|
-
|
525
|
-
expect(description.server_type).to eq(:unknown)
|
526
|
-
end
|
527
|
-
end
|
528
|
-
end
|
522
|
+
describe '#is_server?' do
|
529
523
|
|
530
|
-
|
524
|
+
let(:listeners) do
|
525
|
+
Mongo::Event::Listeners.new
|
526
|
+
end
|
531
527
|
|
532
|
-
|
533
|
-
|
534
|
-
|
528
|
+
let(:server) do
|
529
|
+
Mongo::Server.new(address, cluster, monitoring, listeners,
|
530
|
+
monitoring_io: false)
|
531
|
+
end
|
535
532
|
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
end
|
533
|
+
let(:description) do
|
534
|
+
described_class.new(address, {})
|
535
|
+
end
|
540
536
|
|
541
|
-
|
542
|
-
described_class.new(address, {})
|
543
|
-
end
|
537
|
+
context 'when the server address matches the description address' do
|
544
538
|
|
545
|
-
|
539
|
+
it 'returns true' do
|
540
|
+
expect(description.is_server?(server)).to be(true)
|
541
|
+
end
|
542
|
+
end
|
546
543
|
|
547
|
-
|
548
|
-
expect(description.is_server?(server)).to be(true)
|
549
|
-
end
|
550
|
-
end
|
544
|
+
context 'when the server address does not match the description address' do
|
551
545
|
|
552
|
-
|
546
|
+
let(:other_address) do
|
547
|
+
Mongo::Address.new('127.0.0.1:27020')
|
548
|
+
end
|
553
549
|
|
554
|
-
|
555
|
-
|
556
|
-
|
550
|
+
let(:server) do
|
551
|
+
Mongo::Server.new(other_address, cluster, monitoring, listeners,
|
552
|
+
monitoring_io: false)
|
553
|
+
end
|
557
554
|
|
558
|
-
|
559
|
-
|
560
|
-
|
555
|
+
it 'returns false' do
|
556
|
+
expect(description.is_server?(server)).to be(false)
|
557
|
+
end
|
558
|
+
end
|
561
559
|
end
|
562
560
|
|
563
|
-
|
564
|
-
expect(description.is_server?(server)).to be(false)
|
565
|
-
end
|
566
|
-
end
|
567
|
-
end
|
561
|
+
describe '#me_mismatch?' do
|
568
562
|
|
569
|
-
|
563
|
+
let(:description) do
|
564
|
+
described_class.new(address, config)
|
565
|
+
end
|
570
566
|
|
571
|
-
|
572
|
-
described_class.new(address, config)
|
573
|
-
end
|
567
|
+
context 'when the server address matches the me field' do
|
574
568
|
|
575
|
-
|
569
|
+
let(:config) do
|
570
|
+
replica.merge('me' => address.to_s)
|
571
|
+
end
|
576
572
|
|
577
|
-
|
578
|
-
|
579
|
-
|
573
|
+
it 'returns false' do
|
574
|
+
expect(description.me_mismatch?).to be(false)
|
575
|
+
end
|
576
|
+
end
|
580
577
|
|
581
|
-
|
582
|
-
expect(description.me_mismatch?).to be(false)
|
583
|
-
end
|
584
|
-
end
|
578
|
+
context 'when the server address does not match the me field' do
|
585
579
|
|
586
|
-
|
580
|
+
let(:config) do
|
581
|
+
replica.merge('me' => 'localhost:27020')
|
582
|
+
end
|
587
583
|
|
588
|
-
|
589
|
-
|
590
|
-
|
584
|
+
it 'returns true' do
|
585
|
+
expect(description.me_mismatch?).to be(true)
|
586
|
+
end
|
587
|
+
end
|
591
588
|
|
592
|
-
|
593
|
-
expect(description.me_mismatch?).to be(true)
|
594
|
-
end
|
595
|
-
end
|
589
|
+
context 'when there is no me field' do
|
596
590
|
|
597
|
-
|
591
|
+
let(:config) do
|
592
|
+
replica.tap do |r|
|
593
|
+
r.delete('me')
|
594
|
+
end
|
595
|
+
end
|
598
596
|
|
599
|
-
|
600
|
-
|
601
|
-
|
597
|
+
it 'returns false' do
|
598
|
+
expect(description.me_mismatch?).to be(false)
|
599
|
+
end
|
602
600
|
end
|
603
601
|
end
|
604
602
|
|
605
|
-
|
606
|
-
expect(description.me_mismatch?).to be(false)
|
607
|
-
end
|
608
|
-
end
|
609
|
-
end
|
603
|
+
describe '#lists_server?' do
|
610
604
|
|
611
|
-
|
605
|
+
let(:description) do
|
606
|
+
described_class.new(address, replica)
|
607
|
+
end
|
612
608
|
|
613
|
-
|
614
|
-
|
615
|
-
|
609
|
+
let(:server_address) do
|
610
|
+
Mongo::Address.new('127.0.0.1:27018')
|
611
|
+
end
|
616
612
|
|
617
|
-
|
618
|
-
|
619
|
-
|
613
|
+
let(:listeners) do
|
614
|
+
Mongo::Event::Listeners.new
|
615
|
+
end
|
620
616
|
|
621
|
-
|
622
|
-
|
623
|
-
|
617
|
+
let(:server) do
|
618
|
+
Mongo::Server.new(server_address, cluster, monitoring, listeners,
|
619
|
+
monitoring_io: false)
|
620
|
+
end
|
624
621
|
|
625
|
-
|
626
|
-
Mongo::Server.new(server_address, cluster, monitoring, listeners,
|
627
|
-
monitoring_io: false)
|
628
|
-
end
|
622
|
+
context 'when the server is included in the description hosts list' do
|
629
623
|
|
630
|
-
|
624
|
+
it 'returns true' do
|
625
|
+
expect(description.lists_server?(server)).to be(true)
|
626
|
+
end
|
627
|
+
end
|
631
628
|
|
632
|
-
|
633
|
-
expect(description.lists_server?(server)).to be(true)
|
634
|
-
end
|
635
|
-
end
|
629
|
+
context 'when the server is not included in the description hosts list' do
|
636
630
|
|
637
|
-
|
631
|
+
let(:server_address) do
|
632
|
+
Mongo::Address.new('127.0.0.1:27017')
|
633
|
+
end
|
638
634
|
|
639
|
-
|
640
|
-
|
635
|
+
it 'returns false' do
|
636
|
+
expect(description.lists_server?(server)).to be(false)
|
637
|
+
end
|
638
|
+
end
|
641
639
|
end
|
642
640
|
|
643
|
-
|
644
|
-
expect(description.lists_server?(server)).to be(false)
|
645
|
-
end
|
646
|
-
end
|
647
|
-
end
|
641
|
+
describe '#replica_set_member?' do
|
648
642
|
|
649
|
-
|
643
|
+
context 'when the description is from a mongos' do
|
650
644
|
|
651
|
-
|
645
|
+
let(:config) do
|
646
|
+
{ 'msg' => 'isdbgrid', primary_param => true }
|
647
|
+
end
|
652
648
|
|
653
|
-
|
654
|
-
|
655
|
-
|
649
|
+
let(:description) do
|
650
|
+
described_class.new(address, config)
|
651
|
+
end
|
656
652
|
|
657
|
-
|
658
|
-
|
659
|
-
|
653
|
+
it 'returns false' do
|
654
|
+
expect(description.replica_set_member?).to be(false)
|
655
|
+
end
|
656
|
+
end
|
660
657
|
|
661
|
-
|
662
|
-
expect(description.replica_set_member?).to be(false)
|
663
|
-
end
|
664
|
-
end
|
658
|
+
context 'when the description is from a standalone' do
|
665
659
|
|
666
|
-
|
660
|
+
let(:description) do
|
661
|
+
described_class.new(address, { primary_param => true,
|
662
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1 })
|
663
|
+
end
|
667
664
|
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
665
|
+
it 'returns false' do
|
666
|
+
expect(description.replica_set_member?).to be(false)
|
667
|
+
end
|
668
|
+
end
|
672
669
|
|
673
|
-
|
674
|
-
expect(description.replica_set_member?).to be(false)
|
675
|
-
end
|
676
|
-
end
|
670
|
+
context 'when the description is from a replica set member' do
|
677
671
|
|
678
|
-
|
672
|
+
let(:description) do
|
673
|
+
described_class.new(address, replica)
|
674
|
+
end
|
679
675
|
|
680
|
-
|
681
|
-
|
676
|
+
it 'returns true' do
|
677
|
+
expect(description.replica_set_member?).to be(true)
|
678
|
+
end
|
679
|
+
end
|
682
680
|
end
|
683
681
|
|
684
|
-
|
685
|
-
expect(description.replica_set_member?).to be(true)
|
686
|
-
end
|
687
|
-
end
|
688
|
-
end
|
682
|
+
describe '#logical_session_timeout_minutes' do
|
689
683
|
|
690
|
-
|
684
|
+
context 'when a logical session timeout value is in the config' do
|
691
685
|
|
692
|
-
|
686
|
+
let(:description) do
|
687
|
+
described_class.new(address, replica)
|
688
|
+
end
|
693
689
|
|
694
|
-
|
695
|
-
|
696
|
-
|
690
|
+
it 'returns the logical session timeout value' do
|
691
|
+
expect(description.logical_session_timeout).to eq(7)
|
692
|
+
end
|
693
|
+
end
|
697
694
|
|
698
|
-
|
699
|
-
expect(description.logical_session_timeout).to eq(7)
|
700
|
-
end
|
701
|
-
end
|
695
|
+
context 'when a logical session timeout value is not in the config' do
|
702
696
|
|
703
|
-
|
697
|
+
let(:description) do
|
698
|
+
described_class.new(address, { primary_param => true,
|
699
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1 })
|
700
|
+
end
|
704
701
|
|
705
|
-
|
706
|
-
|
707
|
-
|
702
|
+
it 'returns nil' do
|
703
|
+
expect(description.logical_session_timeout).to be(nil)
|
704
|
+
end
|
705
|
+
end
|
708
706
|
end
|
709
707
|
|
710
|
-
|
711
|
-
expect(description.logical_session_timeout).to be(nil)
|
712
|
-
end
|
713
|
-
end
|
714
|
-
end
|
708
|
+
describe '#==' do
|
715
709
|
|
716
|
-
|
710
|
+
let(:description) do
|
711
|
+
described_class.new(address, replica)
|
712
|
+
end
|
717
713
|
|
718
|
-
|
719
|
-
|
720
|
-
|
714
|
+
let(:other) do
|
715
|
+
described_class.new(address, replica.merge(
|
716
|
+
'localTime' => 1,
|
717
|
+
'lastWrite' => { 'lastWriteDate' => 1 },
|
718
|
+
'operationTime' => 2,
|
719
|
+
'$clusterTime' => 2
|
720
|
+
))
|
721
|
+
end
|
721
722
|
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
'lastWrite' => { 'lastWriteDate' => 1 },
|
726
|
-
'operationTime' => 2,
|
727
|
-
'$clusterTime' => 2
|
728
|
-
))
|
729
|
-
end
|
723
|
+
it 'excludes certain fields' do
|
724
|
+
expect(description == other).to be(true)
|
725
|
+
end
|
730
726
|
|
731
|
-
|
732
|
-
expect(description == other).to be(true)
|
733
|
-
end
|
727
|
+
context 'when the classes do not match' do
|
734
728
|
|
735
|
-
|
729
|
+
let(:description) do
|
730
|
+
described_class.new(address, replica)
|
731
|
+
end
|
736
732
|
|
737
|
-
|
738
|
-
|
739
|
-
|
733
|
+
it 'returns false' do
|
734
|
+
expect(description == Array.new).to be(false)
|
735
|
+
end
|
736
|
+
end
|
740
737
|
|
741
|
-
|
742
|
-
expect(description == Array.new).to be(false)
|
743
|
-
end
|
744
|
-
end
|
738
|
+
context 'when the configs match' do
|
745
739
|
|
746
|
-
|
740
|
+
let(:description) do
|
741
|
+
described_class.new(address, replica)
|
742
|
+
end
|
747
743
|
|
748
|
-
|
749
|
-
|
750
|
-
|
744
|
+
let(:other) do
|
745
|
+
described_class.new(address, replica)
|
746
|
+
end
|
751
747
|
|
752
|
-
|
753
|
-
|
754
|
-
|
748
|
+
it 'returns true' do
|
749
|
+
expect(description == other).to be(true)
|
750
|
+
end
|
751
|
+
end
|
755
752
|
|
756
|
-
|
757
|
-
expect(description == other).to be(true)
|
758
|
-
end
|
759
|
-
end
|
753
|
+
context 'when the configs match, but have different connectionId values' do
|
760
754
|
|
761
|
-
|
755
|
+
let(:description) do
|
756
|
+
described_class.new(address, replica)
|
757
|
+
end
|
762
758
|
|
763
|
-
|
764
|
-
|
765
|
-
|
759
|
+
let(:other) do
|
760
|
+
described_class.new(address, replica.merge(
|
761
|
+
'connectionId' => 12
|
762
|
+
))
|
763
|
+
end
|
766
764
|
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
end
|
765
|
+
it 'returns true' do
|
766
|
+
expect(description == other).to be(true)
|
767
|
+
end
|
768
|
+
end
|
772
769
|
|
773
|
-
|
774
|
-
expect(description == other).to be(true)
|
775
|
-
end
|
776
|
-
end
|
770
|
+
context 'when the configs do not match' do
|
777
771
|
|
778
|
-
|
772
|
+
let(:description) do
|
773
|
+
described_class.new(address, replica)
|
774
|
+
end
|
779
775
|
|
780
|
-
|
781
|
-
|
782
|
-
|
776
|
+
let(:other) do
|
777
|
+
described_class.new(address, { primary_param => true,
|
778
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1 })
|
779
|
+
end
|
783
780
|
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
781
|
+
it 'returns false' do
|
782
|
+
expect(description == other).to be(false)
|
783
|
+
end
|
784
|
+
end
|
788
785
|
|
789
|
-
|
790
|
-
|
786
|
+
context 'when one config is a subset of the other' do
|
787
|
+
let(:one) do
|
788
|
+
described_class.new(address, { primary_param => true,
|
789
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1 })
|
790
|
+
end
|
791
|
+
|
792
|
+
let(:two) do
|
793
|
+
described_class.new(address, { primary_param => true,
|
794
|
+
'minWireVersion' => 2, 'maxWireVersion' => 3,
|
795
|
+
'ok' => 1, 'setName' => 'mongodb_set' })
|
796
|
+
end
|
797
|
+
|
798
|
+
it 'returns false when first config is the receiver' do
|
799
|
+
expect(one == two).to be false
|
800
|
+
end
|
801
|
+
|
802
|
+
it 'returns false when second config is the receiver' do
|
803
|
+
expect(two == one).to be false
|
804
|
+
end
|
805
|
+
end
|
791
806
|
end
|
792
|
-
end
|
793
807
|
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
'minWireVersion' => 2, 'maxWireVersion' => 3, 'ok' => 1 })
|
798
|
-
end
|
808
|
+
describe '#last_update_time' do
|
809
|
+
context 'stub description' do
|
810
|
+
let(:description) { described_class.new(address) }
|
799
811
|
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
end
|
812
|
+
it 'is present' do
|
813
|
+
expect(description.last_update_time).to be_a(Time)
|
814
|
+
end
|
815
|
+
end
|
805
816
|
|
806
|
-
|
807
|
-
|
808
|
-
end
|
817
|
+
context 'filled out description' do
|
818
|
+
let(:description) { described_class.new(address, replica) }
|
809
819
|
|
810
|
-
|
811
|
-
|
820
|
+
it 'is present' do
|
821
|
+
expect(description.last_update_time).to be_a(Time)
|
822
|
+
end
|
823
|
+
end
|
812
824
|
end
|
813
|
-
end
|
814
|
-
end
|
815
825
|
|
816
|
-
|
817
|
-
|
818
|
-
|
826
|
+
describe '#last_update_monotime' do
|
827
|
+
context 'stub description' do
|
828
|
+
let(:description) { described_class.new(address) }
|
819
829
|
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
830
|
+
it 'is present' do
|
831
|
+
expect(description.last_update_monotime).to be_a(Float)
|
832
|
+
end
|
833
|
+
end
|
824
834
|
|
825
|
-
|
826
|
-
|
835
|
+
context 'filled out description' do
|
836
|
+
let(:description) { described_class.new(address, replica) }
|
827
837
|
|
828
|
-
|
829
|
-
|
838
|
+
it 'is present' do
|
839
|
+
expect(description.last_update_monotime).to be_a(Float)
|
840
|
+
end
|
841
|
+
end
|
830
842
|
end
|
831
843
|
end
|
844
|
+
|
832
845
|
end
|
833
846
|
end
|