mongo 2.17.3 → 2.18.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +21 -37
- data/lib/mongo/auth/base.rb +8 -1
- data/lib/mongo/auth.rb +12 -1
- data/lib/mongo/bulk_write/result.rb +10 -1
- data/lib/mongo/bulk_write/result_combiner.rb +2 -4
- data/lib/mongo/bulk_write.rb +108 -28
- data/lib/mongo/client.rb +114 -12
- data/lib/mongo/client_encryption.rb +30 -9
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +11 -1
- data/lib/mongo/cluster.rb +20 -24
- data/lib/mongo/collection/helpers.rb +43 -0
- data/lib/mongo/collection/queryable_encryption.rb +122 -0
- data/lib/mongo/collection/view/aggregation.rb +19 -16
- data/lib/mongo/collection/view/change_stream.rb +56 -23
- data/lib/mongo/collection/view/explainable.rb +1 -1
- data/lib/mongo/collection/view/iterable.rb +2 -3
- data/lib/mongo/collection/view/map_reduce.rb +18 -9
- data/lib/mongo/collection/view/readable.rb +19 -23
- data/lib/mongo/collection/view/writable.rb +133 -40
- data/lib/mongo/collection.rb +108 -48
- data/lib/mongo/config/options.rb +62 -0
- data/lib/mongo/config/validators/option.rb +26 -0
- data/lib/mongo/config.rb +31 -0
- data/lib/mongo/crypt/auto_encrypter.rb +79 -6
- data/lib/mongo/crypt/binding.rb +395 -143
- data/lib/mongo/crypt/context.rb +5 -2
- data/lib/mongo/crypt/data_key_context.rb +7 -104
- data/lib/mongo/crypt/encryption_io.rb +28 -60
- data/lib/mongo/crypt/explicit_encrypter.rb +27 -25
- data/lib/mongo/crypt/explicit_encryption_context.rb +31 -3
- data/lib/mongo/crypt/handle.rb +102 -79
- data/lib/mongo/crypt/hooks.rb +25 -2
- data/lib/mongo/crypt/kms/aws.rb +128 -0
- data/lib/mongo/crypt/kms/azure.rb +136 -0
- data/lib/mongo/crypt/kms/credentials.rb +81 -0
- data/lib/mongo/crypt/kms/gcp.rb +182 -0
- data/lib/mongo/crypt/kms/kmip.rb +110 -0
- data/lib/mongo/crypt/kms/local.rb +74 -0
- data/lib/mongo/crypt/kms/master_key_document.rb +65 -0
- data/lib/mongo/crypt/kms.rb +117 -0
- data/lib/mongo/crypt.rb +1 -0
- data/lib/mongo/cursor/kill_spec.rb +27 -6
- data/lib/mongo/cursor.rb +21 -16
- data/lib/mongo/database/view.rb +6 -3
- data/lib/mongo/database.rb +73 -12
- data/lib/mongo/dbref.rb +1 -105
- data/lib/mongo/error/bulk_write_error.rb +31 -4
- data/lib/mongo/error/invalid_config_option.rb +20 -0
- data/lib/mongo/error/invalid_replacement_document.rb +27 -9
- data/lib/mongo/error/invalid_update_document.rb +27 -7
- data/lib/mongo/error/labelable.rb +72 -0
- data/lib/mongo/error/missing_connection.rb +25 -0
- data/lib/mongo/error/notable.rb +7 -0
- data/lib/mongo/error/operation_failure.rb +34 -86
- data/lib/mongo/error/read_write_retryable.rb +108 -0
- data/lib/mongo/{operation/kill_cursors/legacy.rb → error/session_not_materialized.rb} +7 -19
- data/lib/mongo/error.rb +5 -37
- data/lib/mongo/index/view.rb +22 -7
- data/lib/mongo/monitoring/event/command_failed.rb +8 -2
- data/lib/mongo/monitoring/event/command_started.rb +1 -1
- data/lib/mongo/monitoring/event/command_succeeded.rb +9 -2
- data/lib/mongo/monitoring/publishable.rb +9 -5
- data/lib/mongo/operation/collections_info/result.rb +5 -2
- data/lib/mongo/operation/command/op_msg.rb +6 -0
- data/lib/mongo/operation/context.rb +24 -6
- data/lib/mongo/operation/count/op_msg.rb +4 -1
- data/lib/mongo/operation/create/op_msg.rb +16 -1
- data/lib/mongo/operation/create_index/op_msg.rb +2 -1
- data/lib/mongo/operation/delete/op_msg.rb +1 -0
- data/lib/mongo/operation/delete.rb +0 -1
- data/lib/mongo/operation/drop_index/op_msg.rb +5 -1
- data/lib/mongo/operation/get_more/command_builder.rb +5 -1
- data/lib/mongo/operation/insert/bulk_result.rb +5 -1
- data/lib/mongo/operation/insert/command.rb +0 -4
- data/lib/mongo/operation/insert/op_msg.rb +6 -3
- data/lib/mongo/operation/insert/result.rb +6 -3
- data/lib/mongo/operation/insert.rb +0 -1
- data/lib/mongo/operation/kill_cursors.rb +0 -1
- data/lib/mongo/operation/list_collections/op_msg.rb +4 -1
- data/lib/mongo/operation/map_reduce/result.rb +16 -0
- data/lib/mongo/operation/result.rb +21 -5
- data/lib/mongo/operation/shared/executable.rb +21 -6
- data/lib/mongo/operation/shared/polymorphic_operation.rb +15 -3
- data/lib/mongo/operation/shared/response_handling.rb +6 -5
- data/lib/mongo/operation/shared/sessions_supported.rb +3 -7
- data/lib/mongo/operation/shared/write.rb +18 -12
- data/lib/mongo/operation/update/op_msg.rb +2 -1
- data/lib/mongo/operation/update.rb +0 -1
- data/lib/mongo/protocol/caching_hash.rb +69 -0
- data/lib/mongo/protocol/msg.rb +37 -1
- data/lib/mongo/protocol.rb +1 -0
- data/lib/mongo/query_cache.rb +15 -0
- data/lib/mongo/retryable.rb +78 -30
- data/lib/mongo/server/connection.rb +33 -0
- data/lib/mongo/server/connection_base.rb +2 -0
- data/lib/mongo/server/connection_common.rb +4 -1
- data/lib/mongo/server/connection_pool.rb +69 -42
- data/lib/mongo/server/description/features.rb +3 -1
- data/lib/mongo/server/description.rb +7 -2
- data/lib/mongo/server/monitor/connection.rb +5 -10
- data/lib/mongo/server/monitor.rb +21 -13
- data/lib/mongo/server/push_monitor.rb +9 -3
- data/lib/mongo/server.rb +9 -5
- data/lib/mongo/session/session_pool.rb +8 -0
- data/lib/mongo/session.rb +111 -35
- data/lib/mongo/socket/ocsp_verifier.rb +4 -5
- data/lib/mongo/socket/tcp.rb +3 -0
- data/lib/mongo/srv/resolver.rb +24 -3
- data/lib/mongo/uri/options_mapper.rb +2 -0
- data/lib/mongo/uri/srv_protocol.rb +1 -1
- data/lib/mongo/uri.rb +20 -0
- data/lib/mongo/version.rb +1 -1
- data/lib/mongo.rb +20 -0
- data/mongo.gemspec +10 -4
- data/spec/README.md +5 -5
- data/spec/integration/aws_lambda_examples_spec.rb +68 -0
- data/spec/integration/bulk_write_error_message_spec.rb +32 -0
- data/spec/integration/bulk_write_spec.rb +0 -16
- data/spec/integration/change_stream_spec.rb +6 -5
- data/spec/integration/client_construction_spec.rb +1 -1
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +9 -9
- data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +18 -19
- data/spec/integration/client_side_encryption/auto_encryption_mongocryptd_spawn_spec.rb +0 -1
- data/spec/integration/client_side_encryption/auto_encryption_reconnect_spec.rb +31 -0
- data/spec/integration/client_side_encryption/auto_encryption_spec.rb +108 -1
- data/spec/integration/client_side_encryption/bson_size_limit_spec.rb +2 -2
- data/spec/integration/client_side_encryption/bypass_mongocryptd_spawn_spec.rb +2 -2
- data/spec/integration/client_side_encryption/client_close_spec.rb +1 -1
- data/spec/integration/client_side_encryption/corpus_spec.rb +64 -35
- data/spec/integration/client_side_encryption/custom_endpoint_spec.rb +39 -42
- data/spec/integration/client_side_encryption/data_key_spec.rb +97 -7
- data/spec/integration/client_side_encryption/explicit_encryption_spec.rb +59 -0
- data/spec/integration/client_side_encryption/explicit_queryable_encryption_spec.rb +147 -0
- data/spec/integration/client_side_encryption/external_key_vault_spec.rb +6 -6
- data/spec/integration/client_side_encryption/kms_tls_options_spec.rb +394 -0
- data/spec/integration/client_side_encryption/kms_tls_spec.rb +92 -0
- data/spec/integration/client_side_encryption/queryable_encryption_examples_spec.rb +111 -0
- data/spec/integration/client_side_encryption/views_spec.rb +1 -1
- data/spec/integration/client_update_spec.rb +2 -2
- data/spec/integration/crud_spec.rb +12 -0
- data/spec/integration/cursor_pinning_spec.rb +3 -3
- data/spec/integration/fork_reconnect_spec.rb +15 -8
- data/spec/integration/grid_fs_bucket_spec.rb +3 -3
- data/spec/integration/ocsp_verifier_spec.rb +1 -0
- data/spec/integration/query_cache_spec.rb +34 -30
- data/spec/integration/retryable_writes/retryable_writes_36_and_older_spec.rb +1 -1
- data/spec/integration/sdam_events_spec.rb +0 -40
- data/spec/integration/server_monitor_spec.rb +2 -1
- data/spec/integration/size_limit_spec.rb +4 -1
- data/spec/integration/snapshot_query_examples_spec.rb +127 -0
- data/spec/integration/srv_monitoring_spec.rb +37 -0
- data/spec/integration/step_down_spec.rb +20 -4
- data/spec/integration/transaction_pinning_spec.rb +2 -2
- data/spec/integration/versioned_api_examples_spec.rb +37 -31
- data/spec/lite_spec_helper.rb +14 -5
- data/spec/mongo/address/ipv6_spec.rb +7 -0
- data/spec/mongo/address_spec.rb +7 -0
- data/spec/mongo/auth/scram/conversation_spec.rb +23 -23
- data/spec/mongo/auth/scram256/conversation_spec.rb +20 -20
- data/spec/mongo/auth/scram_negotiation_spec.rb +1 -0
- data/spec/mongo/bulk_write/result_spec.rb +15 -1
- data/spec/mongo/bulk_write_spec.rb +128 -20
- data/spec/mongo/client_construction_spec.rb +141 -7
- data/spec/mongo/client_encryption_spec.rb +11 -11
- data/spec/mongo/client_spec.rb +297 -1
- data/spec/mongo/cluster/cursor_reaper_spec.rb +21 -3
- data/spec/mongo/cluster_spec.rb +0 -44
- data/spec/mongo/collection/view/aggregation_spec.rb +2 -2
- data/spec/mongo/collection/view/change_stream_spec.rb +2 -2
- data/spec/mongo/collection/view/readable_spec.rb +35 -56
- data/spec/mongo/collection/view/writable_spec.rb +144 -32
- data/spec/mongo/collection_crud_spec.rb +63 -13
- data/spec/mongo/config/options_spec.rb +75 -0
- data/spec/mongo/config_spec.rb +73 -0
- data/spec/mongo/crypt/auto_decryption_context_spec.rb +17 -1
- data/spec/mongo/crypt/auto_encrypter_spec.rb +106 -0
- data/spec/mongo/crypt/auto_encryption_context_spec.rb +17 -1
- data/spec/mongo/crypt/binding/context_spec.rb +99 -17
- data/spec/mongo/crypt/binding/mongocrypt_spec.rb +17 -46
- data/spec/mongo/crypt/binding/version_spec.rb +25 -0
- data/spec/mongo/crypt/binding_unloaded_spec.rb +14 -0
- data/spec/mongo/crypt/data_key_context_spec.rb +42 -114
- data/spec/mongo/crypt/encryption_io_spec.rb +2 -0
- data/spec/mongo/crypt/explicit_decryption_context_spec.rb +32 -1
- data/spec/mongo/crypt/explicit_encryption_context_spec.rb +89 -1
- data/spec/mongo/crypt/handle_spec.rb +47 -169
- data/spec/mongo/crypt/hooks_spec.rb +30 -0
- data/spec/mongo/crypt/kms/credentials_spec.rb +404 -0
- data/spec/mongo/crypt/kms_spec.rb +59 -0
- data/spec/mongo/cursor_spec.rb +37 -51
- data/spec/mongo/database_spec.rb +66 -1
- data/spec/mongo/error/operation_failure_heavy_spec.rb +49 -0
- data/spec/mongo/index/view_spec.rb +69 -0
- data/spec/mongo/operation/create/op_msg_spec.rb +286 -0
- data/spec/mongo/operation/delete/op_msg_spec.rb +13 -4
- data/spec/mongo/operation/delete_spec.rb +0 -30
- data/spec/mongo/operation/insert/op_msg_spec.rb +18 -10
- data/spec/mongo/operation/insert_spec.rb +0 -32
- data/spec/mongo/operation/result_spec.rb +20 -0
- data/spec/mongo/operation/update/op_msg_spec.rb +13 -4
- data/spec/mongo/operation/update_spec.rb +0 -29
- data/spec/mongo/protocol/caching_hash_spec.rb +82 -0
- data/spec/mongo/protocol/msg_spec.rb +41 -0
- data/spec/mongo/query_cache_spec.rb +1 -0
- data/spec/mongo/retryable_spec.rb +32 -3
- data/spec/mongo/server/connection_auth_spec.rb +3 -1
- data/spec/mongo/server/connection_common_spec.rb +13 -1
- data/spec/mongo/server/connection_pool_spec.rb +94 -49
- data/spec/mongo/server/connection_spec.rb +50 -159
- data/spec/mongo/server/description/features_spec.rb +24 -0
- data/spec/mongo/server/push_monitor_spec.rb +2 -8
- data/spec/mongo/session_spec.rb +26 -6
- data/spec/mongo/session_transaction_spec.rb +2 -1
- data/spec/mongo/socket/ssl_spec.rb +15 -4
- data/spec/mongo/uri/srv_protocol_spec.rb +101 -2
- data/spec/mongo/uri_spec.rb +25 -0
- data/spec/runners/connection_string.rb +8 -0
- data/spec/runners/crud/operation.rb +12 -3
- data/spec/runners/crud/requirement.rb +3 -3
- data/spec/runners/crud/spec.rb +5 -0
- data/spec/runners/crud/verifier.rb +6 -0
- data/spec/runners/transactions/test.rb +33 -14
- data/spec/runners/transactions.rb +9 -6
- data/spec/runners/unified/assertions.rb +59 -10
- data/spec/runners/unified/change_stream_operations.rb +9 -0
- data/spec/runners/unified/crud_operations.rb +50 -2
- data/spec/runners/unified/ddl_operations.rb +20 -0
- data/spec/runners/unified/error.rb +2 -1
- data/spec/runners/unified/support_operations.rb +5 -2
- data/spec/runners/unified/test.rb +19 -4
- data/spec/runners/unified.rb +9 -2
- data/spec/shared/lib/mrss/constraints.rb +10 -17
- data/spec/shared/lib/mrss/docker_runner.rb +21 -3
- data/spec/shared/lib/mrss/lite_constraints.rb +32 -1
- data/spec/shared/lib/mrss/session_registry.rb +69 -0
- data/spec/shared/lib/mrss/session_registry_legacy.rb +60 -0
- data/spec/shared/share/Dockerfile.erb +56 -54
- data/spec/shared/shlib/config.sh +27 -0
- data/spec/shared/shlib/distro.sh +2 -1
- data/spec/shared/shlib/server.sh +46 -21
- data/spec/shared/shlib/set_env.sh +40 -5
- data/spec/spec_helper.rb +0 -1
- data/spec/spec_tests/crud_spec.rb +0 -10
- data/spec/spec_tests/data/change_streams_unified/change-streams-errors.yml +124 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams-pre_and_post_images.yml +351 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-allowlist.yml +1171 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-errorLabels.yml +1068 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams.yml +859 -4
- data/spec/spec_tests/data/client_side_encryption/aggregate.yml +3 -17
- data/spec/spec_tests/data/client_side_encryption/azureKMS.yml +46 -0
- data/spec/spec_tests/data/client_side_encryption/badQueries.yml +12 -2
- data/spec/spec_tests/data/client_side_encryption/basic.yml +3 -17
- data/spec/spec_tests/data/client_side_encryption/bulk.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/bypassAutoEncryption.yml +2 -2
- data/spec/spec_tests/data/client_side_encryption/count.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/countDocuments.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/delete.yml +2 -16
- data/spec/spec_tests/data/client_side_encryption/distinct.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/explain.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/find.yml +2 -16
- data/spec/spec_tests/data/client_side_encryption/findOneAndDelete.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/findOneAndReplace.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/findOneAndUpdate.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/fle2-BypassQueryAnalysis.yml +101 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-Compact.yml +80 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-CreateCollection.yml +1263 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-DecryptExistingData.yml +64 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-Delete.yml +107 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-EncryptedFields-vs-EncryptedFieldsMap.yml +80 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-EncryptedFields-vs-jsonSchema.yml +90 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-EncryptedFieldsMap-defaults.yml +57 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-FindOneAndUpdate.yml +213 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-InsertFind-Indexed.yml +86 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-InsertFind-Unindexed.yml +83 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-MissingKey.yml +41 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-NoEncryption.yml +42 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-Update.yml +221 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-validatorAndPartialFieldExpression.yml +168 -0
- data/spec/spec_tests/data/client_side_encryption/gcpKMS.yml +46 -0
- data/spec/spec_tests/data/client_side_encryption/getMore.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/insert.yml +2 -16
- data/spec/spec_tests/data/client_side_encryption/keyAltName.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/localKMS.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/localSchema.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/maxWireVersion.yml +2 -0
- data/spec/spec_tests/data/client_side_encryption/missingKey.yml +2 -9
- data/spec/spec_tests/data/client_side_encryption/noSchema.yml +39 -0
- data/spec/spec_tests/data/client_side_encryption/replaceOne.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/types.yml +44 -70
- data/spec/spec_tests/data/client_side_encryption/updateMany.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/updateOne.yml +1 -8
- data/spec/spec_tests/data/collection_management/clustered-indexes.yml +135 -0
- data/spec/spec_tests/data/collection_management/createCollection-pre_and_post_images.yml +50 -0
- data/spec/spec_tests/data/collection_management/modifyCollection-pre_and_post_images.yml +58 -0
- data/spec/spec_tests/data/command_monitoring_unified/pre-42-server-connection-id.yml +56 -0
- data/spec/spec_tests/data/command_monitoring_unified/server-connection-id.yml +56 -0
- data/spec/spec_tests/data/crud/read/aggregate-collation.yml +1 -1
- data/spec/spec_tests/data/crud/read/count-collation.yml +1 -1
- data/spec/spec_tests/data/crud/read/distinct-collation.yml +1 -1
- data/spec/spec_tests/data/crud/read/find-collation.yml +1 -1
- data/spec/spec_tests/data/crud/write/bulkWrite-collation.yml +1 -1
- data/spec/spec_tests/data/crud/write/deleteMany-collation.yml +1 -1
- data/spec/spec_tests/data/crud/write/deleteOne-collation.yml +1 -1
- data/spec/spec_tests/data/crud/write/findOneAndDelete-collation.yml +1 -1
- data/spec/spec_tests/data/crud/write/findOneAndReplace-collation.yml +1 -1
- data/spec/spec_tests/data/crud/write/findOneAndUpdate-collation.yml +1 -1
- data/spec/spec_tests/data/crud/write/replaceOne-collation.yml +1 -1
- data/spec/spec_tests/data/crud/write/updateMany-collation.yml +1 -1
- data/spec/spec_tests/data/crud/write/updateOne-collation.yml +1 -1
- data/spec/spec_tests/data/crud_unified/aggregate-allowdiskuse.yml +75 -0
- data/spec/spec_tests/data/crud_unified/aggregate-merge.yml +185 -0
- data/spec/spec_tests/data/crud_unified/aggregate-out-readConcern.yml +171 -0
- data/spec/spec_tests/data/crud_unified/aggregate.yml +215 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-arrayFilters-clientError.yml +98 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-arrayFilters.yml +174 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-comment.yml +189 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-delete-hint-clientError.yml +113 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-delete-hint-serverError.yml +142 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-delete-hint.yml +154 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-deleteMany-hint-unacknowledged.yml +98 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-deleteMany-let.yml +86 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-deleteOne-hint-unacknowledged.yml +97 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-deleteOne-let.yml +86 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-insertOne-dots_and_dollars.yml +138 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-dots_and_dollars.yml +165 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-hint-unacknowledged.yml +103 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-let.yml +93 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-update-hint-clientError.yml +148 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-update-hint-serverError.yml +239 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-update-hint.yml +256 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-update-validation.yml +73 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateMany-dots_and_dollars.yml +150 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateMany-hint-unacknowledged.yml +104 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateMany-let.yml +96 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateOne-dots_and_dollars.yml +150 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateOne-hint-unacknowledged.yml +103 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateOne-let.yml +95 -0
- data/spec/spec_tests/data/crud_unified/countDocuments-comment.yml +92 -0
- data/spec/spec_tests/data/crud_unified/db-aggregate.yml +73 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-comment.yml +97 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-hint-clientError.yml +87 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-hint-serverError.yml +107 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-hint-unacknowledged.yml +90 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-hint.yml +99 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-let.yml +2 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-comment.yml +98 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-hint-clientError.yml +80 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-hint-serverError.yml +100 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-hint-unacknowledged.yml +89 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-hint.yml +95 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-let.yml +2 -0
- data/spec/spec_tests/data/crud_unified/estimatedDocumentCount-comment.yml +95 -0
- data/spec/spec_tests/data/crud_unified/estimatedDocumentCount.yml +5 -135
- data/spec/spec_tests/data/crud_unified/find-allowdiskuse-clientError.yml +55 -0
- data/spec/spec_tests/data/crud_unified/find-allowdiskuse-serverError.yml +68 -0
- data/spec/spec_tests/data/crud_unified/find-allowdiskuse.yml +79 -0
- data/spec/spec_tests/data/crud_unified/find-comment.yml +166 -0
- data/spec/spec_tests/data/crud_unified/find.yml +68 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-comment.yml +96 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint-clientError.yml +91 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint-serverError.yml +107 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint-unacknowledged.yml +88 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint.yml +102 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-let.yml +2 -4
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-comment.yml +101 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-dots_and_dollars.yml +140 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint-clientError.yml +83 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint-serverError.yml +99 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint-unacknowledged.yml +96 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint.yml +98 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-comment.yml +95 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-dots_and_dollars.yml +127 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint-clientError.yml +84 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint-serverError.yml +100 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint-unacknowledged.yml +92 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint.yml +99 -0
- data/spec/spec_tests/data/crud_unified/insertMany-comment.yml +93 -0
- data/spec/spec_tests/data/crud_unified/insertMany-dots_and_dollars.yml +128 -0
- data/spec/spec_tests/data/crud_unified/insertOne-comment.yml +91 -0
- data/spec/spec_tests/data/crud_unified/insertOne-dots_and_dollars.yml +238 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-comment.yml +105 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-dots_and_dollars.yml +180 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-hint-unacknowledged.yml +95 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-hint.yml +108 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-let.yml +98 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-validation.yml +37 -0
- data/spec/spec_tests/data/crud_unified/updateMany-comment.yml +104 -0
- data/spec/spec_tests/data/crud_unified/updateMany-dots_and_dollars.yml +138 -0
- data/spec/spec_tests/data/crud_unified/updateMany-hint-clientError.yml +91 -0
- data/spec/spec_tests/data/crud_unified/updateMany-hint-serverError.yml +115 -0
- data/spec/spec_tests/data/crud_unified/updateMany-hint-unacknowledged.yml +96 -0
- data/spec/spec_tests/data/crud_unified/updateMany-hint.yml +115 -0
- data/spec/spec_tests/data/crud_unified/updateMany-let.yml +5 -1
- data/spec/spec_tests/data/crud_unified/updateMany-validation.yml +39 -0
- data/spec/spec_tests/data/crud_unified/updateOne-comment.yml +104 -0
- data/spec/spec_tests/data/crud_unified/updateOne-dots_and_dollars.yml +138 -0
- data/spec/spec_tests/data/crud_unified/updateOne-hint-clientError.yml +85 -0
- data/spec/spec_tests/data/crud_unified/updateOne-hint-serverError.yml +109 -0
- data/spec/spec_tests/data/crud_unified/updateOne-hint-unacknowledged.yml +95 -0
- data/spec/spec_tests/data/crud_unified/updateOne-hint.yml +109 -0
- data/spec/spec_tests/data/crud_unified/updateOne-let.yml +5 -1
- data/spec/spec_tests/data/crud_unified/updateOne-validation.yml +37 -0
- data/spec/spec_tests/data/crud_unified/updateWithPipelines.yml +8 -14
- data/spec/spec_tests/data/retryable_reads/{aggregate-merge.yml → legacy/aggregate-merge.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{aggregate-serverErrors.yml → legacy/aggregate-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{aggregate.yml → legacy/aggregate.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{changeStreams-client.watch-serverErrors.yml → legacy/changeStreams-client.watch-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{changeStreams-client.watch.yml → legacy/changeStreams-client.watch.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{changeStreams-db.coll.watch-serverErrors.yml → legacy/changeStreams-db.coll.watch-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{changeStreams-db.coll.watch.yml → legacy/changeStreams-db.coll.watch.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{changeStreams-db.watch-serverErrors.yml → legacy/changeStreams-db.watch-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{changeStreams-db.watch.yml → legacy/changeStreams-db.watch.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{count-serverErrors.yml → legacy/count-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{count.yml → legacy/count.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{countDocuments-serverErrors.yml → legacy/countDocuments-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{countDocuments.yml → legacy/countDocuments.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{distinct-serverErrors.yml → legacy/distinct-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{distinct.yml → legacy/distinct.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount-serverErrors-pre4.9.yml → legacy/estimatedDocumentCount-serverErrors.yml} +0 -2
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount-pre4.9.yml → legacy/estimatedDocumentCount.yml} +0 -2
- data/spec/spec_tests/data/retryable_reads/{find-serverErrors.yml → legacy/find-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{find.yml → legacy/find.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{findOne-serverErrors.yml → legacy/findOne-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{findOne.yml → legacy/findOne.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{gridfs-download-serverErrors.yml → legacy/gridfs-download-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{gridfs-download.yml → legacy/gridfs-download.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{gridfs-downloadByName-serverErrors.yml → legacy/gridfs-downloadByName-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{gridfs-downloadByName.yml → legacy/gridfs-downloadByName.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listCollectionNames-serverErrors.yml → legacy/listCollectionNames-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listCollectionNames.yml → legacy/listCollectionNames.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listCollectionObjects-serverErrors.yml → legacy/listCollectionObjects-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listCollectionObjects.yml → legacy/listCollectionObjects.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listCollections-serverErrors.yml → legacy/listCollections-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listCollections.yml → legacy/listCollections.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listDatabaseNames-serverErrors.yml → legacy/listDatabaseNames-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listDatabaseNames.yml → legacy/listDatabaseNames.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listDatabaseObjects-serverErrors.yml → legacy/listDatabaseObjects-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listDatabaseObjects.yml → legacy/listDatabaseObjects.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listDatabases-serverErrors.yml → legacy/listDatabases-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listDatabases.yml → legacy/listDatabases.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listIndexNames-serverErrors.yml → legacy/listIndexNames-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listIndexNames.yml → legacy/listIndexNames.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listIndexes-serverErrors.yml → legacy/listIndexes-serverErrors.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{listIndexes.yml → legacy/listIndexes.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/{mapReduce.yml → legacy/mapReduce.yml} +0 -0
- data/spec/spec_tests/data/retryable_reads/unified/handshakeError.yml +129 -0
- data/spec/spec_tests/data/retryable_writes/{bulkWrite-errorLabels.yml → legacy/bulkWrite-errorLabels.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{bulkWrite-serverErrors.yml → legacy/bulkWrite-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{bulkWrite.yml → legacy/bulkWrite.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{deleteMany.yml → legacy/deleteMany.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{deleteOne-errorLabels.yml → legacy/deleteOne-errorLabels.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{deleteOne-serverErrors.yml → legacy/deleteOne-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{deleteOne.yml → legacy/deleteOne.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{findOneAndDelete-errorLabels.yml → legacy/findOneAndDelete-errorLabels.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{findOneAndDelete-serverErrors.yml → legacy/findOneAndDelete-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{findOneAndDelete.yml → legacy/findOneAndDelete.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{findOneAndReplace-errorLabels.yml → legacy/findOneAndReplace-errorLabels.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{findOneAndReplace-serverErrors.yml → legacy/findOneAndReplace-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{findOneAndReplace.yml → legacy/findOneAndReplace.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{findOneAndUpdate-errorLabels.yml → legacy/findOneAndUpdate-errorLabels.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{findOneAndUpdate-serverErrors.yml → legacy/findOneAndUpdate-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{findOneAndUpdate.yml → legacy/findOneAndUpdate.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{insertMany-errorLabels.yml → legacy/insertMany-errorLabels.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{insertMany-serverErrors.yml → legacy/insertMany-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{insertMany.yml → legacy/insertMany.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{insertOne-errorLabels.yml → legacy/insertOne-errorLabels.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{insertOne-serverErrors.yml → legacy/insertOne-serverErrors.yml} +5 -5
- data/spec/spec_tests/data/retryable_writes/{insertOne.yml → legacy/insertOne.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{replaceOne-errorLabels.yml → legacy/replaceOne-errorLabels.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{replaceOne-serverErrors.yml → legacy/replaceOne-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{replaceOne.yml → legacy/replaceOne.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{updateMany.yml → legacy/updateMany.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{updateOne-errorLabels.yml → legacy/updateOne-errorLabels.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/{updateOne-serverErrors.yml → legacy/updateOne-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{updateOne.yml → legacy/updateOne.yml} +0 -0
- data/spec/spec_tests/data/retryable_writes/unified/bulkWrite-serverErrors.yml +96 -0
- data/spec/spec_tests/data/retryable_writes/unified/handshakeError.yml +137 -0
- data/spec/spec_tests/data/retryable_writes/unified/insertOne-serverErrors.yml +78 -0
- data/spec/spec_tests/data/sdam/errors/prefer-error-code.yml +2 -2
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-no-results.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-conflicts_with_loadBalanced-true-txt.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-conflicts_with_loadBalanced-true.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-zero-txt.yml +10 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-zero.yml +10 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srv-service-name.yml +11 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-conflicts_with_replicaSet-txt.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-conflicts_with_replicaSet.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-equal_to_srv_records.yml +16 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-greater_than_srv_records.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-less_than_srv_records.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-zero-txt.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-zero.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-equal_to_srv_records.yml +13 -0
- data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-greater_than_srv_records.yml +12 -0
- data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-less_than_srv_records.yml +10 -0
- data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-zero.yml +11 -0
- data/spec/spec_tests/data/server_selection/Unknown/read/ghost.yml +11 -0
- data/spec/spec_tests/data/server_selection/Unknown/write/ghost.yml +11 -0
- data/spec/spec_tests/data/sessions_unified/driver-sessions-server-support.yml +123 -0
- data/spec/spec_tests/data/sessions_unified/snapshot-sessions-not-supported-client-error.yml +9 -3
- data/spec/spec_tests/data/transactions/error-labels.yml +1 -1
- data/spec/spec_tests/data/transactions/errors-client.yml +8 -9
- data/spec/spec_tests/data/transactions/mongos-recovery-token.yml +1 -1
- data/spec/spec_tests/data/transactions/retryable-abort-errorLabels.yml +0 -2
- data/spec/spec_tests/data/transactions/retryable-abort.yml +7 -9
- data/spec/spec_tests/data/transactions/retryable-commit-errorLabels.yml +0 -2
- data/spec/spec_tests/data/transactions/retryable-commit.yml +7 -9
- data/spec/spec_tests/data/transactions/retryable-writes.yml +0 -2
- data/spec/spec_tests/data/unified/invalid/expectedEventsForClient-ignoreExtraEvents-type.yml +15 -0
- data/spec/spec_tests/data/unified/valid-fail/operation-unsupported.yml +13 -0
- data/spec/spec_tests/data/unified/valid-pass/expectedEventsForClient-ignoreExtraEvents.yml +78 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-change-streams.yml +4 -1
- data/spec/spec_tests/data/unified/valid-pass/poc-command-monitoring.yml +3 -3
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions.yml +3 -2
- data/spec/spec_tests/data/uri_options/srv-options.yml +96 -0
- data/spec/spec_tests/data/versioned_api/crud-api-version-1-strict.yml +6 -4
- data/spec/spec_tests/data/versioned_api/crud-api-version-1.yml +7 -5
- data/spec/spec_tests/retryable_reads_spec.rb +4 -1
- data/spec/spec_tests/retryable_reads_unified_spec.rb +22 -0
- data/spec/spec_tests/retryable_writes_spec.rb +4 -1
- data/spec/spec_tests/retryable_writes_unified_spec.rb +21 -0
- data/spec/spec_tests/seed_list_discovery_spec.rb +10 -1
- data/spec/spec_tests/unified_spec.rb +6 -1
- data/spec/stress/connection_pool_timing_spec.rb +2 -1
- data/spec/stress/fork_reconnect_stress_spec.rb +3 -2
- data/spec/support/authorization.rb +1 -1
- data/spec/support/certificates/atlas-ocsp-ca.crt +47 -40
- data/spec/support/certificates/atlas-ocsp.crt +106 -101
- data/spec/support/cluster_tools.rb +1 -1
- data/spec/support/common_shortcuts.rb +22 -0
- data/spec/support/crypt/corpus/corpus-encrypted.json +9515 -0
- data/spec/support/crypt/corpus/corpus-key-aws.json +32 -32
- data/spec/support/crypt/corpus/corpus-key-azure.json +33 -0
- data/spec/support/crypt/corpus/corpus-key-gcp.json +35 -0
- data/spec/support/crypt/corpus/corpus-key-kmip.json +32 -0
- data/spec/support/crypt/corpus/corpus-key-local.json +30 -30
- data/spec/support/crypt/corpus/corpus-schema.json +4399 -121
- data/spec/support/crypt/corpus/corpus.json +4999 -37
- data/spec/support/crypt/data_keys/key_document_azure.json +33 -0
- data/spec/support/crypt/data_keys/key_document_gcp.json +37 -0
- data/spec/support/crypt/data_keys/key_document_kmip.json +32 -0
- data/spec/support/crypt/encryptedFields.json +33 -0
- data/spec/support/crypt/keys/key1-document.json +30 -0
- data/spec/support/crypt/schema_maps/schema_map_azure.json +17 -0
- data/spec/support/crypt/schema_maps/schema_map_azure_key_alt_names.json +12 -0
- data/spec/support/crypt/schema_maps/schema_map_gcp.json +17 -0
- data/spec/support/crypt/schema_maps/schema_map_gcp_key_alt_names.json +12 -0
- data/spec/support/crypt/schema_maps/schema_map_kmip.json +17 -0
- data/spec/support/crypt/schema_maps/schema_map_kmip_key_alt_names.json +12 -0
- data/spec/support/crypt.rb +207 -6
- data/spec/support/macros.rb +18 -0
- data/spec/support/mongos_macros.rb +17 -0
- data/spec/support/shared/scram_conversation.rb +2 -1
- data/spec/support/shared/session.rb +13 -7
- data/spec/support/spec_config.rb +82 -1
- data/spec/support/utils.rb +25 -4
- data.tar.gz.sig +0 -0
- metadata +1468 -1214
- metadata.gz.sig +0 -0
- data/lib/mongo/operation/delete/legacy.rb +0 -64
- data/lib/mongo/operation/insert/legacy.rb +0 -68
- data/lib/mongo/operation/update/legacy/result.rb +0 -112
- data/lib/mongo/operation/update/legacy.rb +0 -76
- data/spec/mongo/dbref_spec.rb +0 -152
- data/spec/mongo/operation/kill_cursors_spec.rb +0 -47
- data/spec/spec_tests/change_streams_spec.rb +0 -93
- data/spec/spec_tests/data/change_streams/change-streams-errors.yml +0 -101
- data/spec/spec_tests/data/change_streams/change-streams-resume-allowlist.yml +0 -1173
- data/spec/spec_tests/data/change_streams/change-streams-resume-errorLabels.yml +0 -1105
- data/spec/spec_tests/data/change_streams/change-streams.yml +0 -535
- data/spec/spec_tests/data/crud_v2/aggregate-merge.yml +0 -103
- data/spec/spec_tests/data/crud_v2/aggregate-out-readConcern.yml +0 -111
- data/spec/spec_tests/data/crud_v2/bulkWrite-arrayFilters.yml +0 -103
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint-clientError.yml +0 -63
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint-serverError.yml +0 -92
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint.yml +0 -103
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint-clientError.yml +0 -90
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint-serverError.yml +0 -147
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint.yml +0 -164
- data/spec/spec_tests/data/crud_v2/db-aggregate.yml +0 -39
- data/spec/spec_tests/data/crud_v2/deleteMany-hint-clientError.yml +0 -43
- data/spec/spec_tests/data/crud_v2/deleteMany-hint-serverError.yml +0 -62
- data/spec/spec_tests/data/crud_v2/deleteMany-hint.yml +0 -58
- data/spec/spec_tests/data/crud_v2/deleteOne-hint-clientError.yml +0 -41
- data/spec/spec_tests/data/crud_v2/deleteOne-hint-serverError.yml +0 -60
- data/spec/spec_tests/data/crud_v2/deleteOne-hint.yml +0 -57
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse-clientError.yml +0 -28
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse-serverError.yml +0 -44
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse.yml +0 -50
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint-clientError.yml +0 -45
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint-serverError.yml +0 -60
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint.yml +0 -56
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint-serverError.yml +0 -59
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint.yml +0 -55
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint-serverError.yml +0 -58
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint.yml +0 -55
- data/spec/spec_tests/data/crud_v2/replaceOne-hint.yml +0 -61
- data/spec/spec_tests/data/crud_v2/unacknowledged-bulkWrite-delete-hint-clientError.yml +0 -60
- data/spec/spec_tests/data/crud_v2/unacknowledged-bulkWrite-update-hint-clientError.yml +0 -88
- data/spec/spec_tests/data/crud_v2/unacknowledged-deleteMany-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/unacknowledged-deleteOne-hint-clientError.yml +0 -38
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndDelete-hint-clientError.yml +0 -42
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndReplace-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndUpdate-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/unacknowledged-replaceOne-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/unacknowledged-updateMany-hint-clientError.yml +0 -43
- data/spec/spec_tests/data/crud_v2/unacknowledged-updateOne-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/updateMany-hint-clientError.yml +0 -45
- data/spec/spec_tests/data/crud_v2/updateMany-hint-serverError.yml +0 -66
- data/spec/spec_tests/data/crud_v2/updateMany-hint.yml +0 -65
- data/spec/spec_tests/data/crud_v2/updateOne-hint-clientError.yml +0 -43
- data/spec/spec_tests/data/crud_v2/updateOne-hint-serverError.yml +0 -62
- data/spec/spec_tests/data/crud_v2/updateOne-hint.yml +0 -61
- data/spec/spec_tests/data/crud_v2/updateWithPipelines.yml +0 -157
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-4.9.yml +0 -60
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors-4.9.yml +0 -146
- data/spec/support/crypt/corpus/corpus_encrypted.json +0 -4152
- data/spec/support/session_registry.rb +0 -55
@@ -0,0 +1,404 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'mongo'
|
5
|
+
require 'lite_spec_helper'
|
6
|
+
|
7
|
+
describe Mongo::Crypt::KMS::Credentials do
|
8
|
+
require_libmongocrypt
|
9
|
+
include_context 'define shared FLE helpers'
|
10
|
+
|
11
|
+
context 'AWS' do
|
12
|
+
let (:params) do
|
13
|
+
Mongo::Crypt::KMS::AWS::Credentials.new(kms_provider)
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with empty AWS kms_provider' do
|
17
|
+
let(:kms_provider) do
|
18
|
+
{}
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'raises an exception' do
|
22
|
+
expect do
|
23
|
+
params
|
24
|
+
end.to raise_error(ArgumentError, /The specified KMS provider options are invalid: {}. AWS KMS provider options must be in the format: { access_key_id: 'YOUR-ACCESS-KEY-ID', secret_access_key: 'SECRET-ACCESS-KEY' }/)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
%i(access_key_id secret_access_key).each do |key|
|
29
|
+
context "with nil AWS #{key}" do
|
30
|
+
let(:kms_provider) do
|
31
|
+
{
|
32
|
+
access_key_id: SpecConfig.instance.fle_aws_key,
|
33
|
+
secret_access_key: SpecConfig.instance.fle_aws_secret,
|
34
|
+
}.update({key => nil})
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'raises an exception' do
|
38
|
+
expect do
|
39
|
+
params
|
40
|
+
end.to raise_error(ArgumentError, /The #{key} option must be a String with at least one character; currently have nil/)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "with non-string AWS #{key}" do
|
45
|
+
let(:kms_provider) do
|
46
|
+
{
|
47
|
+
access_key_id: SpecConfig.instance.fle_aws_key,
|
48
|
+
secret_access_key: SpecConfig.instance.fle_aws_secret,
|
49
|
+
}.update({key => 5})
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'raises an exception' do
|
53
|
+
expect do
|
54
|
+
params
|
55
|
+
end.to raise_error(ArgumentError, /The #{key} option must be a String with at least one character; currently have 5/)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "with empty string AWS #{key}" do
|
60
|
+
let(:kms_provider) do
|
61
|
+
{
|
62
|
+
access_key_id: SpecConfig.instance.fle_aws_key,
|
63
|
+
secret_access_key: SpecConfig.instance.fle_aws_secret,
|
64
|
+
}.update({key => ''})
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'raises an exception' do
|
68
|
+
expect do
|
69
|
+
params
|
70
|
+
end.to raise_error(ArgumentError, /The #{key} option must be a String with at least one character; it is currently an empty string/)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'with valid params' do
|
76
|
+
let(:kms_provider) do
|
77
|
+
{
|
78
|
+
access_key_id: SpecConfig.instance.fle_aws_key,
|
79
|
+
secret_access_key: SpecConfig.instance.fle_aws_secret,
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'returns valid libmongocrypt credentials' do
|
84
|
+
expect(params.to_document).to eq(
|
85
|
+
BSON::Document.new({
|
86
|
+
accessKeyId: SpecConfig.instance.fle_aws_key,
|
87
|
+
secretAccessKey: SpecConfig.instance.fle_aws_secret,
|
88
|
+
})
|
89
|
+
)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'Azure' do
|
95
|
+
let (:params) do
|
96
|
+
Mongo::Crypt::KMS::Azure::Credentials.new(kms_provider)
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'with empty Azure kms_provider' do
|
100
|
+
let(:kms_provider) do
|
101
|
+
{}
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'raises an exception' do
|
105
|
+
expect do
|
106
|
+
params
|
107
|
+
end.to raise_error(ArgumentError, /The specified KMS provider options are invalid: {}. Azure KMS provider options must be in the format: { tenant_id: 'TENANT-ID', client_id: 'TENANT_ID', client_secret: 'CLIENT_SECRET' }/)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
%i(tenant_id client_id client_secret).each do |param|
|
112
|
+
|
113
|
+
context "with nil azure #{param}" do
|
114
|
+
let(:kms_provider) do
|
115
|
+
{
|
116
|
+
tenant_id: SpecConfig.instance.fle_azure_tenant_id,
|
117
|
+
client_id: SpecConfig.instance.fle_azure_client_id,
|
118
|
+
client_secret: SpecConfig.instance.fle_azure_client_secret
|
119
|
+
}.update(param => nil)
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'raises an exception' do
|
123
|
+
expect do
|
124
|
+
params
|
125
|
+
end.to raise_error(ArgumentError, /The #{param} option must be a String with at least one character; currently have nil/)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context "with non-string azure #{param}" do
|
130
|
+
let(:kms_provider) do
|
131
|
+
{
|
132
|
+
tenant_id: SpecConfig.instance.fle_azure_tenant_id,
|
133
|
+
client_id: SpecConfig.instance.fle_azure_client_id,
|
134
|
+
client_secret: SpecConfig.instance.fle_azure_client_secret
|
135
|
+
}.update(param => 5)
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'raises an exception' do
|
139
|
+
expect do
|
140
|
+
params
|
141
|
+
end.to raise_error(ArgumentError, /The #{param} option must be a String with at least one character; currently have 5/)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context "with empty string azure #{param}" do
|
146
|
+
let(:kms_provider) do
|
147
|
+
{
|
148
|
+
tenant_id: SpecConfig.instance.fle_azure_tenant_id,
|
149
|
+
client_id: SpecConfig.instance.fle_azure_client_id,
|
150
|
+
client_secret: SpecConfig.instance.fle_azure_client_secret
|
151
|
+
}.update(param => '')
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'raises an exception' do
|
155
|
+
expect do
|
156
|
+
params
|
157
|
+
end.to raise_error(ArgumentError, /The #{param} option must be a String with at least one character; it is currently an empty string/)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
context "with non-string azure identity_platform_endpoint" do
|
163
|
+
let(:kms_provider) do
|
164
|
+
{
|
165
|
+
tenant_id: SpecConfig.instance.fle_azure_tenant_id,
|
166
|
+
client_id: SpecConfig.instance.fle_azure_client_id,
|
167
|
+
client_secret: SpecConfig.instance.fle_azure_client_secret,
|
168
|
+
identity_platform_endpoint: 5
|
169
|
+
}
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'raises an exception' do
|
173
|
+
expect do
|
174
|
+
params
|
175
|
+
end.to raise_error(ArgumentError, /The identity_platform_endpoint option must be a String with at least one character; currently have 5/)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
context "with empty string azure identity_platform_endpoint" do
|
180
|
+
let(:kms_provider) do
|
181
|
+
{
|
182
|
+
tenant_id: SpecConfig.instance.fle_azure_tenant_id,
|
183
|
+
client_id: SpecConfig.instance.fle_azure_client_id,
|
184
|
+
client_secret: SpecConfig.instance.fle_azure_client_secret,
|
185
|
+
identity_platform_endpoint: ''
|
186
|
+
}
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'raises an exception' do
|
190
|
+
expect do
|
191
|
+
params
|
192
|
+
end.to raise_error(ArgumentError, /The identity_platform_endpoint option must be a String with at least one character; it is currently an empty string/)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context 'with valid params' do
|
197
|
+
let(:kms_provider) do
|
198
|
+
{
|
199
|
+
tenant_id: SpecConfig.instance.fle_azure_tenant_id,
|
200
|
+
client_id: SpecConfig.instance.fle_azure_client_id,
|
201
|
+
client_secret: SpecConfig.instance.fle_azure_client_secret,
|
202
|
+
}
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'returns valid libmongocrypt credentials' do
|
206
|
+
expect(params.to_document).to eq(
|
207
|
+
BSON::Document.new({
|
208
|
+
tenantId: SpecConfig.instance.fle_azure_tenant_id,
|
209
|
+
clientId: SpecConfig.instance.fle_azure_client_id,
|
210
|
+
clientSecret: SpecConfig.instance.fle_azure_client_secret,
|
211
|
+
})
|
212
|
+
)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
context 'GCP' do
|
218
|
+
let (:params) do
|
219
|
+
Mongo::Crypt::KMS::GCP::Credentials.new(kms_provider)
|
220
|
+
end
|
221
|
+
|
222
|
+
context 'with empty GCP kms_provider' do
|
223
|
+
let(:kms_provider) do
|
224
|
+
{}
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'raises an exception' do
|
228
|
+
expect do
|
229
|
+
params
|
230
|
+
end.to raise_error(ArgumentError, /The specified KMS provider options are invalid: {}. GCP KMS provider options must be in the format: { email: 'EMAIL', private_key: 'PRIVATE-KEY' }/)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
%i(email private_key).each do |key|
|
235
|
+
context "with nil GCP #{key}" do
|
236
|
+
let(:kms_provider) do
|
237
|
+
{
|
238
|
+
email: SpecConfig.instance.fle_gcp_email,
|
239
|
+
private_key: SpecConfig.instance.fle_gcp_private_key,
|
240
|
+
}.update({key => nil})
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'raises an exception' do
|
244
|
+
expect do
|
245
|
+
params
|
246
|
+
end.to raise_error(ArgumentError, /The #{key} option must be a String with at least one character; currently have nil/)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
context "with non-string GCP #{key}" do
|
251
|
+
let(:kms_provider) do
|
252
|
+
{
|
253
|
+
email: SpecConfig.instance.fle_gcp_email,
|
254
|
+
private_key: SpecConfig.instance.fle_gcp_private_key,
|
255
|
+
}.update({key => 5})
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'raises an exception' do
|
259
|
+
expect do
|
260
|
+
params
|
261
|
+
end.to raise_error(ArgumentError, /The #{key} option must be a String with at least one character; currently have 5/)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
context "with empty string GCP #{key}" do
|
266
|
+
let(:kms_provider) do
|
267
|
+
{
|
268
|
+
email: SpecConfig.instance.fle_gcp_email,
|
269
|
+
private_key: SpecConfig.instance.fle_gcp_private_key,
|
270
|
+
}.update({key => ''})
|
271
|
+
end
|
272
|
+
|
273
|
+
it 'raises an exception' do
|
274
|
+
expect do
|
275
|
+
params
|
276
|
+
end.to raise_error(ArgumentError, /The #{key} option must be a String with at least one character; it is currently an empty string/)
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
context 'with valid params' do
|
282
|
+
let(:kms_provider) do
|
283
|
+
{
|
284
|
+
email: SpecConfig.instance.fle_gcp_email,
|
285
|
+
private_key: SpecConfig.instance.fle_gcp_private_key,
|
286
|
+
}
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'returns valid libmongocrypt credentials' do
|
290
|
+
expect(params.to_document).to eq(
|
291
|
+
BSON::Document.new({
|
292
|
+
email: SpecConfig.instance.fle_gcp_email,
|
293
|
+
privateKey: BSON::Binary.new(SpecConfig.instance.fle_gcp_private_key, :generic),
|
294
|
+
})
|
295
|
+
)
|
296
|
+
end
|
297
|
+
|
298
|
+
context 'PEM private key' do
|
299
|
+
require_mri
|
300
|
+
before(:all) do
|
301
|
+
if RUBY_VERSION < "3.0"
|
302
|
+
skip "Ruby version 3.0 or higher required"
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
let(:private_key_pem) do
|
307
|
+
OpenSSL::PKey.read(
|
308
|
+
Base64.decode64(SpecConfig.instance.fle_gcp_private_key)
|
309
|
+
).export
|
310
|
+
end
|
311
|
+
|
312
|
+
let(:kms_provider) do
|
313
|
+
{
|
314
|
+
email: SpecConfig.instance.fle_gcp_email,
|
315
|
+
private_key: private_key_pem,
|
316
|
+
}
|
317
|
+
end
|
318
|
+
|
319
|
+
it 'returns valid libmongocrypt credentials' do
|
320
|
+
private_key = params.to_document[:privateKey]
|
321
|
+
expect(Base64.decode64(private_key.data)).to eq(
|
322
|
+
Base64.decode64(SpecConfig.instance.fle_gcp_private_key)
|
323
|
+
)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
context 'KMIP' do
|
330
|
+
let (:params) do
|
331
|
+
Mongo::Crypt::KMS::KMIP::Credentials.new(kms_provider)
|
332
|
+
end
|
333
|
+
|
334
|
+
context 'with empty KMIP kms_provider' do
|
335
|
+
let(:kms_provider) do
|
336
|
+
{}
|
337
|
+
end
|
338
|
+
|
339
|
+
it 'raises an exception' do
|
340
|
+
expect do
|
341
|
+
params
|
342
|
+
end.to raise_error(ArgumentError, /The specified KMS provider options are invalid: {}. KMIP KMS provider options must be in the format: { endpoint: 'ENDPOINT' }/)
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
context "with nil KMIP endpoint" do
|
347
|
+
let(:kms_provider) do
|
348
|
+
{
|
349
|
+
endpoint: nil
|
350
|
+
}
|
351
|
+
end
|
352
|
+
|
353
|
+
it 'raises an exception' do
|
354
|
+
expect do
|
355
|
+
params
|
356
|
+
end.to raise_error(ArgumentError, /The endpoint option must be a String with at least one character; currently have nil/)
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
context "with non-string KMIP endpoint" do
|
361
|
+
let(:kms_provider) do
|
362
|
+
{
|
363
|
+
endpoint: 5,
|
364
|
+
}
|
365
|
+
end
|
366
|
+
|
367
|
+
it 'raises an exception' do
|
368
|
+
expect do
|
369
|
+
params
|
370
|
+
end.to raise_error(ArgumentError, /The endpoint option must be a String with at least one character; currently have 5/)
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
context "with empty string KMIP endpoint" do
|
375
|
+
let(:kms_provider) do
|
376
|
+
{
|
377
|
+
endpoint: '',
|
378
|
+
}
|
379
|
+
end
|
380
|
+
|
381
|
+
it 'raises an exception' do
|
382
|
+
expect do
|
383
|
+
params
|
384
|
+
end.to raise_error(ArgumentError, /The endpoint option must be a String with at least one character; it is currently an empty string/)
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
context 'with valid params' do
|
389
|
+
let(:kms_provider) do
|
390
|
+
{
|
391
|
+
endpoint: SpecConfig.instance.fle_kmip_endpoint,
|
392
|
+
}
|
393
|
+
end
|
394
|
+
|
395
|
+
it 'returns valid libmongocrypt credentials' do
|
396
|
+
expect(params.to_document).to eq(
|
397
|
+
BSON::Document.new({
|
398
|
+
endpoint: SpecConfig.instance.fle_kmip_endpoint,
|
399
|
+
})
|
400
|
+
)
|
401
|
+
end
|
402
|
+
end
|
403
|
+
end
|
404
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'mongo'
|
5
|
+
require 'lite_spec_helper'
|
6
|
+
|
7
|
+
describe Mongo::Crypt::KMS do
|
8
|
+
context 'Validations' do
|
9
|
+
context '.validate_tls_options' do
|
10
|
+
it 'returns valid options for nil parameter' do
|
11
|
+
expect(
|
12
|
+
Mongo::Crypt::KMS::Validations.validate_tls_options(nil)
|
13
|
+
).to eq({})
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'accepts empty hash' do
|
17
|
+
expect(
|
18
|
+
Mongo::Crypt::KMS::Validations.validate_tls_options({})
|
19
|
+
).to eq({})
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'does not allow disabled ssl' do
|
23
|
+
expect {
|
24
|
+
Mongo::Crypt::KMS::Validations.validate_tls_options(
|
25
|
+
{
|
26
|
+
aws: {ssl: false}
|
27
|
+
}
|
28
|
+
)
|
29
|
+
}.to raise_error(ArgumentError, /TLS is required/)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'does not allow insecure tls options' do
|
33
|
+
%i(
|
34
|
+
ssl_verify_certificate
|
35
|
+
ssl_verify_hostname
|
36
|
+
ssl_verify_ocsp_endpoint
|
37
|
+
).each do |insecure_opt|
|
38
|
+
expect {
|
39
|
+
Mongo::Crypt::KMS::Validations.validate_tls_options(
|
40
|
+
{
|
41
|
+
aws: {insecure_opt => false}
|
42
|
+
}
|
43
|
+
)
|
44
|
+
}.to raise_error(ArgumentError, /Insecure TLS options prohibited/)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'allows valid options' do
|
49
|
+
options = {
|
50
|
+
aws: {
|
51
|
+
ssl: true,
|
52
|
+
ssl_cert_string: 'Content is not validated',
|
53
|
+
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/spec/mongo/cursor_spec.rb
CHANGED
@@ -353,7 +353,12 @@ describe Mongo::Cursor do
|
|
353
353
|
cluster.instance_variable_get(:@periodic_executor).flush
|
354
354
|
expect do
|
355
355
|
cursor.to_a
|
356
|
-
|
356
|
+
# Mongo::Error::SessionEnded is raised here because the periodic executor
|
357
|
+
# called above kills the cursor and closes the session.
|
358
|
+
# This code is normally scheduled in cursor finalizer, so the cursor object
|
359
|
+
# is garbage collected when the code is executed. So, a user won't get
|
360
|
+
# this exception.
|
361
|
+
end.to raise_exception(Mongo::Error::SessionEnded)
|
357
362
|
end
|
358
363
|
|
359
364
|
context 'when the cursor is unregistered before the kill cursors operations are executed' do
|
@@ -544,6 +549,36 @@ describe Mongo::Cursor do
|
|
544
549
|
end
|
545
550
|
end
|
546
551
|
end
|
552
|
+
|
553
|
+
context 'when the result set is iterated fully and the cursor id is non-zero' do
|
554
|
+
min_server_fcv '5.0'
|
555
|
+
|
556
|
+
let(:documents) do
|
557
|
+
(1..5).map{ |i| { field: "test#{i}" }}
|
558
|
+
end
|
559
|
+
|
560
|
+
let(:view) { collection.find(field:{'$gte'=>BSON::MinKey.new}).sort(field:1).limit(5).batch_size(4) }
|
561
|
+
|
562
|
+
before do
|
563
|
+
view.to_a
|
564
|
+
end
|
565
|
+
|
566
|
+
it 'schedules a get more command' do
|
567
|
+
get_more_commands = subscriber.started_events.select { |e| e.command_name == 'getMore' }
|
568
|
+
expect(get_more_commands.length).to be 1
|
569
|
+
end
|
570
|
+
|
571
|
+
it 'has a non-zero cursor id on successful get more' do
|
572
|
+
get_more_commands = subscriber.succeeded_events.select { |e| e.command_name == 'getMore' }
|
573
|
+
expect(get_more_commands.length).to be 1
|
574
|
+
expect(get_more_commands[0].reply['cursor']['id']).to_not be 0
|
575
|
+
end
|
576
|
+
|
577
|
+
it 'schedules a kill cursors command' do
|
578
|
+
get_more_commands = subscriber.started_events.select { |e| e.command_name == 'killCursors' }
|
579
|
+
expect(get_more_commands.length).to be 1
|
580
|
+
end
|
581
|
+
end
|
547
582
|
end
|
548
583
|
|
549
584
|
describe '#inspect' do
|
@@ -569,6 +604,7 @@ describe Mongo::Cursor do
|
|
569
604
|
allow(reply).to receive(:namespace)
|
570
605
|
allow(reply).to receive(:connection_description).and_return(conn_desc)
|
571
606
|
allow(reply).to receive(:cursor_id).and_return(42)
|
607
|
+
allow(reply).to receive(:connection_global_id).and_return(1)
|
572
608
|
end
|
573
609
|
end
|
574
610
|
|
@@ -698,54 +734,4 @@ describe Mongo::Cursor do
|
|
698
734
|
end
|
699
735
|
end
|
700
736
|
end
|
701
|
-
|
702
|
-
describe '#batch_size' do
|
703
|
-
let(:subscriber) { Mrss::EventSubscriber.new }
|
704
|
-
|
705
|
-
let(:subscribed_client) do
|
706
|
-
authorized_client.tap do |client|
|
707
|
-
client.subscribe(Mongo::Monitoring::COMMAND, subscriber)
|
708
|
-
end
|
709
|
-
end
|
710
|
-
|
711
|
-
let(:collection) do
|
712
|
-
subscribed_client[TEST_COLL]
|
713
|
-
end
|
714
|
-
|
715
|
-
let(:view) do
|
716
|
-
collection.find({}, limit: limit)
|
717
|
-
end
|
718
|
-
|
719
|
-
before do
|
720
|
-
collection.drop
|
721
|
-
collection.insert_many([].fill({ "bar": "baz" }, 0, 102))
|
722
|
-
end
|
723
|
-
|
724
|
-
context 'when limit is 0 and batch_size is not set' do
|
725
|
-
let(:limit) do
|
726
|
-
0
|
727
|
-
end
|
728
|
-
|
729
|
-
it 'does not set batch_size' do
|
730
|
-
view.to_a
|
731
|
-
get_more_commands = subscriber.started_events.select { |e| e.command_name == 'getMore' }
|
732
|
-
expect(get_more_commands.length).to eq(1)
|
733
|
-
expect(get_more_commands.first.command.keys).not_to include('batchSize')
|
734
|
-
end
|
735
|
-
end
|
736
|
-
|
737
|
-
context 'when limit is not zero and batch_size is not set' do
|
738
|
-
let(:limit) do
|
739
|
-
1000
|
740
|
-
end
|
741
|
-
|
742
|
-
it 'sets batch_size' do
|
743
|
-
view.to_a
|
744
|
-
get_more_commands = subscriber.started_events.select { |e| e.command_name == 'getMore' }
|
745
|
-
|
746
|
-
expect(get_more_commands.length).to eq(1)
|
747
|
-
expect(get_more_commands.first.command.keys).to include('batchSize')
|
748
|
-
end
|
749
|
-
end
|
750
|
-
end
|
751
737
|
end
|
data/spec/mongo/database_spec.rb
CHANGED
@@ -18,6 +18,14 @@ describe Mongo::Database do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
22
|
+
|
23
|
+
let(:monitored_client) do
|
24
|
+
root_authorized_client.tap do |client|
|
25
|
+
client.subscribe(Mongo::Monitoring::COMMAND, subscriber)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
21
29
|
describe '#==' do
|
22
30
|
|
23
31
|
let(:database) do
|
@@ -278,6 +286,18 @@ describe Mongo::Database do
|
|
278
286
|
collection_names.should include('coll-119')
|
279
287
|
end
|
280
288
|
end
|
289
|
+
|
290
|
+
context 'with comment' do
|
291
|
+
min_server_version '4.4'
|
292
|
+
|
293
|
+
it 'returns collection names and send comment' do
|
294
|
+
database = described_class.new(monitored_client, SpecConfig.instance.test_db)
|
295
|
+
database.collection_names(comment: "comment")
|
296
|
+
command = subscriber.command_started_events("listCollections").last&.command
|
297
|
+
expect(command).not_to be_nil
|
298
|
+
expect(command["comment"]).to eq("comment")
|
299
|
+
end
|
300
|
+
end
|
281
301
|
end
|
282
302
|
|
283
303
|
describe '#list_collections' do
|
@@ -479,6 +499,18 @@ describe Mongo::Database do
|
|
479
499
|
collection_names.should include('coll-119')
|
480
500
|
end
|
481
501
|
end
|
502
|
+
|
503
|
+
context 'with comment' do
|
504
|
+
min_server_version '4.4'
|
505
|
+
|
506
|
+
it 'returns collection names and send comment' do
|
507
|
+
database = described_class.new(monitored_client, SpecConfig.instance.test_db)
|
508
|
+
database.list_collections(comment: "comment")
|
509
|
+
command = subscriber.command_started_events("listCollections").last&.command
|
510
|
+
expect(command).not_to be_nil
|
511
|
+
expect(command["comment"]).to eq("comment")
|
512
|
+
end
|
513
|
+
end
|
482
514
|
end
|
483
515
|
|
484
516
|
describe '#collections' do
|
@@ -591,7 +623,7 @@ describe Mongo::Database do
|
|
591
623
|
end
|
592
624
|
end
|
593
625
|
|
594
|
-
context 'when authorized_collections are provided' do
|
626
|
+
context 'when authorized_collections are provided as false' do
|
595
627
|
let(:options) do
|
596
628
|
{ authorized_collections: false }
|
597
629
|
end
|
@@ -612,6 +644,27 @@ describe Mongo::Database do
|
|
612
644
|
end
|
613
645
|
end
|
614
646
|
|
647
|
+
context 'when authorized_collections are provided as true' do
|
648
|
+
let(:options) do
|
649
|
+
{ authorized_collections: true }
|
650
|
+
end
|
651
|
+
|
652
|
+
let!(:result) do
|
653
|
+
database.collections(options)
|
654
|
+
end
|
655
|
+
|
656
|
+
let(:events) do
|
657
|
+
subscriber.command_started_events('listCollections')
|
658
|
+
end
|
659
|
+
|
660
|
+
it 'authorized_collections not passed to server because false' do
|
661
|
+
expect(events.length).to eq(1)
|
662
|
+
command = events.first.command
|
663
|
+
expect(command['nameOnly']).to eq(true)
|
664
|
+
expect(command['authorizedCollections']).to eq(true)
|
665
|
+
end
|
666
|
+
end
|
667
|
+
|
615
668
|
context 'when no options are provided' do
|
616
669
|
let!(:result) do
|
617
670
|
database.collections
|
@@ -647,6 +700,18 @@ describe Mongo::Database do
|
|
647
700
|
collection_names.should include('coll-119')
|
648
701
|
end
|
649
702
|
end
|
703
|
+
|
704
|
+
context 'with comment' do
|
705
|
+
min_server_version '4.4'
|
706
|
+
|
707
|
+
it 'returns collection names and send comment' do
|
708
|
+
database = described_class.new(monitored_client, SpecConfig.instance.test_db)
|
709
|
+
database.collections(comment: "comment")
|
710
|
+
command = subscriber.command_started_events("listCollections").last&.command
|
711
|
+
expect(command).not_to be_nil
|
712
|
+
expect(command["comment"]).to eq("comment")
|
713
|
+
end
|
714
|
+
end
|
650
715
|
end
|
651
716
|
|
652
717
|
describe '#command' do
|