mongo 2.13.0 → 2.15.0.alpha
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 +1 -4
- data.tar.gz.sig +0 -0
- data/README.md +4 -1
- data/Rakefile +46 -18
- data/lib/mongo.rb +32 -0
- data/lib/mongo/address.rb +1 -1
- data/lib/mongo/address/ipv4.rb +1 -1
- data/lib/mongo/address/ipv6.rb +1 -1
- data/lib/mongo/auth/aws/conversation.rb +1 -4
- data/lib/mongo/auth/base.rb +13 -7
- data/lib/mongo/auth/conversation_base.rb +32 -0
- data/lib/mongo/auth/cr/conversation.rb +6 -29
- data/lib/mongo/auth/gssapi/conversation.rb +4 -15
- data/lib/mongo/auth/ldap/conversation.rb +3 -14
- data/lib/mongo/auth/sasl_conversation_base.rb +1 -13
- data/lib/mongo/auth/scram_conversation_base.rb +7 -34
- data/lib/mongo/auth/user/view.rb +16 -9
- data/lib/mongo/auth/x509/conversation.rb +4 -25
- data/lib/mongo/background_thread.rb +11 -0
- data/lib/mongo/bulk_write.rb +38 -18
- data/lib/mongo/caching_cursor.rb +74 -0
- data/lib/mongo/client.rb +142 -16
- data/lib/mongo/cluster.rb +22 -31
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +6 -2
- data/lib/mongo/cluster/sdam_flow.rb +14 -0
- data/lib/mongo/cluster/topology/single.rb +1 -1
- data/lib/mongo/collection.rb +58 -18
- data/lib/mongo/collection/view.rb +24 -20
- data/lib/mongo/collection/view/aggregation.rb +26 -5
- data/lib/mongo/collection/view/builder/find_command.rb +38 -18
- data/lib/mongo/collection/view/change_stream.rb +1 -1
- data/lib/mongo/collection/view/explainable.rb +27 -8
- data/lib/mongo/collection/view/iterable.rb +73 -13
- data/lib/mongo/collection/view/map_reduce.rb +2 -2
- data/lib/mongo/collection/view/readable.rb +57 -21
- data/lib/mongo/collection/view/writable.rb +29 -15
- data/lib/mongo/crypt/encryption_io.rb +6 -6
- data/lib/mongo/cursor.rb +18 -5
- data/lib/mongo/database.rb +28 -5
- data/lib/mongo/database/view.rb +2 -2
- data/lib/mongo/error.rb +11 -1
- data/lib/mongo/error/bulk_write_error.rb +17 -3
- data/lib/mongo/error/internal_driver_error.rb +22 -0
- data/lib/mongo/error/invalid_read_concern.rb +28 -0
- data/lib/mongo/error/operation_failure.rb +26 -7
- data/lib/mongo/error/parser.rb +65 -12
- data/lib/mongo/error/server_api_conflict.rb +23 -0
- data/lib/mongo/error/server_api_not_supported.rb +24 -0
- data/lib/mongo/error/server_certificate_revoked.rb +22 -0
- data/lib/mongo/error/unmet_dependency.rb +21 -0
- data/lib/mongo/error/unsupported_option.rb +14 -12
- data/lib/mongo/grid/fs_bucket.rb +37 -37
- data/lib/mongo/index/view.rb +21 -11
- data/lib/mongo/lint.rb +2 -1
- data/lib/mongo/logger.rb +3 -3
- data/lib/mongo/monitoring.rb +13 -4
- data/lib/mongo/monitoring/event/server_heartbeat_failed.rb +27 -16
- data/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb +26 -15
- data/lib/mongo/operation.rb +4 -2
- data/lib/mongo/operation/aggregate/result.rb +9 -8
- data/lib/mongo/operation/collections_info.rb +18 -1
- data/lib/mongo/operation/collections_info/command.rb +5 -0
- data/lib/mongo/operation/collections_info/result.rb +18 -1
- data/lib/mongo/operation/context.rb +99 -0
- data/lib/mongo/operation/delete/bulk_result.rb +2 -0
- data/lib/mongo/operation/delete/result.rb +3 -0
- data/lib/mongo/operation/explain/command.rb +4 -0
- data/lib/mongo/operation/explain/legacy.rb +4 -0
- data/lib/mongo/operation/explain/op_msg.rb +6 -0
- data/lib/mongo/operation/explain/result.rb +3 -0
- data/lib/mongo/operation/find/legacy/result.rb +2 -0
- data/lib/mongo/operation/find/result.rb +13 -0
- data/lib/mongo/operation/get_more/result.rb +3 -0
- data/lib/mongo/operation/indexes.rb +15 -1
- data/lib/mongo/operation/indexes/result.rb +5 -0
- data/lib/mongo/operation/insert/bulk_result.rb +5 -0
- data/lib/mongo/operation/insert/command.rb +2 -2
- data/lib/mongo/operation/insert/legacy.rb +2 -2
- data/lib/mongo/operation/insert/op_msg.rb +2 -2
- data/lib/mongo/operation/insert/result.rb +5 -0
- data/lib/mongo/operation/list_collections/result.rb +9 -1
- data/lib/mongo/operation/map_reduce/result.rb +10 -0
- data/lib/mongo/operation/parallel_scan/result.rb +4 -0
- data/lib/mongo/operation/result.rb +37 -6
- data/lib/mongo/operation/shared/bypass_document_validation.rb +1 -0
- data/lib/mongo/operation/shared/causal_consistency_supported.rb +1 -0
- data/lib/mongo/operation/shared/executable.rb +25 -14
- data/lib/mongo/operation/shared/executable_no_validate.rb +2 -2
- data/lib/mongo/operation/shared/idable.rb +2 -1
- data/lib/mongo/operation/shared/limited.rb +1 -0
- data/lib/mongo/operation/shared/object_id_generator.rb +1 -0
- data/lib/mongo/operation/shared/op_msg_or_command.rb +1 -7
- data/lib/mongo/operation/shared/op_msg_or_find_command.rb +1 -7
- data/lib/mongo/operation/shared/polymorphic_operation.rb +39 -0
- data/lib/mongo/operation/shared/response_handling.rb +23 -23
- data/lib/mongo/operation/shared/result/aggregatable.rb +1 -0
- data/lib/mongo/operation/shared/sessions_supported.rb +14 -2
- data/lib/mongo/operation/shared/specifiable.rb +1 -0
- data/lib/mongo/operation/shared/write.rb +9 -18
- data/lib/mongo/operation/shared/write_concern_supported.rb +1 -0
- data/lib/mongo/operation/update/legacy/result.rb +7 -0
- data/lib/mongo/operation/update/result.rb +8 -0
- data/lib/mongo/operation/users_info/result.rb +3 -0
- data/lib/mongo/protocol/compressed.rb +51 -5
- data/lib/mongo/protocol/message.rb +31 -4
- data/lib/mongo/protocol/msg.rb +37 -12
- data/lib/mongo/protocol/query.rb +36 -0
- data/lib/mongo/query_cache.rb +272 -0
- data/lib/mongo/retryable.rb +9 -2
- data/lib/mongo/server.rb +12 -16
- data/lib/mongo/server/app_metadata.rb +52 -18
- data/lib/mongo/server/connection.rb +5 -0
- data/lib/mongo/server/connection_base.rb +16 -15
- data/lib/mongo/server/connection_common.rb +2 -2
- data/lib/mongo/server/connection_pool.rb +9 -4
- data/lib/mongo/server/description.rb +12 -1
- data/lib/mongo/server/description/features.rb +9 -8
- data/lib/mongo/server/monitor.rb +21 -2
- data/lib/mongo/server/monitor/app_metadata.rb +1 -1
- data/lib/mongo/server/monitor/connection.rb +12 -13
- data/lib/mongo/server/pending_connection.rb +26 -8
- data/lib/mongo/server/push_monitor.rb +12 -2
- data/lib/mongo/server_selector/base.rb +5 -1
- data/lib/mongo/session.rb +7 -3
- data/lib/mongo/session/session_pool.rb +4 -2
- data/lib/mongo/socket.rb +35 -8
- data/lib/mongo/socket/ocsp_cache.rb +97 -0
- data/lib/mongo/socket/ocsp_verifier.rb +368 -0
- data/lib/mongo/socket/ssl.rb +53 -24
- data/lib/mongo/srv/monitor.rb +7 -24
- data/lib/mongo/srv/resolver.rb +14 -10
- data/lib/mongo/timeout.rb +2 -0
- data/lib/mongo/uri.rb +21 -390
- data/lib/mongo/uri/options_mapper.rb +620 -0
- data/lib/mongo/uri/srv_protocol.rb +3 -2
- data/lib/mongo/utils.rb +27 -1
- data/lib/mongo/version.rb +1 -1
- data/spec/NOTES.aws-auth.md +12 -7
- data/spec/README.md +87 -2
- data/spec/integration/auth_spec.rb +25 -15
- data/spec/integration/bson_symbol_spec.rb +4 -2
- data/spec/integration/bulk_write_error_message_spec.rb +41 -0
- data/spec/integration/bulk_write_spec.rb +48 -0
- data/spec/integration/change_stream_spec.rb +5 -5
- data/spec/integration/client_authentication_options_spec.rb +92 -28
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +6 -2
- data/spec/integration/command_monitoring_spec.rb +2 -2
- data/spec/integration/connection_pool_populator_spec.rb +4 -2
- data/spec/integration/connection_spec.rb +2 -0
- data/spec/integration/cursor_reaping_spec.rb +54 -18
- data/spec/integration/docs_examples_spec.rb +8 -1
- data/spec/integration/fork_reconnect_spec.rb +60 -2
- data/spec/integration/ocsp_connectivity_spec.rb +26 -0
- data/spec/integration/ocsp_verifier_cache_spec.rb +188 -0
- data/spec/integration/ocsp_verifier_spec.rb +340 -0
- data/spec/integration/operation_failure_code_spec.rb +1 -1
- data/spec/integration/operation_failure_message_spec.rb +90 -0
- data/spec/integration/query_cache_spec.rb +1045 -0
- data/spec/integration/query_cache_transactions_spec.rb +190 -0
- data/spec/integration/reconnect_spec.rb +1 -1
- data/spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb +1 -0
- data/spec/integration/retryable_writes/shared/performs_legacy_retries.rb +2 -0
- data/spec/integration/sdam_error_handling_spec.rb +86 -1
- data/spec/integration/sdam_events_spec.rb +8 -7
- data/spec/integration/server_selection_spec.rb +36 -0
- data/spec/integration/size_limit_spec.rb +20 -19
- data/spec/integration/snappy_compression_spec.rb +25 -0
- data/spec/integration/srv_monitoring_spec.rb +39 -4
- data/spec/integration/srv_spec.rb +56 -0
- data/spec/integration/transactions_examples_spec.rb +23 -7
- data/spec/integration/zlib_compression_spec.rb +1 -1
- data/spec/integration/zstd_compression_spec.rb +26 -0
- data/spec/lite_spec_helper.rb +15 -5
- data/spec/mongo/address_spec.rb +16 -12
- data/spec/mongo/auth/ldap/conversation_spec.rb +1 -1
- data/spec/mongo/auth/ldap_spec.rb +5 -1
- data/spec/mongo/auth/scram_negotiation_spec.rb +1 -1
- data/spec/mongo/auth/scram_spec.rb +1 -1
- data/spec/mongo/auth/user_spec.rb +1 -1
- data/spec/mongo/auth/x509/conversation_spec.rb +3 -3
- data/spec/mongo/bulk_write_spec.rb +2 -2
- data/spec/mongo/caching_cursor_spec.rb +70 -0
- data/spec/mongo/client_construction_spec.rb +273 -35
- data/spec/mongo/client_encryption_spec.rb +16 -10
- data/spec/mongo/client_spec.rb +64 -0
- data/spec/mongo/cluster/topology/replica_set_spec.rb +1 -1
- data/spec/mongo/cluster/topology/sharded_spec.rb +1 -1
- data/spec/mongo/cluster/topology/single_spec.rb +15 -6
- data/spec/mongo/cluster/topology/unknown_spec.rb +1 -1
- data/spec/mongo/cluster/topology_spec.rb +1 -1
- data/spec/mongo/cluster_spec.rb +6 -18
- data/spec/mongo/collection/view/change_stream_resume_spec.rb +1 -1
- data/spec/mongo/collection/view/explainable_spec.rb +87 -4
- data/spec/mongo/collection/view/map_reduce_spec.rb +2 -0
- data/spec/mongo/collection/view/readable_spec.rb +50 -0
- data/spec/mongo/collection_crud_spec.rb +4357 -0
- data/spec/mongo/collection_ddl_spec.rb +534 -0
- data/spec/mongo/collection_spec.rb +5 -4787
- data/spec/mongo/crypt/auto_decryption_context_spec.rb +1 -1
- data/spec/mongo/crypt/auto_encryption_context_spec.rb +1 -1
- data/spec/mongo/crypt/binary_spec.rb +1 -6
- data/spec/mongo/crypt/binding/binary_spec.rb +1 -6
- data/spec/mongo/crypt/binding/context_spec.rb +2 -7
- data/spec/mongo/crypt/binding/helpers_spec.rb +1 -6
- data/spec/mongo/crypt/binding/mongocrypt_spec.rb +2 -7
- data/spec/mongo/crypt/binding/status_spec.rb +1 -6
- data/spec/mongo/crypt/binding/version_spec.rb +1 -6
- data/spec/mongo/crypt/data_key_context_spec.rb +1 -1
- data/spec/mongo/crypt/explicit_decryption_context_spec.rb +1 -1
- data/spec/mongo/crypt/explicit_encryption_context_spec.rb +1 -1
- data/spec/mongo/crypt/status_spec.rb +1 -6
- data/spec/mongo/database_spec.rb +174 -4
- data/spec/mongo/error/bulk_write_error_spec.rb +3 -3
- data/spec/mongo/error/no_server_available_spec.rb +1 -1
- data/spec/mongo/error/parser_spec.rb +37 -6
- data/spec/mongo/index/view_spec.rb +8 -2
- data/spec/mongo/logger_spec.rb +13 -11
- data/spec/mongo/monitoring/event/server_closed_spec.rb +1 -1
- data/spec/mongo/monitoring/event/server_heartbeat_failed_spec.rb +1 -1
- data/spec/mongo/monitoring/event/server_heartbeat_succeeded_spec.rb +1 -1
- data/spec/mongo/monitoring/event/server_opening_spec.rb +1 -1
- data/spec/mongo/monitoring/event/topology_changed_spec.rb +1 -1
- data/spec/mongo/monitoring/event/topology_closed_spec.rb +1 -1
- data/spec/mongo/monitoring/event/topology_opening_spec.rb +1 -1
- data/spec/mongo/operation/aggregate_spec.rb +2 -1
- data/spec/mongo/operation/collections_info_spec.rb +4 -1
- data/spec/mongo/operation/command_spec.rb +6 -3
- data/spec/mongo/operation/create_index_spec.rb +6 -3
- data/spec/mongo/operation/create_user_spec.rb +6 -3
- data/spec/mongo/operation/delete/bulk_spec.rb +9 -6
- data/spec/mongo/operation/delete/op_msg_spec.rb +3 -3
- data/spec/mongo/operation/delete_spec.rb +11 -7
- data/spec/mongo/operation/drop_index_spec.rb +6 -2
- data/spec/mongo/operation/find/legacy_spec.rb +3 -1
- data/spec/mongo/operation/get_more_spec.rb +3 -1
- data/spec/mongo/operation/indexes_spec.rb +5 -1
- data/spec/mongo/operation/insert/bulk_spec.rb +10 -7
- data/spec/mongo/operation/insert/command_spec.rb +2 -2
- data/spec/mongo/operation/insert/op_msg_spec.rb +3 -3
- data/spec/mongo/operation/insert_spec.rb +15 -12
- data/spec/mongo/operation/map_reduce_spec.rb +5 -2
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +1 -1
- data/spec/mongo/operation/remove_user_spec.rb +6 -3
- data/spec/mongo/operation/result_spec.rb +1 -1
- data/spec/mongo/operation/update/bulk_spec.rb +9 -6
- data/spec/mongo/operation/update/command_spec.rb +2 -2
- data/spec/mongo/operation/update/op_msg_spec.rb +3 -3
- data/spec/mongo/operation/update_spec.rb +10 -7
- data/spec/mongo/operation/update_user_spec.rb +4 -1
- data/spec/mongo/protocol/compressed_spec.rb +26 -12
- data/spec/mongo/query_cache_middleware_spec.rb +55 -0
- data/spec/mongo/query_cache_spec.rb +280 -0
- data/spec/mongo/retryable_spec.rb +3 -2
- data/spec/mongo/server/app_metadata_shared.rb +2 -2
- data/spec/mongo/server/app_metadata_spec.rb +2 -0
- data/spec/mongo/server/connection_pool/populator_spec.rb +3 -1
- data/spec/mongo/server/connection_pool_spec.rb +8 -4
- data/spec/mongo/server/connection_spec.rb +39 -25
- data/spec/mongo/server/description_spec.rb +18 -0
- data/spec/mongo/server/monitor/connection_spec.rb +17 -7
- data/spec/mongo/server/monitor_spec.rb +9 -1
- data/spec/mongo/server_selector_spec.rb +2 -2
- data/spec/mongo/server_spec.rb +15 -2
- data/spec/mongo/socket/ssl_spec.rb +44 -4
- data/spec/mongo/socket_spec.rb +2 -2
- data/spec/mongo/tls_context_hooks_spec.rb +37 -0
- data/spec/mongo/uri/srv_protocol_spec.rb +64 -33
- data/spec/mongo/uri_option_parsing_spec.rb +11 -11
- data/spec/mongo/uri_spec.rb +68 -41
- data/spec/mongo/utils_spec.rb +39 -0
- data/spec/runners/auth.rb +3 -0
- data/spec/runners/change_streams/test.rb +1 -1
- data/spec/runners/connection_string.rb +31 -124
- data/spec/runners/crud/requirement.rb +40 -3
- data/spec/runners/crud/test_base.rb +0 -19
- data/spec/runners/crud/verifier.rb +8 -0
- data/spec/runners/server_selection.rb +1 -1
- data/spec/runners/transactions/operation.rb +13 -2
- data/spec/runners/transactions/test.rb +3 -2
- data/spec/runners/unified.rb +96 -0
- data/spec/runners/unified/assertions.rb +249 -0
- data/spec/runners/unified/change_stream_operations.rb +26 -0
- data/spec/runners/unified/crud_operations.rb +199 -0
- data/spec/runners/unified/ddl_operations.rb +96 -0
- data/spec/runners/unified/entity_map.rb +39 -0
- data/spec/runners/unified/error.rb +25 -0
- data/spec/runners/unified/event_subscriber.rb +91 -0
- data/spec/runners/unified/exceptions.rb +21 -0
- data/spec/runners/unified/grid_fs_operations.rb +55 -0
- data/spec/runners/unified/support_operations.rb +250 -0
- data/spec/runners/unified/test.rb +393 -0
- data/spec/runners/unified/test_group.rb +28 -0
- data/spec/runners/unified/using_hash.rb +31 -0
- data/spec/shared/LICENSE +20 -0
- data/spec/shared/bin/get-mongodb-download-url +17 -0
- data/spec/shared/lib/mrss/child_process_helper.rb +80 -0
- data/spec/shared/lib/mrss/cluster_config.rb +218 -0
- data/spec/shared/lib/mrss/constraints.rb +346 -0
- data/spec/shared/lib/mrss/docker_runner.rb +262 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +175 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +112 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +149 -0
- data/spec/shared/lib/mrss/utils.rb +15 -0
- data/spec/shared/share/Dockerfile.erb +231 -0
- data/spec/shared/shlib/distro.sh +73 -0
- data/spec/shared/shlib/server.sh +290 -0
- data/spec/shared/shlib/set_env.sh +128 -0
- data/spec/solo/clean_exit_spec.rb +21 -0
- data/spec/spec_helper.rb +7 -2
- data/spec/spec_tests/cmap_spec.rb +7 -3
- data/spec/spec_tests/crud_unified_spec.rb +10 -0
- data/spec/spec_tests/data/change_streams/change-streams-errors.yml +0 -1
- data/spec/spec_tests/data/change_streams/change-streams.yml +0 -2
- data/spec/spec_tests/data/cmap/pool-checkout-connection.yml +6 -2
- data/spec/spec_tests/data/cmap/pool-create-min-size.yml +3 -0
- data/spec/spec_tests/data/connection_string/valid-warnings.yml +24 -0
- data/spec/spec_tests/data/crud_unified/estimatedDocumentCount.yml +267 -0
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-4.9.yml +60 -0
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount.yml → estimatedDocumentCount-pre4.9.yml} +2 -0
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors-4.9.yml +146 -0
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount-serverErrors.yml → estimatedDocumentCount-serverErrors-pre4.9.yml} +2 -0
- data/spec/spec_tests/data/retryable_reads/listIndexNames.yml +1 -1
- data/spec/spec_tests/data/sdam_monitoring/discovered_standalone.yml +1 -3
- data/spec/spec_tests/data/sdam_monitoring/standalone.yml +2 -2
- data/spec/spec_tests/data/sdam_monitoring/standalone_repeated.yml +2 -2
- data/spec/spec_tests/data/sdam_monitoring/standalone_suppress_equal_description_changes.yml +2 -2
- data/spec/spec_tests/data/sdam_monitoring/standalone_to_rs_with_me_mismatch.yml +2 -2
- data/spec/spec_tests/data/unified/valid-fail/operation-failure.yml +31 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-change-streams.yml +220 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-command-monitoring.yml +102 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-crud.yml +184 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-gridfs.yml +155 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-retryable-reads.yml +193 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-retryable-writes.yml +210 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-sessions.yml +215 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-convenient-api.yml +235 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-mongos-pin-auto.yml +169 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions.yml +170 -0
- data/spec/spec_tests/data/uri_options/auth-options.yml +25 -0
- data/spec/spec_tests/data/uri_options/compression-options.yml +7 -4
- data/spec/spec_tests/data/uri_options/read-preference-options.yml +24 -0
- data/spec/spec_tests/data/uri_options/ruby-connection-options.yml +1 -0
- data/spec/spec_tests/data/uri_options/tls-options.yml +160 -4
- data/spec/spec_tests/data/versioned_api/crud-api-version-1-strict.yml +416 -0
- data/spec/spec_tests/data/versioned_api/crud-api-version-1.yml +409 -0
- data/spec/spec_tests/data/versioned_api/runcommand-helper-no-api-version-declared.yml +67 -0
- data/spec/spec_tests/data/versioned_api/test-commands-deprecation-errors.yml +47 -0
- data/spec/spec_tests/data/versioned_api/test-commands-strict-mode.yml +44 -0
- data/spec/spec_tests/data/versioned_api/transaction-handling.yml +180 -0
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +9 -1
- data/spec/spec_tests/unified_spec.rb +15 -0
- data/spec/spec_tests/uri_options_spec.rb +47 -33
- data/spec/spec_tests/versioned_api_spec.rb +10 -0
- data/spec/stress/fork_reconnect_stress_spec.rb +1 -1
- data/spec/support/certificates/atlas-ocsp-ca.crt +28 -0
- data/spec/support/certificates/atlas-ocsp.crt +41 -0
- data/spec/support/client_registry_macros.rb +11 -2
- data/spec/support/common_shortcuts.rb +59 -0
- data/spec/support/constraints.rb +6 -253
- data/spec/support/matchers.rb +16 -0
- data/spec/support/ocsp +1 -0
- data/spec/support/session_registry.rb +52 -0
- data/spec/support/shared/session.rb +2 -2
- data/spec/support/spec_config.rb +68 -3
- data/spec/support/spec_setup.rb +48 -38
- data/spec/support/utils.rb +102 -4
- metadata +1087 -936
- metadata.gz.sig +0 -0
- data/lib/mongo/operation/shared/collections_info_or_list_collections.rb +0 -56
- data/lib/mongo/operation/shared/op_msg_or_list_indexes_command.rb +0 -47
- data/spec/support/child_process_helper.rb +0 -78
- data/spec/support/cluster_config.rb +0 -207
- data/spec/support/lite_constraints.rb +0 -141
- data/spec/support/spec_organizer.rb +0 -129
@@ -0,0 +1,149 @@
|
|
1
|
+
autoload :JSON, 'json'
|
2
|
+
autoload :FileUtils, 'fileutils'
|
3
|
+
autoload :Find, 'find'
|
4
|
+
|
5
|
+
module Mrss
|
6
|
+
|
7
|
+
autoload :ChildProcessHelper, 'mrss/child_process_helper'
|
8
|
+
|
9
|
+
# Organizes and runs all of the tests in the test suite in batches.
|
10
|
+
#
|
11
|
+
# Organizing the tests in batches serves two purposes:
|
12
|
+
#
|
13
|
+
# 1. This allows running unit tests before integration tests, therefore
|
14
|
+
# in theory revealing failures quicker on average.
|
15
|
+
# 2. This allows running some tests that have high intermittent failure rate
|
16
|
+
# in their own test process.
|
17
|
+
#
|
18
|
+
# This class aggregates RSpec results after the test runs.
|
19
|
+
class SpecOrganizer
|
20
|
+
|
21
|
+
class BucketsNotPrioritized < StandardError
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(root: nil, classifiers:, priority_order:,
|
25
|
+
spec_root: nil, rspec_json_path: nil, rspec_all_json_path: nil
|
26
|
+
)
|
27
|
+
@spec_root = spec_root || File.join(root, 'spec')
|
28
|
+
@classifiers = classifiers
|
29
|
+
@priority_order = priority_order
|
30
|
+
@rspec_json_path = rspec_json_path || File.join(root, 'tmp/rspec.json')
|
31
|
+
@rspec_all_json_path = rspec_all_json_path || File.join(root, 'tmp/rspec-all.json')
|
32
|
+
end
|
33
|
+
|
34
|
+
attr_reader :spec_root, :classifiers, :priority_order
|
35
|
+
attr_reader :rspec_json_path, :rspec_all_json_path
|
36
|
+
|
37
|
+
def buckets
|
38
|
+
@buckets ||= {}.tap do |buckets|
|
39
|
+
Find.find(spec_root) do |path|
|
40
|
+
next unless File.file?(path)
|
41
|
+
next unless path =~ /_spec\.rb\z/
|
42
|
+
rel_path = path[(spec_root.length + 1)..path.length]
|
43
|
+
|
44
|
+
found = false
|
45
|
+
classifiers.each do |(regexp, category)|
|
46
|
+
if regexp =~ rel_path
|
47
|
+
buckets[category] ||= []
|
48
|
+
buckets[category] << File.join('spec', rel_path)
|
49
|
+
found = true
|
50
|
+
break
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
unless found
|
55
|
+
buckets[nil] ||= []
|
56
|
+
buckets[nil] << File.join('spec', rel_path)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end.freeze
|
60
|
+
end
|
61
|
+
|
62
|
+
def ordered_buckets
|
63
|
+
@ordered_buckets ||= {}.tap do |ordered_buckets|
|
64
|
+
buckets = self.buckets.dup
|
65
|
+
priority_order.each do |category|
|
66
|
+
files = buckets.delete(category)
|
67
|
+
ordered_buckets[category] = files
|
68
|
+
end
|
69
|
+
|
70
|
+
if files = buckets.delete(nil)
|
71
|
+
ordered_buckets[nil] = files
|
72
|
+
end
|
73
|
+
|
74
|
+
unless buckets.empty?
|
75
|
+
raise BucketsNotPrioritized, "Some buckets were not prioritized: #{buckets.keys.map(&:to_s).join(', ')}"
|
76
|
+
end
|
77
|
+
end.freeze
|
78
|
+
end
|
79
|
+
|
80
|
+
def run
|
81
|
+
FileUtils.rm_f(rspec_all_json_path)
|
82
|
+
|
83
|
+
failed = []
|
84
|
+
buckets = self.buckets.dup
|
85
|
+
|
86
|
+
priority_order.each do |category|
|
87
|
+
if files = buckets.delete(category)
|
88
|
+
unless run_files(category, files)
|
89
|
+
failed << category
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
if files = buckets.delete(nil)
|
94
|
+
unless run_files('remaining', files)
|
95
|
+
failed << 'remaining'
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
unless buckets.empty?
|
100
|
+
raise "Some buckets were not executed: #{buckets.keys.map(&:to_s).join(', ')}"
|
101
|
+
end
|
102
|
+
|
103
|
+
if failed.any?
|
104
|
+
raise "The following buckets failed: #{failed.map(&:to_s).join(', ')}"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def run_files(category, paths)
|
109
|
+
puts "Running #{category.to_s.gsub('_', ' ')} tests"
|
110
|
+
FileUtils.rm_f(rspec_json_path)
|
111
|
+
cmd = %w(rspec) + paths
|
112
|
+
|
113
|
+
begin
|
114
|
+
ChildProcessHelper.check_call(cmd)
|
115
|
+
ensure
|
116
|
+
if File.exist?(rspec_json_path)
|
117
|
+
if File.exist?(rspec_all_json_path)
|
118
|
+
merge_rspec_results
|
119
|
+
else
|
120
|
+
FileUtils.cp(rspec_json_path, rspec_all_json_path)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
true
|
126
|
+
rescue ChildProcessHelper::SpawnError
|
127
|
+
false
|
128
|
+
end
|
129
|
+
|
130
|
+
def merge_rspec_results
|
131
|
+
all = JSON.parse(File.read(rspec_all_json_path))
|
132
|
+
new = JSON.parse(File.read(rspec_json_path))
|
133
|
+
all['examples'] += new.delete('examples')
|
134
|
+
new.delete('summary').each do |k, v|
|
135
|
+
all['summary'][k] += v
|
136
|
+
end
|
137
|
+
new.delete('version')
|
138
|
+
new.delete('summary_line')
|
139
|
+
unless new.empty?
|
140
|
+
raise "Unhandled rspec results keys: #{new.keys.join(', ')}"
|
141
|
+
end
|
142
|
+
# We do not merge summary lines, delete them from aggregated results
|
143
|
+
all.delete('summary_line')
|
144
|
+
File.open(rspec_all_json_path, 'w') do |f|
|
145
|
+
f << JSON.dump(all)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,231 @@
|
|
1
|
+
# Python toolchain as of this writing is available on rhel62, debian92 and
|
2
|
+
# ubuntu1604.
|
3
|
+
#
|
4
|
+
# To run rhel62 in docker, host system must be configured to emulate syscalls:
|
5
|
+
# https://github.com/CentOS/sig-cloud-instance-images/issues/103
|
6
|
+
|
7
|
+
<%
|
8
|
+
|
9
|
+
python_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-python-driver-toolchain/#{distro}/ba92de2700c04ee2d4f82c3ffdfc33105140cb04/mongo_python_driver_toolchain_#{distro.gsub('-', '_')}_ba92de2700c04ee2d4f82c3ffdfc33105140cb04_19_11_14_15_33_33.tar.gz"
|
10
|
+
server_version = '4.3.3'
|
11
|
+
server_url = "http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-#{distro}-#{server_version}.tgz"
|
12
|
+
server_archive_basename = File.basename(server_url)
|
13
|
+
server_extracted_dir = server_archive_basename.sub(/\.(tar\.gz|tgz)$/, '')
|
14
|
+
|
15
|
+
toolchain_upper='291ba4a4e8297f142796e70eee71b99f333e35e1'
|
16
|
+
|
17
|
+
ruby_toolchain_url = "http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/ruby-toolchain-#{distro}-#{toolchain_upper}.tar.xz"
|
18
|
+
#ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{toolchain_upper}/mongo_ruby_driver_toolchain_#{distro.gsub('-', '_')}_patch_#{toolchain_upper}_#{toolchain_lower}.tar.gz"
|
19
|
+
|
20
|
+
%>
|
21
|
+
|
22
|
+
FROM <%= base_image %>
|
23
|
+
|
24
|
+
<% if debian? %>
|
25
|
+
|
26
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
27
|
+
|
28
|
+
<% else %>
|
29
|
+
|
30
|
+
RUN echo assumeyes=1 |tee -a /etc/yum.conf
|
31
|
+
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<% if ruby_head? %>
|
35
|
+
|
36
|
+
# To use current versions of mlaunch, Python 3.6+ is required.
|
37
|
+
# Most distros ship with older Pythons, therefore we need to install
|
38
|
+
# a newer Python from somewhere. This section installs the Python
|
39
|
+
# toolhcain which comes with recent Pythons.
|
40
|
+
# Alternatively, Ruby toolchain compiles its own copy of Python 3 but
|
41
|
+
# this is currently incomplete in that on older distros with old OpenSSL,
|
42
|
+
# the built Python has no ssl module and hence practically is unusable.
|
43
|
+
# Currently Ruby driver uses mtools-legacy which supports Python 2,
|
44
|
+
# avoiding this entire issue for the time being.
|
45
|
+
|
46
|
+
#RUN curl --retry 3 -fL <%= python_toolchain_url %> -o python-toolchain.tar.gz
|
47
|
+
#RUN tar -xC /opt -zf python-toolchain.tar.gz
|
48
|
+
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
<% if debian? %>
|
52
|
+
|
53
|
+
# zsh is not required for any scripts but it is a better interactive shell
|
54
|
+
# than bash.
|
55
|
+
# Ruby runtime dependencies: libyaml-0-2
|
56
|
+
# Compiling ruby libraries: gcc make
|
57
|
+
# Compiling pyhton packages: python2.7-dev
|
58
|
+
# JRuby: openjdk-8-jre-headless
|
59
|
+
# Server dependencies: libsnmp30 libcurl3/libcurl4
|
60
|
+
# Determining OS we are running on: lsb-release
|
61
|
+
# Kerberos testing: krb5-user
|
62
|
+
# Local Kerberos server: krb5-kdc krb5-admin-server
|
63
|
+
# Installing mlaunch from git: git
|
64
|
+
# ruby-head archive: bzip2
|
65
|
+
# nio4r on JRuby: libgmp-dev
|
66
|
+
# Snappy compression: libsnappy-dev
|
67
|
+
# nokogiri: zlib1g-dev
|
68
|
+
# Mongoid testing: tzdata
|
69
|
+
# Mongoid application testing: nodejs (8.x or newer)
|
70
|
+
#
|
71
|
+
# We currently use Python 2-compatible version of mtools, which
|
72
|
+
# is installable via pip (which uses Python 2). All of the MongoDB
|
73
|
+
# distros have pip installed (but none as of this writing have pip3)
|
74
|
+
# therefore install python-pip in all configurations here.
|
75
|
+
|
76
|
+
<% packages = %w(
|
77
|
+
lsb-release bzip2 curl zsh
|
78
|
+
git make gcc libyaml-0-2 libgmp-dev zlib1g-dev libsnappy-dev
|
79
|
+
libsnmp30
|
80
|
+
krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
|
81
|
+
python-pip python2.7-dev python3-pip
|
82
|
+
tzdata
|
83
|
+
) %>
|
84
|
+
|
85
|
+
# ubuntu1404 only has openjdk-7-jre-headless
|
86
|
+
<% if distro !~ /ubuntu1404/ %>
|
87
|
+
<% packages << 'openjdk-8-jre-headless' %>
|
88
|
+
<% end %>
|
89
|
+
|
90
|
+
# ubuntu1404, ubuntu1604: libcurl3
|
91
|
+
# ubuntu1804: libcurl4
|
92
|
+
<% if distro =~ /ubuntu1804/ %>
|
93
|
+
<% packages << 'libcurl4' %>
|
94
|
+
<% else %>
|
95
|
+
<% packages << 'libcurl3' %>
|
96
|
+
<% end %>
|
97
|
+
|
98
|
+
<% if distro =~ /ubuntu1804/ %>
|
99
|
+
<% packages << 'nodejs' %>
|
100
|
+
<% end %>
|
101
|
+
|
102
|
+
RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
|
103
|
+
<% else %>
|
104
|
+
|
105
|
+
# Enterprise server: net-snmp
|
106
|
+
# lsb_release: redhat-lsb-core
|
107
|
+
# our runner scripts: which
|
108
|
+
# Ruby dependency: libyaml
|
109
|
+
# compiling python packages: gcc python-devel
|
110
|
+
# Kerberos tests: krb5-workstation + cyrus-sasl-devel to build the
|
111
|
+
# mongo_kerberos gem + cyrus-sasl-gssapi for authentication to work
|
112
|
+
# Local Kerberos server: krb5-server
|
113
|
+
# JRuby: java-1.8.0-openjdk
|
114
|
+
#
|
115
|
+
# Note: lacking cyrus-sasl-gssapi produces a cryptic message
|
116
|
+
# "SASL(-4): no mechanism available: No worthy mechs found"
|
117
|
+
# https://github.com/farorm/python-ad/issues/10
|
118
|
+
|
119
|
+
RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
|
120
|
+
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
|
121
|
+
net-snmp
|
122
|
+
|
123
|
+
<% if distro =~ /rhel6/ %>
|
124
|
+
|
125
|
+
# RHEL 6 ships with Python 2.6.
|
126
|
+
|
127
|
+
RUN yum install -y centos-release-scl && \
|
128
|
+
yum install -y python27-python python27-python-devel
|
129
|
+
ENV PATH=/opt/rh/python27/root/usr/bin:$PATH \
|
130
|
+
LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64
|
131
|
+
|
132
|
+
<% else %>
|
133
|
+
|
134
|
+
RUN yum install -y python-devel
|
135
|
+
|
136
|
+
<% end %>
|
137
|
+
|
138
|
+
<% end %>
|
139
|
+
|
140
|
+
<% if preload? %>
|
141
|
+
|
142
|
+
# Current virtualenv fails with
|
143
|
+
# https://github.com/pypa/virtualenv/issues/1630
|
144
|
+
RUN python2 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
|
145
|
+
|
146
|
+
RUN pip --version && \
|
147
|
+
pip install mtools-legacy[mlaunch]
|
148
|
+
|
149
|
+
<% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
|
150
|
+
RUN python3 -mpip install asn1crypto oscrypto flask
|
151
|
+
<% end %>
|
152
|
+
|
153
|
+
<% unless ruby_head? %>
|
154
|
+
|
155
|
+
RUN curl --retry 3 -fL <%= ruby_toolchain_url %> |tar -xC /opt -Jf -
|
156
|
+
ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
|
157
|
+
USE_OPT_TOOLCHAIN=1
|
158
|
+
#ENV PATH=/opt/rubies/python/3/bin:$PATH
|
159
|
+
|
160
|
+
<% end %>
|
161
|
+
|
162
|
+
<% if distro =~ /rhel|ubuntu1604/ %>
|
163
|
+
|
164
|
+
# Ubuntu 12.04 ships pip 1.0 which is ancient and does not work.
|
165
|
+
#
|
166
|
+
# Ubuntu 16.04 apparently also ships a pip that does not work:
|
167
|
+
# https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry
|
168
|
+
# Potentially this only affects environments with less than ideal
|
169
|
+
# connectivity (or, perhaps, when python package registry is experiencing
|
170
|
+
# availability issues) when pip must retry to install packages.
|
171
|
+
#
|
172
|
+
# rhel apparently does not package pip at all in core repoitories,
|
173
|
+
# therefore install it the manual way.
|
174
|
+
#
|
175
|
+
# https://pip.pypa.io/en/stable/installing/
|
176
|
+
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python
|
177
|
+
|
178
|
+
<% end %>
|
179
|
+
|
180
|
+
RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
|
181
|
+
mv mongo*/ /opt/mongodb
|
182
|
+
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
183
|
+
|
184
|
+
<% end %>
|
185
|
+
|
186
|
+
WORKDIR /app
|
187
|
+
|
188
|
+
<% if preload? && !ruby_head? %>
|
189
|
+
|
190
|
+
COPY Gemfile .
|
191
|
+
COPY gemfiles gemfiles
|
192
|
+
COPY *.gemspec .
|
193
|
+
COPY lib/<%= project_lib_subdir %>/version.rb lib/<%= project_lib_subdir %>/version.rb
|
194
|
+
RUN bundle install
|
195
|
+
COPY .evergreen/patch-debuggers .evergreen/patch-debuggers
|
196
|
+
RUN .evergreen/patch-debuggers /opt/rubies
|
197
|
+
|
198
|
+
<% end %>
|
199
|
+
|
200
|
+
<% if fle? %>
|
201
|
+
RUN curl --retry 3 -fLo libmongocrypt-all.tar.gz "https://s3.amazonaws.com/mciuploads/libmongocrypt/all/master/latest/libmongocrypt-all.tar.gz"
|
202
|
+
RUN tar xf libmongocrypt-all.tar.gz
|
203
|
+
|
204
|
+
<%= "ENV LIBMONGOCRYPT_PATH #{libmongocrypt_path}" %>
|
205
|
+
<% end %>
|
206
|
+
|
207
|
+
ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
|
208
|
+
PROJECT_DIRECTORY=/app \
|
209
|
+
<%= @env.map { |k, v| %Q`#{k}="#{v.gsub('$', "\\$").gsub('"', "\\\"")}"` }.join(" \\\n ") %>
|
210
|
+
|
211
|
+
<% if interactive? %>
|
212
|
+
ENV INTERACTIVE=1
|
213
|
+
<% end %>
|
214
|
+
|
215
|
+
COPY . .
|
216
|
+
|
217
|
+
<% if expose? %>
|
218
|
+
|
219
|
+
<% ports = [] %>
|
220
|
+
|
221
|
+
<% 0.upto(num_exposed_ports-1) do |i| %>
|
222
|
+
<% ports << 27017 + i %>
|
223
|
+
<% end %>
|
224
|
+
|
225
|
+
<% if @env['OCSP_ALGORITHM'] %>
|
226
|
+
<% ports << 8100 %>
|
227
|
+
<% end %>
|
228
|
+
|
229
|
+
EXPOSE <%= ports.map(&:to_s).join(' ') %>
|
230
|
+
|
231
|
+
<% end %>
|
@@ -0,0 +1,73 @@
|
|
1
|
+
detected_distro=
|
2
|
+
|
3
|
+
host_distro() {
|
4
|
+
if test -z "$detected_distro"; then
|
5
|
+
detected_distro=`_detect_distro`
|
6
|
+
fi
|
7
|
+
echo "$detected_distro"
|
8
|
+
}
|
9
|
+
|
10
|
+
_detect_distro() {
|
11
|
+
local distro
|
12
|
+
distro=
|
13
|
+
if test -f /etc/debian_version; then
|
14
|
+
# Debian or Ubuntu
|
15
|
+
if test "`uname -m`" = aarch64; then
|
16
|
+
distro=ubuntu1604-arm
|
17
|
+
elif lsb_release -is |grep -q Debian; then
|
18
|
+
release=`lsb_release -rs |tr -d .`
|
19
|
+
# In docker, release is something like 9.11.
|
20
|
+
# In evergreen, release is 9.2.
|
21
|
+
release=`echo $release |sed -e 's/^9.*/92/'`
|
22
|
+
distro="debian$release"
|
23
|
+
elif lsb_release -is |grep -q Ubuntu; then
|
24
|
+
if test "`uname -m`" = ppc64le; then
|
25
|
+
release=`lsb_release -rs |tr -d .`
|
26
|
+
distro="ubuntu$release-ppc"
|
27
|
+
else
|
28
|
+
release=`lsb_release -rs |tr -d .`
|
29
|
+
distro="ubuntu$release"
|
30
|
+
fi
|
31
|
+
else
|
32
|
+
echo 'Unknown Debian flavor' 1>&2
|
33
|
+
exit 1
|
34
|
+
fi
|
35
|
+
elif lsb_release -is |grep -qi suse; then
|
36
|
+
if test "`uname -m`" = s390x; then
|
37
|
+
release=`lsb_release -rs |sed -e 's/\..*//'`
|
38
|
+
distro="suse$release-s390x"
|
39
|
+
else
|
40
|
+
echo 'Unknown Suse arch' 1>&2
|
41
|
+
exit 1
|
42
|
+
fi
|
43
|
+
elif test -f /etc/redhat-release; then
|
44
|
+
# RHEL or CentOS
|
45
|
+
if test "`uname -m`" = s390x; then
|
46
|
+
distro=rhel72-s390x
|
47
|
+
elif test "`uname -m`" = ppc64le; then
|
48
|
+
distro=rhel71-ppc
|
49
|
+
elif lsb_release >/dev/null 2>&1; then
|
50
|
+
if lsb_release -is |grep -q RedHat; then
|
51
|
+
release=`lsb_release -rs |tr -d .`
|
52
|
+
distro="rhel$release"
|
53
|
+
elif lsb_release -is |grep -q CentOS; then
|
54
|
+
release=`lsb_release -rs |cut -c 1 |sed -e s/7/70/ -e s/6/62/ -e s/8/80/`
|
55
|
+
distro="rhel$release"
|
56
|
+
else
|
57
|
+
echo 'Unknown RHEL flavor' 1>&2
|
58
|
+
exit 1
|
59
|
+
fi
|
60
|
+
else
|
61
|
+
echo lsb_release missing, using /etc/redhat-release 1>&2
|
62
|
+
release=`grep -o 'release [0-9]' /etc/redhat-release |awk '{print $2}'`
|
63
|
+
release=`echo $release |sed -e s/7/70/ -e s/6/62/ -e s/8/80/`
|
64
|
+
distro=rhel$release
|
65
|
+
fi
|
66
|
+
else
|
67
|
+
lsb_release -a
|
68
|
+
echo 'Unknown distro' 1>&2
|
69
|
+
exit 1
|
70
|
+
fi
|
71
|
+
echo "Detected distro: $distro" 1>&2
|
72
|
+
echo $distro
|
73
|
+
}
|