mongo 2.15.0 → 2.17.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 +0 -0
- data/README.md +1 -1
- data/lib/mongo/auth/aws/request.rb +0 -1
- data/lib/mongo/bulk_write.rb +2 -2
- data/lib/mongo/client.rb +49 -5
- data/lib/mongo/cluster/periodic_executor.rb +4 -3
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +76 -43
- data/lib/mongo/cluster/sdam_flow.rb +9 -3
- data/lib/mongo/cluster/topology/base.rb +13 -9
- data/lib/mongo/cluster/topology/load_balanced.rb +102 -0
- data/lib/mongo/cluster/topology.rb +28 -8
- data/lib/mongo/cluster.rb +136 -51
- data/lib/mongo/collection/view/aggregation.rb +63 -23
- data/lib/mongo/collection/view/builder/aggregation.rb +16 -17
- data/lib/mongo/collection/view/builder/map_reduce.rb +12 -49
- data/lib/mongo/collection/view/builder.rb +0 -4
- data/lib/mongo/collection/view/change_stream.rb +7 -3
- data/lib/mongo/collection/view/iterable.rb +60 -27
- data/lib/mongo/collection/view/map_reduce.rb +41 -15
- data/lib/mongo/collection/view/readable.rb +84 -52
- data/lib/mongo/collection/view/writable.rb +201 -175
- data/lib/mongo/collection/view.rb +15 -21
- data/lib/mongo/collection.rb +34 -14
- data/lib/mongo/cursor/kill_spec.rb +38 -0
- data/lib/mongo/cursor.rb +72 -31
- data/lib/mongo/database/view.rb +5 -3
- data/lib/mongo/database.rb +6 -6
- data/lib/mongo/error/bad_load_balancer_target.rb +26 -0
- data/lib/mongo/error/missing_service_id.rb +26 -0
- data/lib/mongo/error/no_service_connection_available.rb +49 -0
- data/lib/mongo/error/notable.rb +7 -0
- data/lib/mongo/error/snapshot_session_invalid_server_version.rb +31 -0
- data/lib/mongo/error/snapshot_session_transaction_prohibited.rb +30 -0
- data/lib/mongo/error.rb +5 -0
- data/lib/mongo/grid/fs_bucket.rb +21 -2
- data/lib/mongo/id.rb +7 -5
- data/lib/mongo/index/view.rb +22 -41
- data/lib/mongo/monitoring/event/cmap/pool_cleared.rb +7 -4
- data/lib/mongo/monitoring/event/command_failed.rb +1 -1
- data/lib/mongo/monitoring/event/command_started.rb +2 -0
- data/lib/mongo/monitoring/publishable.rb +2 -2
- data/lib/mongo/operation/aggregate/command.rb +8 -0
- data/lib/mongo/operation/context.rb +19 -1
- data/lib/mongo/operation/count/command.rb +6 -0
- data/lib/mongo/operation/count/op_msg.rb +6 -0
- data/lib/mongo/operation/create/command.rb +7 -1
- data/lib/mongo/operation/create/op_msg.rb +7 -0
- data/lib/mongo/operation/create_index/command.rb +17 -1
- data/lib/mongo/operation/create_index/op_msg.rb +17 -4
- data/lib/mongo/operation/delete/command.rb +6 -3
- data/lib/mongo/operation/delete/legacy.rb +9 -2
- data/lib/mongo/operation/delete/op_msg.rb +9 -1
- data/lib/mongo/operation/distinct/command.rb +6 -0
- data/lib/mongo/operation/distinct/op_msg.rb +7 -0
- data/lib/mongo/operation/explain/command.rb +13 -1
- data/lib/mongo/operation/explain/legacy.rb +12 -5
- data/lib/mongo/operation/explain/op_msg.rb +9 -1
- data/lib/mongo/operation/find/builder/command.rb +111 -0
- data/lib/mongo/{collection/view → operation/find}/builder/flags.rb +10 -14
- data/lib/mongo/operation/find/builder/legacy.rb +123 -0
- data/lib/mongo/{collection/view → operation/find}/builder/modifiers.rb +31 -25
- data/lib/mongo/{cursor → operation/find}/builder.rb +4 -4
- data/lib/mongo/operation/find/command.rb +9 -0
- data/lib/mongo/operation/find/legacy.rb +10 -1
- data/lib/mongo/operation/find/op_msg.rb +12 -0
- data/lib/mongo/operation/find.rb +1 -0
- data/lib/mongo/operation/get_more/command.rb +1 -0
- data/lib/mongo/operation/get_more/command_builder.rb +38 -0
- data/lib/mongo/operation/get_more/op_msg.rb +1 -0
- data/lib/mongo/operation/get_more.rb +1 -0
- data/lib/mongo/operation/kill_cursors/command.rb +8 -0
- data/lib/mongo/operation/kill_cursors/command_builder.rb +35 -0
- data/lib/mongo/operation/kill_cursors/legacy.rb +2 -1
- data/lib/mongo/operation/kill_cursors/op_msg.rb +10 -0
- data/lib/mongo/operation/kill_cursors.rb +1 -0
- data/lib/mongo/operation/map_reduce/command.rb +8 -0
- data/lib/mongo/operation/map_reduce/op_msg.rb +1 -1
- data/lib/mongo/operation/result.rb +6 -0
- data/lib/mongo/operation/shared/executable.rb +19 -1
- data/lib/mongo/operation/shared/polymorphic_operation.rb +1 -1
- data/lib/mongo/operation/shared/read_preference_supported.rb +3 -1
- data/lib/mongo/operation/shared/response_handling.rb +1 -0
- data/lib/mongo/operation/shared/sessions_supported.rb +28 -12
- data/lib/mongo/operation/shared/specifiable.rb +11 -29
- data/lib/mongo/operation/shared/validatable.rb +87 -0
- data/lib/mongo/operation/shared/write.rb +1 -1
- data/lib/mongo/operation/update/command.rb +6 -3
- data/lib/mongo/operation/update/legacy.rb +19 -11
- data/lib/mongo/operation/update/op_msg.rb +8 -4
- data/lib/mongo/operation/write_command/command.rb +51 -0
- data/lib/mongo/operation/write_command/op_msg.rb +43 -0
- data/lib/mongo/operation/write_command.rb +32 -0
- data/lib/mongo/operation.rb +10 -0
- data/lib/mongo/protocol/query.rb +35 -18
- data/lib/mongo/server/connection.rb +25 -3
- data/lib/mongo/server/connection_base.rb +12 -1
- data/lib/mongo/server/connection_common.rb +38 -1
- data/lib/mongo/server/connection_pool/generation_manager.rb +71 -0
- data/lib/mongo/server/connection_pool.rb +100 -27
- data/lib/mongo/server/description/features.rb +20 -17
- data/lib/mongo/server/description/load_balancer.rb +33 -0
- data/lib/mongo/server/description.rb +85 -6
- data/lib/mongo/server/monitor/connection.rb +5 -6
- data/lib/mongo/server/monitor.rb +2 -1
- data/lib/mongo/server/pending_connection.rb +47 -31
- data/lib/mongo/server/push_monitor.rb +10 -1
- data/lib/mongo/server.rb +73 -26
- data/lib/mongo/server_selector/base.rb +31 -5
- data/lib/mongo/session/session_pool.rb +11 -0
- data/lib/mongo/session.rb +40 -1
- data/lib/mongo/socket/ocsp_cache.rb +2 -3
- data/lib/mongo/socket/ocsp_verifier.rb +6 -37
- data/lib/mongo/socket.rb +1 -5
- data/lib/mongo/uri/options_mapper.rb +1 -0
- data/lib/mongo/uri/srv_protocol.rb +6 -8
- data/lib/mongo/uri.rb +18 -0
- data/lib/mongo/utils.rb +0 -13
- data/lib/mongo/version.rb +1 -1
- data/mongo.gemspec +1 -1
- data/spec/integration/auth_spec.rb +31 -1
- data/spec/integration/awaited_ismaster_spec.rb +1 -1
- data/spec/integration/bulk_write_spec.rb +1 -1
- data/spec/integration/change_stream_spec.rb +3 -3
- data/spec/integration/client_construction_spec.rb +54 -0
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +1 -1
- data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +1 -1
- data/spec/integration/client_side_encryption/bson_size_limit_spec.rb +1 -1
- data/spec/integration/client_side_encryption/data_key_spec.rb +1 -1
- data/spec/integration/client_spec.rb +2 -0
- data/spec/integration/command_monitoring_spec.rb +1 -1
- data/spec/integration/command_spec.rb +1 -1
- data/spec/integration/connection_spec.rb +52 -35
- data/spec/integration/crud_spec.rb +174 -1
- data/spec/integration/cursor_pinning_spec.rb +121 -0
- data/spec/integration/cursor_reaping_spec.rb +8 -4
- data/spec/integration/fork_reconnect_spec.rb +1 -5
- data/spec/integration/get_more_spec.rb +1 -1
- data/spec/integration/heartbeat_events_spec.rb +1 -1
- data/spec/integration/map_reduce_spec.rb +77 -0
- data/spec/integration/query_cache_spec.rb +47 -2
- data/spec/integration/query_cache_transactions_spec.rb +1 -1
- data/spec/integration/read_concern_spec.rb +1 -1
- data/spec/integration/read_preference_spec.rb +17 -13
- data/spec/integration/reconnect_spec.rb +30 -12
- data/spec/integration/retryable_errors_spec.rb +1 -1
- data/spec/integration/retryable_writes/retryable_writes_36_and_older_spec.rb +1 -1
- data/spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb +1 -1
- data/spec/integration/sdam_error_handling_spec.rb +5 -3
- data/spec/integration/sdam_events_spec.rb +35 -19
- data/spec/integration/sdam_prose_spec.rb +1 -1
- data/spec/integration/server_monitor_spec.rb +1 -0
- data/spec/integration/server_selector_spec.rb +22 -5
- data/spec/integration/server_spec.rb +2 -0
- data/spec/integration/srv_monitoring_spec.rb +1 -1
- data/spec/integration/step_down_spec.rb +1 -1
- data/spec/integration/transaction_pinning_spec.rb +120 -0
- data/spec/integration/versioned_api_examples_spec.rb +45 -0
- data/spec/integration/x509_auth_spec.rb +1 -1
- data/spec/lite_spec_helper.rb +1 -2
- data/spec/mongo/address/unix_spec.rb +1 -0
- data/spec/mongo/auth/cr_spec.rb +2 -3
- data/spec/mongo/auth/ldap_spec.rb +2 -3
- data/spec/mongo/auth/scram_spec.rb +2 -3
- data/spec/mongo/auth/user/view_spec.rb +1 -1
- data/spec/mongo/auth/x509_spec.rb +2 -3
- data/spec/mongo/bulk_write_spec.rb +3 -3
- data/spec/mongo/client_construction_spec.rb +259 -28
- data/spec/mongo/client_spec.rb +6 -4
- data/spec/mongo/cluster/cursor_reaper_spec.rb +36 -21
- data/spec/mongo/cluster/periodic_executor_spec.rb +3 -1
- data/spec/mongo/cluster_spec.rb +44 -3
- data/spec/mongo/collection/view/aggregation_spec.rb +72 -96
- data/spec/mongo/collection/view/builder/find_command_spec.rb +4 -0
- data/spec/mongo/collection/view/builder/op_query_spec.rb +4 -0
- data/spec/mongo/collection/view/change_stream_spec.rb +1 -1
- data/spec/mongo/collection/view/map_reduce_spec.rb +15 -2
- data/spec/mongo/collection_crud_spec.rb +7 -2
- data/spec/mongo/collection_ddl_spec.rb +1 -1
- data/spec/mongo/collection_spec.rb +1 -1
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +4 -0
- data/spec/mongo/cursor/builder/op_get_more_spec.rb +4 -0
- data/spec/mongo/cursor_spec.rb +15 -5
- data/spec/mongo/database_spec.rb +15 -15
- data/spec/mongo/error/operation_failure_heavy_spec.rb +1 -1
- data/spec/mongo/grid/fs_bucket_spec.rb +18 -12
- data/spec/mongo/grid/stream/write_spec.rb +3 -9
- data/spec/mongo/grid/stream_spec.rb +1 -1
- data/spec/mongo/index/view_spec.rb +2 -2
- data/spec/mongo/operation/delete/op_msg_spec.rb +1 -1
- data/spec/mongo/{collection/view → operation/find}/builder/flags_spec.rb +2 -2
- data/spec/mongo/{collection/view → operation/find}/builder/modifiers_spec.rb +2 -2
- data/spec/mongo/operation/find/legacy_spec.rb +1 -0
- data/spec/mongo/operation/insert/bulk_spec.rb +1 -1
- data/spec/mongo/operation/insert/op_msg_spec.rb +1 -1
- data/spec/mongo/operation/kill_cursors_spec.rb +4 -1
- data/spec/mongo/operation/read_preference_legacy_spec.rb +4 -0
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +26 -1
- data/spec/mongo/operation/update/bulk_spec.rb +1 -1
- data/spec/mongo/operation/update/op_msg_spec.rb +1 -1
- data/spec/mongo/query_cache_spec.rb +6 -2
- data/spec/mongo/server/connection_common_spec.rb +62 -11
- data/spec/mongo/server/connection_pool_spec.rb +73 -7
- data/spec/mongo/server/connection_spec.rb +138 -43
- data/spec/mongo/server/description_spec.rb +1 -1
- data/spec/mongo/server/monitor/connection_spec.rb +22 -0
- data/spec/mongo/server/monitor_spec.rb +4 -3
- data/spec/mongo/server/push_monitor_spec.rb +101 -0
- data/spec/mongo/server_selector_spec.rb +136 -15
- data/spec/mongo/session/session_pool_spec.rb +42 -10
- data/spec/mongo/session_transaction_spec.rb +15 -30
- data/spec/mongo/socket/ssl_spec.rb +26 -58
- data/spec/mongo/socket/unix_spec.rb +1 -0
- data/spec/mongo/uri_option_parsing_spec.rb +38 -5
- data/spec/mongo/utils_spec.rb +0 -14
- data/spec/runners/change_streams/test.rb +1 -1
- data/spec/runners/cmap.rb +1 -1
- data/spec/runners/connection_string.rb +7 -3
- data/spec/runners/crud/operation.rb +5 -3
- data/spec/runners/crud/requirement.rb +1 -0
- data/spec/runners/crud/verifier.rb +1 -2
- data/spec/runners/crud.rb +1 -1
- data/spec/runners/sdam.rb +2 -1
- data/spec/runners/transactions/test.rb +2 -2
- data/spec/runners/unified/assertions.rb +5 -4
- data/spec/runners/unified/crud_operations.rb +77 -23
- data/spec/runners/unified/ddl_operations.rb +29 -1
- data/spec/runners/unified/entity_map.rb +3 -3
- data/spec/runners/unified/event_subscriber.rb +2 -2
- data/spec/runners/unified/support_operations.rb +16 -3
- data/spec/runners/unified/test.rb +18 -3
- data/spec/runners/unified.rb +1 -1
- data/spec/shared/lib/mrss/cluster_config.rb +6 -1
- data/spec/shared/lib/mrss/constraints.rb +11 -5
- data/spec/shared/lib/mrss/event_subscriber.rb +200 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +17 -12
- data/spec/shared/share/Dockerfile.erb +5 -4
- data/spec/shared/shlib/server.sh +70 -20
- data/spec/spec_tests/change_streams_spec.rb +1 -1
- data/spec/spec_tests/cmap_spec.rb +4 -1
- data/spec/spec_tests/command_monitoring_spec.rb +2 -2
- data/spec/spec_tests/data/command_monitoring/find.yml +9 -9
- data/spec/spec_tests/data/crud/read/aggregate-collation.yml +2 -1
- data/spec/spec_tests/data/crud/read/aggregate-out.yml +1 -0
- data/spec/spec_tests/data/crud/read/count-collation.yml +2 -1
- data/spec/spec_tests/data/crud/read/distinct-collation.yml +2 -1
- data/spec/spec_tests/data/crud/read/find-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/bulkWrite-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/deleteMany-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/deleteOne-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/findOneAndDelete-collation.yml +3 -2
- data/spec/spec_tests/data/crud/write/findOneAndReplace-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/findOneAndUpdate-collation.yml +3 -2
- data/spec/spec_tests/data/crud/write/replaceOne-collation.yml +3 -2
- data/spec/spec_tests/data/crud/write/updateMany-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/updateOne-collation.yml +2 -1
- data/spec/spec_tests/data/crud_unified/aggregate-let.yml +138 -0
- data/spec/spec_tests/data/crud_unified/aggregate-write-readPreference.yml +155 -0
- data/spec/spec_tests/data/crud_unified/db-aggregate-write-readPreference.yml +151 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-let.yml +91 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-let.yml +89 -0
- data/spec/spec_tests/data/crud_unified/find-let.yml +71 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-let.yml +88 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-let.yml +94 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-let.yml +96 -0
- data/spec/spec_tests/data/crud_unified/updateMany-let.yml +103 -0
- data/spec/spec_tests/data/crud_unified/updateOne-let.yml +98 -0
- data/spec/spec_tests/data/load_balancers/event-monitoring.yml +99 -0
- data/spec/spec_tests/data/load_balancers/lb-connection-establishment.yml +36 -0
- data/spec/spec_tests/data/load_balancers/non-lb-connection-establishment.yml +56 -0
- data/spec/spec_tests/data/load_balancers/server-selection.yml +50 -0
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/DefaultNoMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/LastUpdateTime.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Nearest.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Nearest2.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred_tags.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Secondary.yml +4 -4
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred_tags.yml +4 -4
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/ZeroMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/DefaultNoMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/LastUpdateTime.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/LongHeartbeat.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/LongHeartbeat2.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/MaxStalenessTooSmall.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/MaxStalenessWithModePrimary.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Nearest.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Nearest2.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Nearest_tags.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/PrimaryPreferred.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags.yml +5 -5
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags2.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Secondary_tags.yml +5 -5
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Secondary_tags2.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/ZeroMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/Sharded/SmallMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/Single/SmallMaxStaleness.yml +1 -1
- data/spec/spec_tests/data/max_staleness/Unknown/SmallMaxStaleness.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/mapReduce.yml +3 -1
- data/spec/spec_tests/data/sdam/load-balanced/discover_load_balancer.yml +25 -0
- data/spec/spec_tests/data/sdam_integration/find-network-error.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/find-shutdown-error.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/hello-command-error.yml +3 -1
- data/spec/spec_tests/data/sdam_integration/hello-network-error.yml +3 -1
- data/spec/spec_tests/data/sdam_integration/hello-timeout.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/insert-network-error.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/insert-shutdown-error.yml +2 -0
- data/spec/spec_tests/data/sdam_monitoring/load_balancer.yml +65 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-directConnection.yml +13 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-replicaSet-errors.yml +6 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-true-multiple-hosts.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-true-txt.yml +10 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/direct-connection-false.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/direct-connection-true.yml +0 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/encoded-userinfo-and-db.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/loadBalanced-false-txt.yml +10 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/longer-parent-in-return.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/misformatted-option.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/no-results.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/not-enough-parts.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/one-result-default-port.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/one-txt-record-multiple-strings.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/one-txt-record.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch1.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch2.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch3.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch4.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch5.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/returned-parent-too-short.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/returned-parent-wrong.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/two-results-default-port.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/two-results-nonstandard-port.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/two-txt-records.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-not-allowed-option.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-with-overridden-ssl-option.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-with-overridden-uri-option.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-with-unallowed-option.yml +0 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-admin-database.yml +13 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-auth.yml +12 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/uri-with-port.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/uri-with-two-hosts.yml +0 -0
- data/spec/spec_tests/data/sessions_unified/snapshot-sessions-not-supported-client-error.yml +69 -0
- data/spec/spec_tests/data/sessions_unified/snapshot-sessions-not-supported-server-error.yml +102 -0
- data/spec/spec_tests/data/sessions_unified/snapshot-sessions-unsupported-ops.yml +258 -0
- data/spec/spec_tests/data/sessions_unified/snapshot-sessions.yml +482 -0
- data/spec/spec_tests/data/transactions/retryable-abort-errorLabels.yml +2 -0
- data/spec/spec_tests/data/transactions/retryable-abort.yml +2 -0
- data/spec/spec_tests/data/transactions/retryable-commit-errorLabels.yml +2 -0
- data/spec/spec_tests/data/transactions/retryable-commit.yml +2 -0
- data/spec/spec_tests/data/transactions/retryable-writes.yml +2 -0
- data/spec/spec_tests/data/uri_options/connection-options.yml +60 -0
- data/spec/spec_tests/load_balancers_spec.rb +15 -0
- data/spec/spec_tests/retryable_reads_spec.rb +2 -2
- data/spec/spec_tests/retryable_writes_spec.rb +1 -1
- data/spec/spec_tests/sdam_integration_spec.rb +1 -1
- data/spec/spec_tests/sdam_monitoring_spec.rb +10 -5
- data/spec/spec_tests/sdam_spec.rb +1 -1
- data/spec/spec_tests/seed_list_discovery_spec.rb +118 -0
- data/spec/spec_tests/sessions_unified_spec.rb +13 -0
- data/spec/spec_tests/uri_options_spec.rb +4 -4
- data/spec/stress/fork_reconnect_stress_spec.rb +1 -5
- data/spec/stress/push_monitor_close_spec.rb +44 -0
- data/spec/support/certificates/atlas-ocsp-ca.crt +82 -90
- data/spec/support/certificates/atlas-ocsp.crt +127 -122
- data/spec/support/common_shortcuts.rb +2 -3
- data/spec/support/matchers.rb +13 -0
- data/spec/support/shared/auth_context.rb +16 -0
- data/spec/support/shared/session.rb +2 -2
- data/spec/support/spec_config.rb +10 -11
- data/spec/support/using_hash.rb +31 -0
- data/spec/support/utils.rb +1 -1
- data.tar.gz.sig +3 -4
- metadata +1111 -1029
- metadata.gz.sig +2 -3
- data/lib/mongo/collection/view/builder/find_command.rb +0 -173
- data/lib/mongo/collection/view/builder/op_query.rb +0 -94
- data/lib/mongo/cursor/builder/get_more_command.rb +0 -80
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +0 -111
- data/lib/mongo/cursor/builder/op_get_more.rb +0 -64
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +0 -106
- data/lib/mongo/server/context.rb +0 -72
- data/spec/mongo/cursor/builder/op_kill_cursors_spec.rb +0 -66
- data/spec/runners/unified/using_hash.rb +0 -34
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +0 -79
- data/spec/support/event_subscriber.rb +0 -221
@@ -5,7 +5,7 @@ require 'spec_helper'
|
|
5
5
|
|
6
6
|
describe Mongo::Session::SessionPool do
|
7
7
|
min_server_fcv '3.6'
|
8
|
-
require_topology :replica_set, :sharded
|
8
|
+
require_topology :replica_set, :sharded, :load_balanced
|
9
9
|
clean_slate_for_all
|
10
10
|
|
11
11
|
let(:cluster) do
|
@@ -113,10 +113,26 @@ describe Mongo::Session::SessionPool do
|
|
113
113
|
pool.checkout
|
114
114
|
end
|
115
115
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
context "in non load-balanced topology" do
|
117
|
+
require_topology :replica_set, :sharded
|
118
|
+
|
119
|
+
it 'disposes of the old session and returns a new one' do
|
120
|
+
old_sessions = [old_session_a, old_session_b]
|
121
|
+
expect(old_sessions).not_to include(pool.checkout)
|
122
|
+
expect(old_sessions).not_to include(pool.checkout)
|
123
|
+
expect(pool.instance_variable_get(:@queue)).to be_empty
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context "in load-balanced topology" do
|
128
|
+
require_topology :load_balanced
|
129
|
+
|
130
|
+
it 'doed not dispose of the old session' do
|
131
|
+
old_sessions = [old_session_a, old_session_b]
|
132
|
+
expect(old_sessions).to include(checked_out_session)
|
133
|
+
expect(old_sessions).to include(checked_out_session)
|
134
|
+
expect(pool.instance_variable_get(:@queue)).to be_empty
|
135
|
+
end
|
120
136
|
end
|
121
137
|
end
|
122
138
|
end
|
@@ -138,10 +154,26 @@ describe Mongo::Session::SessionPool do
|
|
138
154
|
pool.checkin(old_session_b)
|
139
155
|
end
|
140
156
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
157
|
+
context "in non load-balanced topology" do
|
158
|
+
require_topology :replica_set, :sharded
|
159
|
+
|
160
|
+
it 'disposes of the old sessions instead of adding them to the pool' do
|
161
|
+
old_sessions = [old_session_a, old_session_b]
|
162
|
+
expect(old_sessions).not_to include(pool.checkout)
|
163
|
+
expect(old_sessions).not_to include(pool.checkout)
|
164
|
+
expect(pool.instance_variable_get(:@queue)).to be_empty
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context "in load-balanced topology" do
|
169
|
+
require_topology :load_balanced
|
170
|
+
|
171
|
+
it 'does not dispose of the old sessions' do
|
172
|
+
old_sessions = [old_session_a, old_session_b]
|
173
|
+
expect(old_sessions).to include(pool.checkout)
|
174
|
+
expect(old_sessions).to include(pool.checkout)
|
175
|
+
expect(pool.instance_variable_get(:@queue)).to be_empty
|
176
|
+
end
|
145
177
|
end
|
146
178
|
end
|
147
179
|
end
|
@@ -160,7 +192,7 @@ describe Mongo::Session::SessionPool do
|
|
160
192
|
pool.checkout
|
161
193
|
end
|
162
194
|
|
163
|
-
let(:subscriber) { EventSubscriber.new }
|
195
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
164
196
|
|
165
197
|
let(:client) do
|
166
198
|
authorized_client.tap do |client|
|
@@ -117,25 +117,15 @@ describe Mongo::Session do
|
|
117
117
|
max_example_run_time 7
|
118
118
|
|
119
119
|
it 'times out' do
|
120
|
-
|
121
|
-
entered = false
|
120
|
+
start = Mongo::Utils.monotonic_time
|
122
121
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
allow(Mongo::Utils).to receive(:monotonic_time).and_return(warp)
|
128
|
-
end
|
122
|
+
expect(Mongo::Utils).to receive(:monotonic_time).ordered.and_return(start)
|
123
|
+
expect(Mongo::Utils).to receive(:monotonic_time).ordered.and_return(start + 1)
|
124
|
+
expect(Mongo::Utils).to receive(:monotonic_time).ordered.and_return(start + 2)
|
125
|
+
expect(Mongo::Utils).to receive(:monotonic_time).ordered.and_return(start + 200)
|
129
126
|
|
130
127
|
expect do
|
131
128
|
session.with_transaction do
|
132
|
-
entered = true
|
133
|
-
|
134
|
-
# This sleep is to give the interrupting thread a chance to run,
|
135
|
-
# it significantly affects how much time is burned in this
|
136
|
-
# looping thread
|
137
|
-
sleep 0.1
|
138
|
-
|
139
129
|
exc = Mongo::Error::OperationFailure.new('timeout test')
|
140
130
|
exc.add_label('TransientTransactionError')
|
141
131
|
raise exc
|
@@ -148,21 +138,23 @@ describe Mongo::Session do
|
|
148
138
|
context "timeout with commit raising with #{label}" do
|
149
139
|
max_example_run_time 7
|
150
140
|
|
141
|
+
# JRuby seems to burn through the monotonic time expectations
|
142
|
+
# very quickly and the retries of the transaction get the original
|
143
|
+
# time which causes the transaction to be stuck there.
|
144
|
+
fails_on_jruby
|
145
|
+
|
151
146
|
before do
|
152
147
|
# create collection if it does not exist
|
153
148
|
collection.insert_one(a: 1)
|
154
149
|
end
|
155
150
|
|
156
|
-
it 'times out' do
|
157
|
-
|
158
|
-
entered = false
|
151
|
+
it 'times out', retry: 3 do
|
152
|
+
start = Mongo::Utils.monotonic_time
|
159
153
|
|
160
|
-
|
161
|
-
|
162
|
-
sleep 0.1
|
163
|
-
end
|
164
|
-
allow(Mongo::Utils).to receive(:monotonic_time).and_return(warp)
|
154
|
+
10.times do |i|
|
155
|
+
expect(Mongo::Utils).to receive(:monotonic_time).ordered.and_return(start + i)
|
165
156
|
end
|
157
|
+
expect(Mongo::Utils).to receive(:monotonic_time).ordered.and_return(start + 200)
|
166
158
|
|
167
159
|
exc = Mongo::Error::OperationFailure.new('timeout test')
|
168
160
|
exc.add_label(label)
|
@@ -171,13 +163,6 @@ describe Mongo::Session do
|
|
171
163
|
|
172
164
|
expect do
|
173
165
|
session.with_transaction do
|
174
|
-
entered = true
|
175
|
-
|
176
|
-
# This sleep is to give the interrupting thread a chance to run,
|
177
|
-
# it significantly affects how much time is burned in this
|
178
|
-
# looping thread
|
179
|
-
sleep 0.1
|
180
|
-
|
181
166
|
collection.insert_one(a: 2)
|
182
167
|
end
|
183
168
|
end.to raise_error(Mongo::Error::OperationFailure, 'timeout test')
|
@@ -306,67 +306,40 @@ describe Mongo::Socket::SSL, retry: 3 do
|
|
306
306
|
end
|
307
307
|
end
|
308
308
|
|
309
|
-
context 'when ruby version is < 2.4.1' do
|
310
|
-
ruby_version_lt '2.4.1'
|
311
|
-
|
312
|
-
context 'when a key is passed, but it is not of the right type' do
|
313
|
-
|
314
|
-
let(:ssl_options) do
|
315
|
-
key = "This is a string not a key"
|
316
|
-
{
|
317
|
-
:ssl => true,
|
318
|
-
:ssl_key_object => key,
|
319
|
-
:ssl_cert => SpecConfig.instance.client_cert_path,
|
320
|
-
:ssl_verify => false
|
321
|
-
}
|
322
|
-
end
|
323
|
-
|
324
|
-
it 'raises a TypeError' do
|
325
|
-
expect do
|
326
|
-
socket
|
327
|
-
end.to raise_exception(TypeError)
|
328
|
-
end
|
329
|
-
end
|
330
|
-
end
|
331
|
-
|
332
309
|
# Note that as of MRI 2.4, Creating a socket with the wrong key type raises
|
333
310
|
# a NoMethodError because #private? is attempted to be called on the key.
|
334
311
|
# In jruby 9.2 a TypeError is raised.
|
335
312
|
# In jruby 9.1 a OpenSSL::PKey::PKeyError is raised.
|
336
|
-
context 'when
|
337
|
-
ruby_version_gte '2.4.1'
|
313
|
+
context 'when a key is passed, but it is not of the right type' do
|
338
314
|
|
339
|
-
|
315
|
+
let(:ssl_options) do
|
316
|
+
key = "This is a string not a key"
|
317
|
+
{
|
318
|
+
:ssl => true,
|
319
|
+
:ssl_key_object => key,
|
320
|
+
:ssl_cert => SpecConfig.instance.client_cert_path,
|
321
|
+
:ssl_verify => false
|
322
|
+
}
|
323
|
+
end
|
340
324
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
:ssl_cert => SpecConfig.instance.client_cert_path,
|
347
|
-
:ssl_verify => false
|
348
|
-
}
|
349
|
-
end
|
350
|
-
|
351
|
-
let(:expected_exception) do
|
352
|
-
if SpecConfig.instance.jruby?
|
353
|
-
if RUBY_VERSION >= '2.5.0'
|
354
|
-
# jruby 9.2
|
355
|
-
TypeError
|
356
|
-
else
|
357
|
-
# jruby 9.1
|
358
|
-
OpenSSL::OpenSSLError
|
359
|
-
end
|
325
|
+
let(:expected_exception) do
|
326
|
+
if SpecConfig.instance.jruby?
|
327
|
+
if RUBY_VERSION >= '2.5.0'
|
328
|
+
# jruby 9.2
|
329
|
+
TypeError
|
360
330
|
else
|
361
|
-
|
331
|
+
# jruby 9.1
|
332
|
+
OpenSSL::OpenSSLError
|
362
333
|
end
|
334
|
+
else
|
335
|
+
NoMethodError
|
363
336
|
end
|
337
|
+
end
|
364
338
|
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
end
|
339
|
+
it 'raises a NoMethodError' do
|
340
|
+
expect do
|
341
|
+
socket
|
342
|
+
end.to raise_exception(expected_exception)
|
370
343
|
end
|
371
344
|
end
|
372
345
|
|
@@ -403,13 +376,8 @@ describe Mongo::Socket::SSL, retry: 3 do
|
|
403
376
|
context 'when a bad key is provided' do
|
404
377
|
|
405
378
|
let(:expected_exception) do
|
406
|
-
|
407
|
-
|
408
|
-
[OpenSSL::OpenSSLError, /Could not parse PKey/]
|
409
|
-
else
|
410
|
-
# ArgumentError: Could not parse PKey: no start line
|
411
|
-
[ArgumentError, /Could not parse PKey/]
|
412
|
-
end
|
379
|
+
# OpenSSL::PKey::PKeyError: Could not parse PKey: no start line
|
380
|
+
[OpenSSL::OpenSSLError, /Could not parse PKey/]
|
413
381
|
end
|
414
382
|
|
415
383
|
let(:ssl_options) do
|
@@ -267,19 +267,52 @@ describe Mongo::URI do
|
|
267
267
|
|
268
268
|
context 'connect' do
|
269
269
|
|
270
|
-
let(:
|
270
|
+
let(:client) { new_local_client_nmio(string) }
|
271
271
|
|
272
|
-
|
272
|
+
shared_examples 'raises an error when client is created' do
|
273
|
+
it 'raises an error when client is created' do
|
274
|
+
lambda do
|
275
|
+
client
|
276
|
+
end.should raise_error(ArgumentError, /Invalid :connect option value/)
|
277
|
+
end
|
278
|
+
end
|
273
279
|
|
274
|
-
|
275
|
-
|
280
|
+
%i(direct sharded replica_set load_balanced).each do |value|
|
281
|
+
context "#{value}" do
|
282
|
+
let(:string) { "mongodb://example.com/?connect=#{value}" }
|
283
|
+
|
284
|
+
it_behaves_like 'parses successfully'
|
285
|
+
|
286
|
+
it 'is a symbol' do
|
287
|
+
expect(uri.uri_options[:connect]).to eq(value)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
%i(replica-set load-balanced).each do |value|
|
293
|
+
context "#{value}" do
|
294
|
+
let(:string) { "mongodb://example.com/?connect=#{value}" }
|
295
|
+
|
296
|
+
it_behaves_like 'parses successfully'
|
297
|
+
|
298
|
+
it 'is a symbol' do
|
299
|
+
expect(uri.uri_options[:connect]).to eq(value)
|
300
|
+
end
|
301
|
+
|
302
|
+
include_examples 'raises an error when client is created'
|
303
|
+
end
|
276
304
|
end
|
277
305
|
|
278
306
|
context 'invalid value' do
|
279
307
|
let(:string) { 'mongodb://example.com/?connect=bogus' }
|
280
308
|
|
281
|
-
# should raise an error
|
282
309
|
it_behaves_like 'parses successfully'
|
310
|
+
|
311
|
+
it 'is a symbol' do
|
312
|
+
expect(uri.uri_options[:connect]).to eq(:bogus)
|
313
|
+
end
|
314
|
+
|
315
|
+
include_examples 'raises an error when client is created'
|
283
316
|
end
|
284
317
|
end
|
285
318
|
|
data/spec/mongo/utils_spec.rb
CHANGED
@@ -39,18 +39,4 @@ describe Mongo::Utils do
|
|
39
39
|
}
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
43
|
-
describe '#slice_hash' do
|
44
|
-
it do
|
45
|
-
hash = {'key1' => 1, :key2 => 's', :key3 => true}
|
46
|
-
expect(
|
47
|
-
described_class.slice_hash(hash, 'key1', :key3)
|
48
|
-
).to eq(
|
49
|
-
{
|
50
|
-
'key1' => 1,
|
51
|
-
:key3 => true
|
52
|
-
}
|
53
|
-
)
|
54
|
-
end
|
55
|
-
end
|
56
42
|
end
|
data/spec/runners/cmap.rb
CHANGED
@@ -33,7 +33,7 @@ module Mongo
|
|
33
33
|
# @return [ Mongo::ConnectionPool ] pool The connection pool to use for operations.
|
34
34
|
attr_reader :pool
|
35
35
|
|
36
|
-
# @return [ EventSubscriber ] subscriber The subscriber receiving the CMAP events.
|
36
|
+
# @return [ Mrss::EventSubscriber ] subscriber The subscriber receiving the CMAP events.
|
37
37
|
attr_reader :subscriber
|
38
38
|
|
39
39
|
# Instantiate the new spec.
|
@@ -147,10 +147,14 @@ module Mongo
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
def
|
150
|
+
def expected_options
|
151
151
|
@spec['options']
|
152
152
|
end
|
153
153
|
|
154
|
+
def non_uri_options
|
155
|
+
@spec['parsed_options']
|
156
|
+
end
|
157
|
+
|
154
158
|
def client
|
155
159
|
@client ||= ClientRegistry.instance.new_local_client(@spec['uri'], monitoring_io: false)
|
156
160
|
rescue Mongo::Error::LintError => e
|
@@ -307,14 +311,14 @@ def define_connection_string_spec_tests(test_paths, spec_cls = Mongo::Connection
|
|
307
311
|
expect(test.client).to match_auth(test)
|
308
312
|
end
|
309
313
|
|
310
|
-
if test.
|
314
|
+
if test.expected_options
|
311
315
|
it 'creates a client with the correct options' do
|
312
316
|
mapped = Mongo::URI::OptionsMapper.new.ruby_to_smc(test.client.options)
|
313
317
|
# Connection string spec tests do not use canonical URI option names
|
314
318
|
actual = Utils.downcase_keys(mapped)
|
315
319
|
actual.delete('authsource')
|
316
320
|
expected = Mongo::ConnectionString.adjust_expected_mongo_client_options(
|
317
|
-
test.
|
321
|
+
test.expected_options,
|
318
322
|
)
|
319
323
|
actual.should == expected
|
320
324
|
end
|
@@ -376,9 +376,11 @@ module Mongo
|
|
376
376
|
arguments.merge(arguments['options'] || {}).each do |spec_k, v|
|
377
377
|
ruby_k = ::Utils.underscore(spec_k).to_sym
|
378
378
|
|
379
|
-
|
380
|
-
|
381
|
-
|
379
|
+
ruby_k = {
|
380
|
+
min: :min_value,
|
381
|
+
max: :max_value,
|
382
|
+
show_record_id: :show_disk_loc
|
383
|
+
}[ruby_k] || ruby_k
|
382
384
|
|
383
385
|
if respond_to?("transform_#{ruby_k}", true)
|
384
386
|
v = send("transform_#{ruby_k}", v)
|
@@ -110,8 +110,7 @@ EOT
|
|
110
110
|
expected_command = expected_event.delete('command')
|
111
111
|
actual_command = actual_event.delete('command')
|
112
112
|
|
113
|
-
|
114
|
-
expected_presence = expected_command.select { |k, v| !v.nil? }
|
113
|
+
expected_presence = expected_command.compact
|
115
114
|
expected_absence = expected_command.select { |k, v| v.nil? }
|
116
115
|
|
117
116
|
expected_presence.each do |k, v|
|
data/spec/runners/crud.rb
CHANGED
data/spec/runners/sdam.rb
CHANGED
@@ -37,6 +37,7 @@ module Mongo
|
|
37
37
|
when 'PossiblePrimary' then server.unknown?
|
38
38
|
when 'RSGhost' then server.ghost?
|
39
39
|
when 'RSOther' then server.other?
|
40
|
+
when 'LoadBalancer' then server.load_balancer?
|
40
41
|
else
|
41
42
|
raise "Unknown type #{type}"
|
42
43
|
end
|
@@ -252,7 +253,7 @@ module Mongo
|
|
252
253
|
'server_opening_event' => Mongo::Monitoring::Event::ServerOpening,
|
253
254
|
'topology_description_changed_event' => Mongo::Monitoring::Event::TopologyChanged,
|
254
255
|
'topology_opening_event' => Mongo::Monitoring::Event::TopologyOpening
|
255
|
-
}
|
256
|
+
}.freeze
|
256
257
|
|
257
258
|
attr_reader :name
|
258
259
|
attr_reader :data
|
@@ -141,11 +141,11 @@ module Mongo
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def command_subscriber
|
144
|
-
@command_subscriber ||= EventSubscriber.new
|
144
|
+
@command_subscriber ||= Mrss::EventSubscriber.new
|
145
145
|
end
|
146
146
|
|
147
147
|
def sdam_subscriber
|
148
|
-
@sdam_subscriber ||= EventSubscriber.new(name: 'sdam subscriber')
|
148
|
+
@sdam_subscriber ||= Mrss::EventSubscriber.new(name: 'sdam subscriber')
|
149
149
|
end
|
150
150
|
|
151
151
|
# Run the test.
|
@@ -4,6 +4,7 @@
|
|
4
4
|
module Unified
|
5
5
|
|
6
6
|
module Assertions
|
7
|
+
include RSpec::Matchers
|
7
8
|
|
8
9
|
def assert_result_matches(actual, expected)
|
9
10
|
if Hash === expected
|
@@ -61,7 +62,7 @@ module Unified
|
|
61
62
|
def assert_outcome
|
62
63
|
return unless outcome
|
63
64
|
|
64
|
-
client = ClientRegistry.instance.global_client('
|
65
|
+
client = ClientRegistry.instance.global_client('root_authorized')
|
65
66
|
outcome.each do |spec|
|
66
67
|
spec = UsingHash[spec]
|
67
68
|
collection = client.use(spec.use!('databaseName'))[spec.use!('collectionName')]
|
@@ -86,8 +87,6 @@ module Unified
|
|
86
87
|
|
87
88
|
def assert_document_matches(actual, expected, msg)
|
88
89
|
unless actual == expected
|
89
|
-
p actual
|
90
|
-
p expected
|
91
90
|
raise Error::ResultMismatch, "#{msg} does not match"
|
92
91
|
end
|
93
92
|
end
|
@@ -130,7 +129,7 @@ module Unified
|
|
130
129
|
expected_name = expected_name.sub(/Event$/, '').sub(/^(.)/) { $1.upcase }
|
131
130
|
assert_eq(actual.class.name.sub(/.*::/, ''), expected_name, 'Event name does not match')
|
132
131
|
if spec.use('hasServiceId')
|
133
|
-
|
132
|
+
actual.service_id.should_not be nil
|
134
133
|
end
|
135
134
|
if db_name = spec.use('databaseName')
|
136
135
|
assert_eq(actual.database_name, db_name, 'Database names differ')
|
@@ -218,6 +217,8 @@ module Unified
|
|
218
217
|
BSON::ObjectId === object
|
219
218
|
when 'date'
|
220
219
|
Time === object
|
220
|
+
when 'double'
|
221
|
+
Float === object
|
221
222
|
else
|
222
223
|
raise NotImplementedError, "Unhandled type #{type}"
|
223
224
|
end
|